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 void __attribute__((noreturn)) abort(void);
11 static inline void assert(bool expression) {
12 if (!expression) { abort(); }
15 void *malloc(size_t size);
18 #define MALLOC(a, _) malloc(a)
19 #define FREE(p) if ((unsigned long)(p) > 4096) { free(p); }
20 #define DO_ASSERT(a) (void)(a)
22 #define CHECK_ACCESS(p)
23 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
25 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
26 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
27 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
28 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
30 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
32 typedef uint32_t int64_tArray;
33 typedef uint32_t int8_tArray;
34 typedef uint32_t uint32_tArray;
35 typedef uint32_t ptrArray;
36 typedef uint32_t jstring;
38 static inline uint32_t init_arr(size_t arr_len, size_t elem_size, const char *type_desc) {
39 uint32_t *elems = (uint32_t*)MALLOC(arr_len * elem_size + 4, type_desc);
41 return (uint32_t)elems;
44 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
45 char* err_buf = MALLOC(len + 4, "str conv buf");
46 *((uint32_t*)err_buf) = len;
47 memcpy(err_buf + 4, chars, len);
48 return (uint32_t) err_buf;
50 static inline LDKStr str_ref_to_owned_c(jstring str) {
51 uint32_t *str_len = (uint32_t*)str;
52 char* newchars = MALLOC(*str_len + 1, "String chars");
53 memcpy(newchars, (const char*)(str + 4), *str_len);
54 newchars[*str_len] = 0;
58 .chars_is_owned = true
63 typedef bool jboolean;
65 uint32_t __attribute__((visibility("default"))) TS_malloc(uint32_t size) {
66 return (uint32_t)MALLOC(size, "JS-Called malloc");
68 void __attribute__((visibility("default"))) TS_free(uint32_t ptr) {
71 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
72 static inline LDKAccessError LDKAccessError_from_js(int32_t ord) {
74 case 0: return LDKAccessError_UnknownChain;
75 case 1: return LDKAccessError_UnknownTx;
79 static inline int32_t LDKAccessError_to_js(LDKAccessError val) {
81 case LDKAccessError_UnknownChain: return 0;
82 case LDKAccessError_UnknownTx: return 1;
86 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_js(int32_t ord) {
88 case 0: return LDKCOption_NoneZ_Some;
89 case 1: return LDKCOption_NoneZ_None;
93 static inline int32_t LDKCOption_NoneZ_to_js(LDKCOption_NoneZ val) {
95 case LDKCOption_NoneZ_Some: return 0;
96 case LDKCOption_NoneZ_None: return 1;
100 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_js(int32_t ord) {
102 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
103 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
107 static inline int32_t LDKChannelMonitorUpdateErr_to_js(LDKChannelMonitorUpdateErr val) {
109 case LDKChannelMonitorUpdateErr_TemporaryFailure: return 0;
110 case LDKChannelMonitorUpdateErr_PermanentFailure: return 1;
114 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
116 case 0: return LDKConfirmationTarget_Background;
117 case 1: return LDKConfirmationTarget_Normal;
118 case 2: return LDKConfirmationTarget_HighPriority;
122 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
124 case LDKConfirmationTarget_Background: return 0;
125 case LDKConfirmationTarget_Normal: return 1;
126 case LDKConfirmationTarget_HighPriority: return 2;
130 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
132 case 0: return LDKCreationError_DescriptionTooLong;
133 case 1: return LDKCreationError_RouteTooLong;
134 case 2: return LDKCreationError_TimestampOutOfBounds;
135 case 3: return LDKCreationError_ExpiryTimeOutOfBounds;
136 case 4: return LDKCreationError_InvalidAmount;
140 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
142 case LDKCreationError_DescriptionTooLong: return 0;
143 case LDKCreationError_RouteTooLong: return 1;
144 case LDKCreationError_TimestampOutOfBounds: return 2;
145 case LDKCreationError_ExpiryTimeOutOfBounds: return 3;
146 case LDKCreationError_InvalidAmount: return 4;
150 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
152 case 0: return LDKCurrency_Bitcoin;
153 case 1: return LDKCurrency_BitcoinTestnet;
154 case 2: return LDKCurrency_Regtest;
155 case 3: return LDKCurrency_Simnet;
156 case 4: return LDKCurrency_Signet;
160 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
162 case LDKCurrency_Bitcoin: return 0;
163 case LDKCurrency_BitcoinTestnet: return 1;
164 case LDKCurrency_Regtest: return 2;
165 case LDKCurrency_Simnet: return 3;
166 case LDKCurrency_Signet: return 4;
170 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
172 case 0: return LDKIOError_NotFound;
173 case 1: return LDKIOError_PermissionDenied;
174 case 2: return LDKIOError_ConnectionRefused;
175 case 3: return LDKIOError_ConnectionReset;
176 case 4: return LDKIOError_ConnectionAborted;
177 case 5: return LDKIOError_NotConnected;
178 case 6: return LDKIOError_AddrInUse;
179 case 7: return LDKIOError_AddrNotAvailable;
180 case 8: return LDKIOError_BrokenPipe;
181 case 9: return LDKIOError_AlreadyExists;
182 case 10: return LDKIOError_WouldBlock;
183 case 11: return LDKIOError_InvalidInput;
184 case 12: return LDKIOError_InvalidData;
185 case 13: return LDKIOError_TimedOut;
186 case 14: return LDKIOError_WriteZero;
187 case 15: return LDKIOError_Interrupted;
188 case 16: return LDKIOError_Other;
189 case 17: return LDKIOError_UnexpectedEof;
193 static inline int32_t LDKIOError_to_js(LDKIOError val) {
195 case LDKIOError_NotFound: return 0;
196 case LDKIOError_PermissionDenied: return 1;
197 case LDKIOError_ConnectionRefused: return 2;
198 case LDKIOError_ConnectionReset: return 3;
199 case LDKIOError_ConnectionAborted: return 4;
200 case LDKIOError_NotConnected: return 5;
201 case LDKIOError_AddrInUse: return 6;
202 case LDKIOError_AddrNotAvailable: return 7;
203 case LDKIOError_BrokenPipe: return 8;
204 case LDKIOError_AlreadyExists: return 9;
205 case LDKIOError_WouldBlock: return 10;
206 case LDKIOError_InvalidInput: return 11;
207 case LDKIOError_InvalidData: return 12;
208 case LDKIOError_TimedOut: return 13;
209 case LDKIOError_WriteZero: return 14;
210 case LDKIOError_Interrupted: return 15;
211 case LDKIOError_Other: return 16;
212 case LDKIOError_UnexpectedEof: return 17;
216 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
218 case 0: return LDKLevel_Gossip;
219 case 1: return LDKLevel_Trace;
220 case 2: return LDKLevel_Debug;
221 case 3: return LDKLevel_Info;
222 case 4: return LDKLevel_Warn;
223 case 5: return LDKLevel_Error;
227 static inline int32_t LDKLevel_to_js(LDKLevel val) {
229 case LDKLevel_Gossip: return 0;
230 case LDKLevel_Trace: return 1;
231 case LDKLevel_Debug: return 2;
232 case LDKLevel_Info: return 3;
233 case LDKLevel_Warn: return 4;
234 case LDKLevel_Error: return 5;
238 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
240 case 0: return LDKNetwork_Bitcoin;
241 case 1: return LDKNetwork_Testnet;
242 case 2: return LDKNetwork_Regtest;
243 case 3: return LDKNetwork_Signet;
247 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
249 case LDKNetwork_Bitcoin: return 0;
250 case LDKNetwork_Testnet: return 1;
251 case LDKNetwork_Regtest: return 2;
252 case LDKNetwork_Signet: return 3;
256 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
258 case 0: return LDKSecp256k1Error_IncorrectSignature;
259 case 1: return LDKSecp256k1Error_InvalidMessage;
260 case 2: return LDKSecp256k1Error_InvalidPublicKey;
261 case 3: return LDKSecp256k1Error_InvalidSignature;
262 case 4: return LDKSecp256k1Error_InvalidSecretKey;
263 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
264 case 6: return LDKSecp256k1Error_InvalidTweak;
265 case 7: return LDKSecp256k1Error_TweakCheckFailed;
266 case 8: return LDKSecp256k1Error_NotEnoughMemory;
270 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
272 case LDKSecp256k1Error_IncorrectSignature: return 0;
273 case LDKSecp256k1Error_InvalidMessage: return 1;
274 case LDKSecp256k1Error_InvalidPublicKey: return 2;
275 case LDKSecp256k1Error_InvalidSignature: return 3;
276 case LDKSecp256k1Error_InvalidSecretKey: return 4;
277 case LDKSecp256k1Error_InvalidRecoveryId: return 5;
278 case LDKSecp256k1Error_InvalidTweak: return 6;
279 case LDKSecp256k1Error_TweakCheckFailed: return 7;
280 case LDKSecp256k1Error_NotEnoughMemory: return 8;
284 static inline LDKSemanticError LDKSemanticError_from_js(int32_t ord) {
286 case 0: return LDKSemanticError_NoPaymentHash;
287 case 1: return LDKSemanticError_MultiplePaymentHashes;
288 case 2: return LDKSemanticError_NoDescription;
289 case 3: return LDKSemanticError_MultipleDescriptions;
290 case 4: return LDKSemanticError_NoPaymentSecret;
291 case 5: return LDKSemanticError_MultiplePaymentSecrets;
292 case 6: return LDKSemanticError_InvalidFeatures;
293 case 7: return LDKSemanticError_InvalidRecoveryId;
294 case 8: return LDKSemanticError_InvalidSignature;
295 case 9: return LDKSemanticError_ImpreciseAmount;
299 static inline int32_t LDKSemanticError_to_js(LDKSemanticError val) {
301 case LDKSemanticError_NoPaymentHash: return 0;
302 case LDKSemanticError_MultiplePaymentHashes: return 1;
303 case LDKSemanticError_NoDescription: return 2;
304 case LDKSemanticError_MultipleDescriptions: return 3;
305 case LDKSemanticError_NoPaymentSecret: return 4;
306 case LDKSemanticError_MultiplePaymentSecrets: return 5;
307 case LDKSemanticError_InvalidFeatures: return 6;
308 case LDKSemanticError_InvalidRecoveryId: return 7;
309 case LDKSemanticError_InvalidSignature: return 8;
310 case LDKSemanticError_ImpreciseAmount: return 9;
314 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
316 case 0: return LDKSiPrefix_Milli;
317 case 1: return LDKSiPrefix_Micro;
318 case 2: return LDKSiPrefix_Nano;
319 case 3: return LDKSiPrefix_Pico;
323 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
325 case LDKSiPrefix_Milli: return 0;
326 case LDKSiPrefix_Micro: return 1;
327 case LDKSiPrefix_Nano: return 2;
328 case LDKSiPrefix_Pico: return 3;
332 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
333 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
334 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
337 struct LDKCVec_u8Z TxOut_get_script_pubkey (struct LDKTxOut* thing) { return CVec_u8Z_clone(&thing->script_pubkey);}int8_tArray __attribute__((visibility("default"))) TS_TxOut_get_script_pubkey(uint32_t thing) {
338 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
339 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
340 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
341 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
342 CVec_u8Z_free(ret_var);
346 uint64_t TxOut_get_value (struct LDKTxOut* thing) { return thing->value;}int64_t __attribute__((visibility("default"))) TS_TxOut_get_value(uint32_t thing) {
347 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
348 int64_t ret_val = TxOut_get_value(thing_conv);
352 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_ok(uint32_t arg) {
353 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
354 CHECK(val->result_ok);
355 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
356 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).bytes, 32);
359 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_err(uint32_t arg) {
360 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
361 CHECK(!val->result_ok);
362 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
365 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_ok(uint32_t arg) {
366 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
367 CHECK(val->result_ok);
368 int8_tArray res_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
369 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compressed_form, 33);
372 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_err(uint32_t arg) {
373 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
374 CHECK(!val->result_ok);
375 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
378 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_ok(uint32_t arg) {
379 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
380 CHECK(val->result_ok);
381 LDKTxCreationKeys res_var = (*val->contents.result);
382 uint64_t res_ref = 0;
383 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
384 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
385 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
386 res_ref = (uint64_t)res_var.inner & ~1;
389 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_err(uint32_t arg) {
390 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
391 CHECK(!val->result_ok);
392 LDKDecodeError err_var = (*val->contents.err);
393 uint64_t err_ref = 0;
394 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
395 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
396 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
397 err_ref = (uint64_t)err_var.inner & ~1;
400 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint32_t arg) {
401 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
402 CHECK(val->result_ok);
403 LDKChannelPublicKeys res_var = (*val->contents.result);
404 uint64_t res_ref = 0;
405 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
406 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
407 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
408 res_ref = (uint64_t)res_var.inner & ~1;
411 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_err(uint32_t arg) {
412 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
413 CHECK(!val->result_ok);
414 LDKDecodeError err_var = (*val->contents.err);
415 uint64_t err_ref = 0;
416 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
417 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
418 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
419 err_ref = (uint64_t)err_var.inner & ~1;
422 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_ok(uint32_t arg) {
423 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
424 CHECK(val->result_ok);
425 LDKTxCreationKeys res_var = (*val->contents.result);
426 uint64_t res_ref = 0;
427 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
428 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
429 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
430 res_ref = (uint64_t)res_var.inner & ~1;
433 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_err(uint32_t arg) {
434 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
435 CHECK(!val->result_ok);
436 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
439 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u32Z_ref_from_ptr(uint32_t ptr) {
440 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
442 case LDKCOption_u32Z_Some: {
443 return 0 /* LDKCOption_u32Z - Some */; (void) obj->some;
445 case LDKCOption_u32Z_None: {
446 return 0 /* LDKCOption_u32Z - None */;
451 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint32_t arg) {
452 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
453 CHECK(val->result_ok);
454 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
455 uint64_t res_ref = 0;
456 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
457 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
458 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
459 res_ref = (uint64_t)res_var.inner & ~1;
462 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint32_t arg) {
463 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
464 CHECK(!val->result_ok);
465 LDKDecodeError err_var = (*val->contents.err);
466 uint64_t err_ref = 0;
467 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
468 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
469 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
470 err_ref = (uint64_t)err_var.inner & ~1;
473 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
474 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
475 CHECK(val->result_ok);
476 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
477 uint64_t res_ref = 0;
478 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
479 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
480 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
481 res_ref = (uint64_t)res_var.inner & ~1;
484 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
485 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
486 CHECK(!val->result_ok);
487 LDKDecodeError err_var = (*val->contents.err);
488 uint64_t err_ref = 0;
489 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
490 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
491 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
492 err_ref = (uint64_t)err_var.inner & ~1;
495 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
496 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
497 CHECK(val->result_ok);
498 LDKChannelTransactionParameters res_var = (*val->contents.result);
499 uint64_t res_ref = 0;
500 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
501 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
502 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
503 res_ref = (uint64_t)res_var.inner & ~1;
506 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
507 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
508 CHECK(!val->result_ok);
509 LDKDecodeError err_var = (*val->contents.err);
510 uint64_t err_ref = 0;
511 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
512 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
513 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
514 err_ref = (uint64_t)err_var.inner & ~1;
517 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
518 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
519 CHECK(val->result_ok);
520 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
521 uint64_t res_ref = 0;
522 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
523 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
524 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
525 res_ref = (uint64_t)res_var.inner & ~1;
528 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
529 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
530 CHECK(!val->result_ok);
531 LDKDecodeError err_var = (*val->contents.err);
532 uint64_t err_ref = 0;
533 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
534 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
535 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
536 err_ref = (uint64_t)err_var.inner & ~1;
539 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
540 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
541 CHECK(val->result_ok);
542 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
543 uint64_t res_ref = 0;
544 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
545 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
546 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
547 res_ref = (uint64_t)res_var.inner & ~1;
550 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
551 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
552 CHECK(!val->result_ok);
553 LDKDecodeError err_var = (*val->contents.err);
554 uint64_t err_ref = 0;
555 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
556 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
557 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
558 err_ref = (uint64_t)err_var.inner & ~1;
561 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_get_ok(uint32_t arg) {
562 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
563 CHECK(val->result_ok);
564 LDKTrustedClosingTransaction res_var = (*val->contents.result);
565 uint64_t res_ref = 0;
566 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
567 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
568 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
569 res_ref = (uint64_t)res_var.inner & ~1;
572 void __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_get_err(uint32_t arg) {
573 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
574 CHECK(!val->result_ok);
575 return *val->contents.err;
577 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
578 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
579 CHECK(val->result_ok);
580 LDKCommitmentTransaction res_var = (*val->contents.result);
581 uint64_t res_ref = 0;
582 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
583 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
584 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
585 res_ref = (uint64_t)res_var.inner & ~1;
588 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
589 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
590 CHECK(!val->result_ok);
591 LDKDecodeError err_var = (*val->contents.err);
592 uint64_t err_ref = 0;
593 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
594 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
595 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
596 err_ref = (uint64_t)err_var.inner & ~1;
599 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_ok(uint32_t arg) {
600 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
601 CHECK(val->result_ok);
602 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
603 uint64_t res_ref = 0;
604 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
605 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
606 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
607 res_ref = (uint64_t)res_var.inner & ~1;
610 void __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_err(uint32_t arg) {
611 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
612 CHECK(!val->result_ok);
613 return *val->contents.err;
615 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_ok(uint32_t arg) {
616 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
617 CHECK(val->result_ok);
618 LDKCVec_SignatureZ res_var = (*val->contents.result);
619 ptrArray res_arr = NULL;
620 res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
621 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
622 for (size_t m = 0; m < res_var.datalen; m++) {
623 int8_tArray res_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
624 memcpy((uint8_t*)(res_conv_12_arr + 4), res_var.data[m].compact_form, 64);
625 res_arr_ptr[m] = res_conv_12_arr;
630 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_err(uint32_t arg) {
631 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
632 CHECK(!val->result_ok);
633 return *val->contents.err;
635 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_get_ok(uint32_t arg) {
636 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
637 CHECK(val->result_ok);
638 LDKShutdownScript res_var = (*val->contents.result);
639 uint64_t res_ref = 0;
640 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
641 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
642 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
643 res_ref = (uint64_t)res_var.inner & ~1;
646 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_get_err(uint32_t arg) {
647 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
648 CHECK(!val->result_ok);
649 LDKDecodeError err_var = (*val->contents.err);
650 uint64_t err_ref = 0;
651 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
652 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
653 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
654 err_ref = (uint64_t)err_var.inner & ~1;
657 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint32_t arg) {
658 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
659 CHECK(val->result_ok);
660 LDKShutdownScript res_var = (*val->contents.result);
661 uint64_t res_ref = 0;
662 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
663 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
664 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
665 res_ref = (uint64_t)res_var.inner & ~1;
668 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint32_t arg) {
669 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
670 CHECK(!val->result_ok);
671 LDKInvalidShutdownScript err_var = (*val->contents.err);
672 uint64_t err_ref = 0;
673 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
674 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
675 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
676 err_ref = (uint64_t)err_var.inner & ~1;
679 void __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_ok(uint32_t arg) {
680 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
681 CHECK(val->result_ok);
682 return *val->contents.result;
684 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_err(uint32_t arg) {
685 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
686 CHECK(!val->result_ok);
687 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
690 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_get_ok(uint32_t arg) {
691 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
692 CHECK(val->result_ok);
693 LDKRouteHop res_var = (*val->contents.result);
694 uint64_t res_ref = 0;
695 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
696 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
697 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
698 res_ref = (uint64_t)res_var.inner & ~1;
701 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_get_err(uint32_t arg) {
702 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
703 CHECK(!val->result_ok);
704 LDKDecodeError err_var = (*val->contents.err);
705 uint64_t err_ref = 0;
706 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
707 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
708 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
709 err_ref = (uint64_t)err_var.inner & ~1;
712 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
713 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
714 for (size_t i = 0; i < ret.datalen; i++) {
715 ret.data[i] = RouteHop_clone(&orig->data[i]);
719 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
720 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
721 for (size_t i = 0; i < ret.datalen; i++) {
722 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
726 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_ok(uint32_t arg) {
727 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
728 CHECK(val->result_ok);
729 LDKRoute res_var = (*val->contents.result);
730 uint64_t res_ref = 0;
731 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
732 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
733 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
734 res_ref = (uint64_t)res_var.inner & ~1;
737 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_err(uint32_t arg) {
738 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
739 CHECK(!val->result_ok);
740 LDKDecodeError err_var = (*val->contents.err);
741 uint64_t err_ref = 0;
742 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
743 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
744 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
745 err_ref = (uint64_t)err_var.inner & ~1;
748 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteParametersDecodeErrorZ_get_ok(uint32_t arg) {
749 LDKCResult_RouteParametersDecodeErrorZ *val = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
750 CHECK(val->result_ok);
751 LDKRouteParameters res_var = (*val->contents.result);
752 uint64_t res_ref = 0;
753 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
754 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
755 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
756 res_ref = (uint64_t)res_var.inner & ~1;
759 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteParametersDecodeErrorZ_get_err(uint32_t arg) {
760 LDKCResult_RouteParametersDecodeErrorZ *val = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
761 CHECK(!val->result_ok);
762 LDKDecodeError err_var = (*val->contents.err);
763 uint64_t err_ref = 0;
764 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
765 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
766 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
767 err_ref = (uint64_t)err_var.inner & ~1;
770 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
771 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
772 for (size_t i = 0; i < ret.datalen; i++) {
773 ret.data[i] = RouteHint_clone(&orig->data[i]);
777 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u64Z_ref_from_ptr(uint32_t ptr) {
778 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
780 case LDKCOption_u64Z_Some: {
781 return 0 /* LDKCOption_u64Z - Some */; (void) obj->some;
783 case LDKCOption_u64Z_None: {
784 return 0 /* LDKCOption_u64Z - None */;
789 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeeDecodeErrorZ_get_ok(uint32_t arg) {
790 LDKCResult_PayeeDecodeErrorZ *val = (LDKCResult_PayeeDecodeErrorZ*)(arg & ~1);
791 CHECK(val->result_ok);
792 LDKPayee res_var = (*val->contents.result);
793 uint64_t res_ref = 0;
794 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
795 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
796 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
797 res_ref = (uint64_t)res_var.inner & ~1;
800 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeeDecodeErrorZ_get_err(uint32_t arg) {
801 LDKCResult_PayeeDecodeErrorZ *val = (LDKCResult_PayeeDecodeErrorZ*)(arg & ~1);
802 CHECK(!val->result_ok);
803 LDKDecodeError err_var = (*val->contents.err);
804 uint64_t err_ref = 0;
805 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
806 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
807 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
808 err_ref = (uint64_t)err_var.inner & ~1;
811 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
812 LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
813 for (size_t i = 0; i < ret.datalen; i++) {
814 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
818 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHintDecodeErrorZ_get_ok(uint32_t arg) {
819 LDKCResult_RouteHintDecodeErrorZ *val = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
820 CHECK(val->result_ok);
821 LDKRouteHint res_var = (*val->contents.result);
822 uint64_t res_ref = 0;
823 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
824 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
825 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
826 res_ref = (uint64_t)res_var.inner & ~1;
829 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHintDecodeErrorZ_get_err(uint32_t arg) {
830 LDKCResult_RouteHintDecodeErrorZ *val = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
831 CHECK(!val->result_ok);
832 LDKDecodeError err_var = (*val->contents.err);
833 uint64_t err_ref = 0;
834 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
835 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
836 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
837 err_ref = (uint64_t)err_var.inner & ~1;
840 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHintHopDecodeErrorZ_get_ok(uint32_t arg) {
841 LDKCResult_RouteHintHopDecodeErrorZ *val = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
842 CHECK(val->result_ok);
843 LDKRouteHintHop res_var = (*val->contents.result);
844 uint64_t res_ref = 0;
845 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
846 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
847 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
848 res_ref = (uint64_t)res_var.inner & ~1;
851 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHintHopDecodeErrorZ_get_err(uint32_t arg) {
852 LDKCResult_RouteHintHopDecodeErrorZ *val = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
853 CHECK(!val->result_ok);
854 LDKDecodeError err_var = (*val->contents.err);
855 uint64_t err_ref = 0;
856 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
857 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
858 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
859 err_ref = (uint64_t)err_var.inner & ~1;
862 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
863 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
864 for (size_t i = 0; i < ret.datalen; i++) {
865 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
869 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_ok(uint32_t arg) {
870 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
871 CHECK(val->result_ok);
872 LDKRoute res_var = (*val->contents.result);
873 uint64_t res_ref = 0;
874 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
875 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
876 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
877 res_ref = (uint64_t)res_var.inner & ~1;
880 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_err(uint32_t arg) {
881 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
882 CHECK(!val->result_ok);
883 LDKLightningError err_var = (*val->contents.err);
884 uint64_t err_ref = 0;
885 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
886 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
887 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
888 err_ref = (uint64_t)err_var.inner & ~1;
891 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_ok(uint32_t arg) {
892 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
893 CHECK(val->result_ok);
894 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
895 return (uint64_t)res_ref;
897 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_err(uint32_t arg) {
898 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
899 CHECK(!val->result_ok);
900 uint32_t err_conv = LDKAccessError_to_js((*val->contents.err));
903 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR tuple){
906 int64_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_get_a(uint32_t tuple) {
907 LDKC2Tuple_usizeTransactionZ* tuple_conv = (LDKC2Tuple_usizeTransactionZ*)(tuple & ~1);
908 int64_t ret_val = C2Tuple_usizeTransactionZ_get_a(tuple_conv);
912 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR tuple){
915 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_get_b(uint32_t tuple) {
916 LDKC2Tuple_usizeTransactionZ* tuple_conv = (LDKC2Tuple_usizeTransactionZ*)(tuple & ~1);
917 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(tuple_conv);
918 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
919 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
920 Transaction_free(ret_var);
924 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
925 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
926 for (size_t i = 0; i < ret.datalen; i++) {
927 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
931 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
932 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
933 for (size_t i = 0; i < ret.datalen; i++) {
934 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
938 void __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t arg) {
939 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
940 CHECK(val->result_ok);
941 return *val->contents.result;
943 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t arg) {
944 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
945 CHECK(!val->result_ok);
946 uint32_t err_conv = LDKChannelMonitorUpdateErr_to_js((*val->contents.err));
949 uint32_t __attribute__((visibility("default"))) TS_LDKMonitorEvent_ref_from_ptr(uint32_t ptr) {
950 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
952 case LDKMonitorEvent_HTLCEvent: {
953 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
954 uint64_t htlc_event_ref = 0;
955 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
956 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
957 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
958 htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
959 return 0 /* LDKMonitorEvent - HTLCEvent */; (void) htlc_event_ref;
961 case LDKMonitorEvent_CommitmentTxConfirmed: {
962 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
963 uint64_t commitment_tx_confirmed_ref = 0;
964 CHECK((((uint64_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
965 CHECK((((uint64_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
966 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
967 commitment_tx_confirmed_ref = (uint64_t)commitment_tx_confirmed_var.inner & ~1;
968 return 0 /* LDKMonitorEvent - CommitmentTxConfirmed */; (void) commitment_tx_confirmed_ref;
970 case LDKMonitorEvent_UpdateCompleted: {
971 LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
972 uint64_t funding_txo_ref = 0;
973 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
974 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
975 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
976 funding_txo_ref = (uint64_t)funding_txo_var.inner & ~1;
977 return 0 /* LDKMonitorEvent - UpdateCompleted */; (void) funding_txo_ref; (void) obj->update_completed.monitor_update_id;
979 case LDKMonitorEvent_UpdateFailed: {
980 LDKOutPoint update_failed_var = obj->update_failed;
981 uint64_t update_failed_ref = 0;
982 CHECK((((uint64_t)update_failed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
983 CHECK((((uint64_t)&update_failed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
984 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
985 update_failed_ref = (uint64_t)update_failed_var.inner & ~1;
986 return 0 /* LDKMonitorEvent - UpdateFailed */; (void) update_failed_ref;
991 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
992 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
993 for (size_t i = 0; i < ret.datalen; i++) {
994 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
998 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_ref_from_ptr(uint32_t ptr) {
999 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
1001 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
1002 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1003 *some_conv = obj->some;
1004 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
1005 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - Some */; (void) ((uint64_t)some_conv);
1007 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
1008 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - None */;
1013 uint32_t __attribute__((visibility("default"))) TS_LDKClosureReason_ref_from_ptr(uint32_t ptr) {
1014 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
1016 case LDKClosureReason_CounterpartyForceClosed: {
1017 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
1018 jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
1019 return 0 /* LDKClosureReason - CounterpartyForceClosed */; (void) peer_msg_conv;
1021 case LDKClosureReason_HolderForceClosed: {
1022 return 0 /* LDKClosureReason - HolderForceClosed */;
1024 case LDKClosureReason_CooperativeClosure: {
1025 return 0 /* LDKClosureReason - CooperativeClosure */;
1027 case LDKClosureReason_CommitmentTxConfirmed: {
1028 return 0 /* LDKClosureReason - CommitmentTxConfirmed */;
1030 case LDKClosureReason_FundingTimedOut: {
1031 return 0 /* LDKClosureReason - FundingTimedOut */;
1033 case LDKClosureReason_ProcessingError: {
1034 LDKStr err_str = obj->processing_error.err;
1035 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
1036 return 0 /* LDKClosureReason - ProcessingError */; (void) err_conv;
1038 case LDKClosureReason_DisconnectedPeer: {
1039 return 0 /* LDKClosureReason - DisconnectedPeer */;
1041 case LDKClosureReason_OutdatedChannelManager: {
1042 return 0 /* LDKClosureReason - OutdatedChannelManager */;
1047 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_ClosureReasonZ_ref_from_ptr(uint32_t ptr) {
1048 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
1050 case LDKCOption_ClosureReasonZ_Some: {
1051 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1052 return 0 /* LDKCOption_ClosureReasonZ - Some */; (void) some_ref;
1054 case LDKCOption_ClosureReasonZ_None: {
1055 return 0 /* LDKCOption_ClosureReasonZ - None */;
1060 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint32_t arg) {
1061 LDKCResult_COption_ClosureReasonZDecodeErrorZ *val = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
1062 CHECK(val->result_ok);
1063 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1066 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint32_t arg) {
1067 LDKCResult_COption_ClosureReasonZDecodeErrorZ *val = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
1068 CHECK(!val->result_ok);
1069 LDKDecodeError err_var = (*val->contents.err);
1070 uint64_t err_ref = 0;
1071 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1072 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1073 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1074 err_ref = (uint64_t)err_var.inner & ~1;
1077 uint32_t __attribute__((visibility("default"))) TS_LDKNetworkUpdate_ref_from_ptr(uint32_t ptr) {
1078 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1080 case LDKNetworkUpdate_ChannelUpdateMessage: {
1081 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1082 uint64_t msg_ref = 0;
1083 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1084 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1085 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1086 msg_ref = (uint64_t)msg_var.inner & ~1;
1087 return 0 /* LDKNetworkUpdate - ChannelUpdateMessage */; (void) msg_ref;
1089 case LDKNetworkUpdate_ChannelClosed: {
1090 return 0 /* LDKNetworkUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
1092 case LDKNetworkUpdate_NodeFailure: {
1093 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1094 memcpy((uint8_t*)(node_id_arr + 4), obj->node_failure.node_id.compressed_form, 33);
1095 return 0 /* LDKNetworkUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
1100 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_NetworkUpdateZ_ref_from_ptr(uint32_t ptr) {
1101 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1103 case LDKCOption_NetworkUpdateZ_Some: {
1104 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1105 return 0 /* LDKCOption_NetworkUpdateZ - Some */; (void) some_ref;
1107 case LDKCOption_NetworkUpdateZ_None: {
1108 return 0 /* LDKCOption_NetworkUpdateZ - None */;
1113 uint32_t __attribute__((visibility("default"))) TS_LDKSpendableOutputDescriptor_ref_from_ptr(uint32_t ptr) {
1114 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1116 case LDKSpendableOutputDescriptor_StaticOutput: {
1117 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1118 uint64_t outpoint_ref = 0;
1119 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1120 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1121 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1122 outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1123 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1124 return 0 /* LDKSpendableOutputDescriptor - StaticOutput */; (void) outpoint_ref; (void) (uint64_t)output_ref;
1126 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1127 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1128 uint64_t delayed_payment_output_ref = 0;
1129 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1130 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1131 CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1132 delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1133 return 0 /* LDKSpendableOutputDescriptor - DelayedPaymentOutput */; (void) delayed_payment_output_ref;
1135 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1136 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1137 uint64_t static_payment_output_ref = 0;
1138 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1139 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1140 CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1141 static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1142 return 0 /* LDKSpendableOutputDescriptor - StaticPaymentOutput */; (void) static_payment_output_ref;
1147 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1148 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1149 for (size_t i = 0; i < ret.datalen; i++) {
1150 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1154 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentPurpose_ref_from_ptr(uint32_t ptr) {
1155 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1157 case LDKPaymentPurpose_InvoicePayment: {
1158 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1159 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->invoice_payment.payment_preimage.data, 32);
1160 int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1161 memcpy((uint8_t*)(payment_secret_arr + 4), obj->invoice_payment.payment_secret.data, 32);
1162 return 0 /* LDKPaymentPurpose - InvoicePayment */; (void) payment_preimage_arr; (void) payment_secret_arr;
1164 case LDKPaymentPurpose_SpontaneousPayment: {
1165 int8_tArray spontaneous_payment_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1166 memcpy((uint8_t*)(spontaneous_payment_arr + 4), obj->spontaneous_payment.data, 32);
1167 return 0 /* LDKPaymentPurpose - SpontaneousPayment */; (void) spontaneous_payment_arr;
1172 uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_t ptr) {
1173 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1175 case LDKEvent_FundingGenerationReady: {
1176 int8_tArray temporary_channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1177 memcpy((uint8_t*)(temporary_channel_id_arr + 4), obj->funding_generation_ready.temporary_channel_id.data, 32);
1178 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1179 int8_tArray output_script_arr = init_arr(output_script_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1180 memcpy((uint8_t*)(output_script_arr + 4), output_script_var.data, output_script_var.datalen);
1181 return 0 /* LDKEvent - FundingGenerationReady */; (void) temporary_channel_id_arr; (void) obj->funding_generation_ready.channel_value_satoshis; (void) output_script_arr; (void) obj->funding_generation_ready.user_channel_id;
1183 case LDKEvent_PaymentReceived: {
1184 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1185 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_received.payment_hash.data, 32);
1186 uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
1187 return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) obj->payment_received.amt; (void) purpose_ref;
1189 case LDKEvent_PaymentSent: {
1190 int8_tArray payment_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1191 memcpy((uint8_t*)(payment_id_arr + 4), obj->payment_sent.payment_id.data, 32);
1192 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1193 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_sent.payment_preimage.data, 32);
1194 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1195 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_sent.payment_hash.data, 32);
1196 uint64_t fee_paid_msat_ref = ((uint64_t)&obj->payment_sent.fee_paid_msat) | 1;
1197 return 0 /* LDKEvent - PaymentSent */; (void) payment_id_arr; (void) payment_preimage_arr; (void) payment_hash_arr; (void) fee_paid_msat_ref;
1199 case LDKEvent_PaymentPathFailed: {
1200 int8_tArray payment_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1201 memcpy((uint8_t*)(payment_id_arr + 4), obj->payment_path_failed.payment_id.data, 32);
1202 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1203 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_path_failed.payment_hash.data, 32);
1204 uint64_t network_update_ref = ((uint64_t)&obj->payment_path_failed.network_update) | 1;
1205 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
1206 uint32_tArray path_arr = NULL;
1207 path_arr = init_arr(path_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
1208 uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4);
1209 for (size_t k = 0; k < path_var.datalen; k++) {
1210 LDKRouteHop path_conv_10_var = path_var.data[k];
1211 uint64_t path_conv_10_ref = 0;
1212 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1213 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1214 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1215 path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
1216 path_arr_ptr[k] = path_conv_10_ref;
1219 uint64_t short_channel_id_ref = ((uint64_t)&obj->payment_path_failed.short_channel_id) | 1;
1220 LDKRouteParameters retry_var = obj->payment_path_failed.retry;
1221 uint64_t retry_ref = 0;
1222 if ((uint64_t)retry_var.inner > 4096) {
1223 CHECK((((uint64_t)retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1224 CHECK((((uint64_t)&retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1225 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
1226 retry_ref = (uint64_t)retry_var.inner & ~1;
1228 return 0 /* LDKEvent - PaymentPathFailed */; (void) payment_id_arr; (void) payment_hash_arr; (void) obj->payment_path_failed.rejected_by_dest; (void) network_update_ref; (void) obj->payment_path_failed.all_paths_failed; (void) path_arr; (void) short_channel_id_ref; (void) retry_ref;
1230 case LDKEvent_PaymentFailed: {
1231 int8_tArray payment_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1232 memcpy((uint8_t*)(payment_id_arr + 4), obj->payment_failed.payment_id.data, 32);
1233 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1234 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_failed.payment_hash.data, 32);
1235 return 0 /* LDKEvent - PaymentFailed */; (void) payment_id_arr; (void) payment_hash_arr;
1237 case LDKEvent_PendingHTLCsForwardable: {
1238 return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable;
1240 case LDKEvent_SpendableOutputs: {
1241 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1242 uint32_tArray outputs_arr = NULL;
1243 outputs_arr = init_arr(outputs_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
1244 uint32_t *outputs_arr_ptr = (uint32_t*)(outputs_arr + 4);
1245 for (size_t b = 0; b < outputs_var.datalen; b++) {
1246 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
1247 outputs_arr_ptr[b] = outputs_conv_27_ref;
1250 return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr;
1252 case LDKEvent_PaymentForwarded: {
1253 uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
1254 return 0 /* LDKEvent - PaymentForwarded */; (void) fee_earned_msat_ref; (void) obj->payment_forwarded.claim_from_onchain_tx;
1256 case LDKEvent_ChannelClosed: {
1257 int8_tArray channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1258 memcpy((uint8_t*)(channel_id_arr + 4), obj->channel_closed.channel_id.data, 32);
1259 uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1;
1260 return 0 /* LDKEvent - ChannelClosed */; (void) channel_id_arr; (void) obj->channel_closed.user_channel_id; (void) reason_ref;
1262 case LDKEvent_DiscardFunding: {
1263 int8_tArray channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1264 memcpy((uint8_t*)(channel_id_arr + 4), obj->discard_funding.channel_id.data, 32);
1265 LDKTransaction transaction_var = obj->discard_funding.transaction;
1266 int8_tArray transaction_arr = init_arr(transaction_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1267 memcpy((uint8_t*)(transaction_arr + 4), transaction_var.data, transaction_var.datalen);
1268 return 0 /* LDKEvent - DiscardFunding */; (void) channel_id_arr; (void) transaction_arr;
1270 case LDKEvent_PaymentPathSuccessful: {
1271 int8_tArray payment_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1272 memcpy((uint8_t*)(payment_id_arr + 4), obj->payment_path_successful.payment_id.data, 32);
1273 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1274 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_path_successful.payment_hash.data, 32);
1275 LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
1276 uint32_tArray path_arr = NULL;
1277 path_arr = init_arr(path_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
1278 uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4);
1279 for (size_t k = 0; k < path_var.datalen; k++) {
1280 LDKRouteHop path_conv_10_var = path_var.data[k];
1281 uint64_t path_conv_10_ref = 0;
1282 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1283 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1284 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1285 path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
1286 path_arr_ptr[k] = path_conv_10_ref;
1289 return 0 /* LDKEvent - PaymentPathSuccessful */; (void) payment_id_arr; (void) payment_hash_arr; (void) path_arr;
1294 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_EventZ_ref_from_ptr(uint32_t ptr) {
1295 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
1297 case LDKCOption_EventZ_Some: {
1298 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1299 return 0 /* LDKCOption_EventZ - Some */; (void) some_ref;
1301 case LDKCOption_EventZ_None: {
1302 return 0 /* LDKCOption_EventZ - None */;
1307 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_EventZDecodeErrorZ_get_ok(uint32_t arg) {
1308 LDKCResult_COption_EventZDecodeErrorZ *val = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
1309 CHECK(val->result_ok);
1310 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1313 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_EventZDecodeErrorZ_get_err(uint32_t arg) {
1314 LDKCResult_COption_EventZDecodeErrorZ *val = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
1315 CHECK(!val->result_ok);
1316 LDKDecodeError err_var = (*val->contents.err);
1317 uint64_t err_ref = 0;
1318 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1319 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1320 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1321 err_ref = (uint64_t)err_var.inner & ~1;
1324 uint32_t __attribute__((visibility("default"))) TS_LDKErrorAction_ref_from_ptr(uint32_t ptr) {
1325 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1327 case LDKErrorAction_DisconnectPeer: {
1328 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1329 uint64_t msg_ref = 0;
1330 if ((uint64_t)msg_var.inner > 4096) {
1331 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1332 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1333 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1334 msg_ref = (uint64_t)msg_var.inner & ~1;
1336 return 0 /* LDKErrorAction - DisconnectPeer */; (void) msg_ref;
1338 case LDKErrorAction_IgnoreError: {
1339 return 0 /* LDKErrorAction - IgnoreError */;
1341 case LDKErrorAction_IgnoreAndLog: {
1342 uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
1343 return 0 /* LDKErrorAction - IgnoreAndLog */; (void) ignore_and_log_conv;
1345 case LDKErrorAction_IgnoreDuplicateGossip: {
1346 return 0 /* LDKErrorAction - IgnoreDuplicateGossip */;
1348 case LDKErrorAction_SendErrorMessage: {
1349 LDKErrorMessage msg_var = obj->send_error_message.msg;
1350 uint64_t msg_ref = 0;
1351 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1352 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1353 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1354 msg_ref = (uint64_t)msg_var.inner & ~1;
1355 return 0 /* LDKErrorAction - SendErrorMessage */; (void) msg_ref;
1360 uint32_t __attribute__((visibility("default"))) TS_LDKMessageSendEvent_ref_from_ptr(uint32_t ptr) {
1361 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1363 case LDKMessageSendEvent_SendAcceptChannel: {
1364 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1365 memcpy((uint8_t*)(node_id_arr + 4), obj->send_accept_channel.node_id.compressed_form, 33);
1366 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1367 uint64_t msg_ref = 0;
1368 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1369 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1370 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1371 msg_ref = (uint64_t)msg_var.inner & ~1;
1372 return 0 /* LDKMessageSendEvent - SendAcceptChannel */; (void) node_id_arr; (void) msg_ref;
1374 case LDKMessageSendEvent_SendOpenChannel: {
1375 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1376 memcpy((uint8_t*)(node_id_arr + 4), obj->send_open_channel.node_id.compressed_form, 33);
1377 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1378 uint64_t msg_ref = 0;
1379 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1380 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1381 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1382 msg_ref = (uint64_t)msg_var.inner & ~1;
1383 return 0 /* LDKMessageSendEvent - SendOpenChannel */; (void) node_id_arr; (void) msg_ref;
1385 case LDKMessageSendEvent_SendFundingCreated: {
1386 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1387 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_created.node_id.compressed_form, 33);
1388 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1389 uint64_t msg_ref = 0;
1390 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1391 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1392 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1393 msg_ref = (uint64_t)msg_var.inner & ~1;
1394 return 0 /* LDKMessageSendEvent - SendFundingCreated */; (void) node_id_arr; (void) msg_ref;
1396 case LDKMessageSendEvent_SendFundingSigned: {
1397 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1398 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_signed.node_id.compressed_form, 33);
1399 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1400 uint64_t msg_ref = 0;
1401 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1402 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1403 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1404 msg_ref = (uint64_t)msg_var.inner & ~1;
1405 return 0 /* LDKMessageSendEvent - SendFundingSigned */; (void) node_id_arr; (void) msg_ref;
1407 case LDKMessageSendEvent_SendFundingLocked: {
1408 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1409 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_locked.node_id.compressed_form, 33);
1410 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1411 uint64_t msg_ref = 0;
1412 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1413 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1414 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1415 msg_ref = (uint64_t)msg_var.inner & ~1;
1416 return 0 /* LDKMessageSendEvent - SendFundingLocked */; (void) node_id_arr; (void) msg_ref;
1418 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1419 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1420 memcpy((uint8_t*)(node_id_arr + 4), obj->send_announcement_signatures.node_id.compressed_form, 33);
1421 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1422 uint64_t msg_ref = 0;
1423 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1424 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1425 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1426 msg_ref = (uint64_t)msg_var.inner & ~1;
1427 return 0 /* LDKMessageSendEvent - SendAnnouncementSignatures */; (void) node_id_arr; (void) msg_ref;
1429 case LDKMessageSendEvent_UpdateHTLCs: {
1430 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1431 memcpy((uint8_t*)(node_id_arr + 4), obj->update_htl_cs.node_id.compressed_form, 33);
1432 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1433 uint64_t updates_ref = 0;
1434 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1435 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1436 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
1437 updates_ref = (uint64_t)updates_var.inner & ~1;
1438 return 0 /* LDKMessageSendEvent - UpdateHTLCs */; (void) node_id_arr; (void) updates_ref;
1440 case LDKMessageSendEvent_SendRevokeAndACK: {
1441 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1442 memcpy((uint8_t*)(node_id_arr + 4), obj->send_revoke_and_ack.node_id.compressed_form, 33);
1443 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1444 uint64_t msg_ref = 0;
1445 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1446 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1447 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1448 msg_ref = (uint64_t)msg_var.inner & ~1;
1449 return 0 /* LDKMessageSendEvent - SendRevokeAndACK */; (void) node_id_arr; (void) msg_ref;
1451 case LDKMessageSendEvent_SendClosingSigned: {
1452 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1453 memcpy((uint8_t*)(node_id_arr + 4), obj->send_closing_signed.node_id.compressed_form, 33);
1454 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1455 uint64_t msg_ref = 0;
1456 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1457 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1458 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1459 msg_ref = (uint64_t)msg_var.inner & ~1;
1460 return 0 /* LDKMessageSendEvent - SendClosingSigned */; (void) node_id_arr; (void) msg_ref;
1462 case LDKMessageSendEvent_SendShutdown: {
1463 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1464 memcpy((uint8_t*)(node_id_arr + 4), obj->send_shutdown.node_id.compressed_form, 33);
1465 LDKShutdown msg_var = obj->send_shutdown.msg;
1466 uint64_t msg_ref = 0;
1467 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1468 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1469 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1470 msg_ref = (uint64_t)msg_var.inner & ~1;
1471 return 0 /* LDKMessageSendEvent - SendShutdown */; (void) node_id_arr; (void) msg_ref;
1473 case LDKMessageSendEvent_SendChannelReestablish: {
1474 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1475 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_reestablish.node_id.compressed_form, 33);
1476 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1477 uint64_t msg_ref = 0;
1478 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1479 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1480 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1481 msg_ref = (uint64_t)msg_var.inner & ~1;
1482 return 0 /* LDKMessageSendEvent - SendChannelReestablish */; (void) node_id_arr; (void) msg_ref;
1484 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1485 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1486 uint64_t msg_ref = 0;
1487 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1488 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1489 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1490 msg_ref = (uint64_t)msg_var.inner & ~1;
1491 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1492 uint64_t update_msg_ref = 0;
1493 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1494 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1495 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
1496 update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
1497 return 0 /* LDKMessageSendEvent - BroadcastChannelAnnouncement */; (void) msg_ref; (void) update_msg_ref;
1499 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1500 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1501 uint64_t msg_ref = 0;
1502 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1503 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1504 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1505 msg_ref = (uint64_t)msg_var.inner & ~1;
1506 return 0 /* LDKMessageSendEvent - BroadcastNodeAnnouncement */; (void) msg_ref;
1508 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1509 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1510 uint64_t msg_ref = 0;
1511 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1512 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1513 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1514 msg_ref = (uint64_t)msg_var.inner & ~1;
1515 return 0 /* LDKMessageSendEvent - BroadcastChannelUpdate */; (void) msg_ref;
1517 case LDKMessageSendEvent_SendChannelUpdate: {
1518 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1519 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_update.node_id.compressed_form, 33);
1520 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
1521 uint64_t msg_ref = 0;
1522 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1523 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1524 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1525 msg_ref = (uint64_t)msg_var.inner & ~1;
1526 return 0 /* LDKMessageSendEvent - SendChannelUpdate */; (void) node_id_arr; (void) msg_ref;
1528 case LDKMessageSendEvent_HandleError: {
1529 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1530 memcpy((uint8_t*)(node_id_arr + 4), obj->handle_error.node_id.compressed_form, 33);
1531 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
1532 return 0 /* LDKMessageSendEvent - HandleError */; (void) node_id_arr; (void) action_ref;
1534 case LDKMessageSendEvent_SendChannelRangeQuery: {
1535 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1536 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_range_query.node_id.compressed_form, 33);
1537 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1538 uint64_t msg_ref = 0;
1539 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1540 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1541 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1542 msg_ref = (uint64_t)msg_var.inner & ~1;
1543 return 0 /* LDKMessageSendEvent - SendChannelRangeQuery */; (void) node_id_arr; (void) msg_ref;
1545 case LDKMessageSendEvent_SendShortIdsQuery: {
1546 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1547 memcpy((uint8_t*)(node_id_arr + 4), obj->send_short_ids_query.node_id.compressed_form, 33);
1548 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1549 uint64_t msg_ref = 0;
1550 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1551 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1552 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1553 msg_ref = (uint64_t)msg_var.inner & ~1;
1554 return 0 /* LDKMessageSendEvent - SendShortIdsQuery */; (void) node_id_arr; (void) msg_ref;
1556 case LDKMessageSendEvent_SendReplyChannelRange: {
1557 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1558 memcpy((uint8_t*)(node_id_arr + 4), obj->send_reply_channel_range.node_id.compressed_form, 33);
1559 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1560 uint64_t msg_ref = 0;
1561 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1562 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1563 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1564 msg_ref = (uint64_t)msg_var.inner & ~1;
1565 return 0 /* LDKMessageSendEvent - SendReplyChannelRange */; (void) node_id_arr; (void) msg_ref;
1570 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1571 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1572 for (size_t i = 0; i < ret.datalen; i++) {
1573 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1577 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScoringParametersDecodeErrorZ_get_ok(uint32_t arg) {
1578 LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1);
1579 CHECK(val->result_ok);
1580 LDKScoringParameters res_var = (*val->contents.result);
1581 uint64_t res_ref = 0;
1582 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1583 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1584 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1585 res_ref = (uint64_t)res_var.inner & ~1;
1588 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScoringParametersDecodeErrorZ_get_err(uint32_t arg) {
1589 LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1);
1590 CHECK(!val->result_ok);
1591 LDKDecodeError err_var = (*val->contents.err);
1592 uint64_t err_ref = 0;
1593 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1594 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1595 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1596 err_ref = (uint64_t)err_var.inner & ~1;
1599 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScorerDecodeErrorZ_get_ok(uint32_t arg) {
1600 LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1);
1601 CHECK(val->result_ok);
1602 LDKScorer res_var = (*val->contents.result);
1603 uint64_t res_ref = 0;
1604 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1605 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1606 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1607 res_ref = (uint64_t)res_var.inner & ~1;
1610 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScorerDecodeErrorZ_get_err(uint32_t arg) {
1611 LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1);
1612 CHECK(!val->result_ok);
1613 LDKDecodeError err_var = (*val->contents.err);
1614 uint64_t err_ref = 0;
1615 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1616 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1617 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1618 err_ref = (uint64_t)err_var.inner & ~1;
1621 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1622 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1623 CHECK(val->result_ok);
1624 LDKInitFeatures res_var = (*val->contents.result);
1625 uint64_t res_ref = 0;
1626 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1627 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1628 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1629 res_ref = (uint64_t)res_var.inner & ~1;
1632 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1633 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1634 CHECK(!val->result_ok);
1635 LDKDecodeError err_var = (*val->contents.err);
1636 uint64_t err_ref = 0;
1637 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1638 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1639 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1640 err_ref = (uint64_t)err_var.inner & ~1;
1643 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1644 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1645 CHECK(val->result_ok);
1646 LDKChannelFeatures res_var = (*val->contents.result);
1647 uint64_t res_ref = 0;
1648 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1649 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1650 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1651 res_ref = (uint64_t)res_var.inner & ~1;
1654 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1655 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1656 CHECK(!val->result_ok);
1657 LDKDecodeError err_var = (*val->contents.err);
1658 uint64_t err_ref = 0;
1659 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1660 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1661 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1662 err_ref = (uint64_t)err_var.inner & ~1;
1665 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1666 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1667 CHECK(val->result_ok);
1668 LDKNodeFeatures res_var = (*val->contents.result);
1669 uint64_t res_ref = 0;
1670 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1671 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1672 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1673 res_ref = (uint64_t)res_var.inner & ~1;
1676 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1677 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1678 CHECK(!val->result_ok);
1679 LDKDecodeError err_var = (*val->contents.err);
1680 uint64_t err_ref = 0;
1681 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1682 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1683 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1684 err_ref = (uint64_t)err_var.inner & ~1;
1687 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1688 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1689 CHECK(val->result_ok);
1690 LDKInvoiceFeatures res_var = (*val->contents.result);
1691 uint64_t res_ref = 0;
1692 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1693 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1694 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1695 res_ref = (uint64_t)res_var.inner & ~1;
1698 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1699 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1700 CHECK(!val->result_ok);
1701 LDKDecodeError err_var = (*val->contents.err);
1702 uint64_t err_ref = 0;
1703 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1704 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1705 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1706 err_ref = (uint64_t)err_var.inner & ~1;
1709 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1710 LDKCResult_ChannelTypeFeaturesDecodeErrorZ *val = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(arg & ~1);
1711 CHECK(val->result_ok);
1712 LDKChannelTypeFeatures res_var = (*val->contents.result);
1713 uint64_t res_ref = 0;
1714 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1715 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1716 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1717 res_ref = (uint64_t)res_var.inner & ~1;
1720 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1721 LDKCResult_ChannelTypeFeaturesDecodeErrorZ *val = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(arg & ~1);
1722 CHECK(!val->result_ok);
1723 LDKDecodeError err_var = (*val->contents.err);
1724 uint64_t err_ref = 0;
1725 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1726 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1727 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1728 err_ref = (uint64_t)err_var.inner & ~1;
1731 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1732 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1733 CHECK(val->result_ok);
1734 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
1735 uint64_t res_ref = 0;
1736 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1737 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1738 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1739 res_ref = (uint64_t)res_var.inner & ~1;
1742 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1743 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1744 CHECK(!val->result_ok);
1745 LDKDecodeError err_var = (*val->contents.err);
1746 uint64_t err_ref = 0;
1747 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1748 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1749 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1750 err_ref = (uint64_t)err_var.inner & ~1;
1753 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1754 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1755 CHECK(val->result_ok);
1756 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
1757 uint64_t res_ref = 0;
1758 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1759 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1760 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1761 res_ref = (uint64_t)res_var.inner & ~1;
1764 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1765 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1766 CHECK(!val->result_ok);
1767 LDKDecodeError err_var = (*val->contents.err);
1768 uint64_t err_ref = 0;
1769 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1770 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1771 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1772 err_ref = (uint64_t)err_var.inner & ~1;
1775 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1776 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1777 CHECK(val->result_ok);
1778 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1781 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1782 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1783 CHECK(!val->result_ok);
1784 LDKDecodeError err_var = (*val->contents.err);
1785 uint64_t err_ref = 0;
1786 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1787 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1788 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1789 err_ref = (uint64_t)err_var.inner & ~1;
1792 void __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_get_ok(uint32_t arg) {
1793 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
1794 CHECK(val->result_ok);
1795 return *val->contents.result;
1797 void __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_get_err(uint32_t arg) {
1798 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
1799 CHECK(!val->result_ok);
1800 return *val->contents.err;
1802 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR tuple){
1805 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t tuple) {
1806 LDKC2Tuple_SignatureCVec_SignatureZZ* tuple_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(tuple & ~1);
1807 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1808 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_SignatureCVec_SignatureZZ_get_a(tuple_conv).compact_form, 64);
1812 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR tuple){
1815 ptrArray __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t tuple) {
1816 LDKC2Tuple_SignatureCVec_SignatureZZ* tuple_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(tuple & ~1);
1817 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(tuple_conv);
1818 ptrArray ret_arr = NULL;
1819 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
1820 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
1821 for (size_t m = 0; m < ret_var.datalen; m++) {
1822 int8_tArray ret_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1823 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].compact_form, 64);
1824 ret_arr_ptr[m] = ret_conv_12_arr;
1831 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t arg) {
1832 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1833 CHECK(val->result_ok);
1834 LDKC2Tuple_SignatureCVec_SignatureZZ* res_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1835 *res_conv = (*val->contents.result);
1836 *res_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(res_conv);
1837 return ((uint64_t)res_conv);
1839 void __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t arg) {
1840 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1841 CHECK(!val->result_ok);
1842 return *val->contents.err;
1844 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_ok(uint32_t arg) {
1845 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1846 CHECK(val->result_ok);
1847 int8_tArray res_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1848 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compact_form, 64);
1851 void __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_err(uint32_t arg) {
1852 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1853 CHECK(!val->result_ok);
1854 return *val->contents.err;
1856 typedef struct LDKBaseSign_JCalls {
1857 atomic_size_t refcnt;
1858 uint32_t get_per_commitment_point_meth;
1859 uint32_t release_commitment_secret_meth;
1860 uint32_t validate_holder_commitment_meth;
1861 uint32_t channel_keys_id_meth;
1862 uint32_t sign_counterparty_commitment_meth;
1863 uint32_t validate_counterparty_revocation_meth;
1864 uint32_t sign_holder_commitment_and_htlcs_meth;
1865 uint32_t sign_justice_revoked_output_meth;
1866 uint32_t sign_justice_revoked_htlc_meth;
1867 uint32_t sign_counterparty_htlc_transaction_meth;
1868 uint32_t sign_closing_transaction_meth;
1869 uint32_t sign_channel_announcement_meth;
1870 uint32_t ready_channel_meth;
1871 } LDKBaseSign_JCalls;
1872 static void LDKBaseSign_JCalls_free(void* this_arg) {
1873 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1874 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1875 js_free(j_calls->get_per_commitment_point_meth);
1876 js_free(j_calls->release_commitment_secret_meth);
1877 js_free(j_calls->validate_holder_commitment_meth);
1878 js_free(j_calls->channel_keys_id_meth);
1879 js_free(j_calls->sign_counterparty_commitment_meth);
1880 js_free(j_calls->validate_counterparty_revocation_meth);
1881 js_free(j_calls->sign_holder_commitment_and_htlcs_meth);
1882 js_free(j_calls->sign_justice_revoked_output_meth);
1883 js_free(j_calls->sign_justice_revoked_htlc_meth);
1884 js_free(j_calls->sign_counterparty_htlc_transaction_meth);
1885 js_free(j_calls->sign_closing_transaction_meth);
1886 js_free(j_calls->sign_channel_announcement_meth);
1887 js_free(j_calls->ready_channel_meth);
1891 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1892 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1893 int8_tArray ret = js_invoke_function_1(j_calls->get_per_commitment_point_meth, idx);
1894 LDKPublicKey ret_ref;
1895 CHECK(*((uint32_t*)ret) == 33);
1896 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
1899 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1900 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1901 int8_tArray ret = js_invoke_function_1(j_calls->release_commitment_secret_meth, idx);
1902 LDKThirtyTwoBytes ret_ref;
1903 CHECK(*((uint32_t*)ret) == 32);
1904 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1907 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx) {
1908 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1909 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1910 uint64_t holder_tx_ref = 0;
1911 holder_tx_var = HolderCommitmentTransaction_clone(holder_tx);
1912 CHECK((((uint64_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1913 CHECK((((uint64_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1914 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
1915 holder_tx_ref = (uint64_t)holder_tx_var.inner;
1916 if (holder_tx_var.is_owned) {
1919 uint32_t ret = js_invoke_function_1(j_calls->validate_holder_commitment_meth, holder_tx_ref);
1920 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1921 CHECK_ACCESS(ret_ptr);
1922 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1926 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
1927 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1928 int8_tArray ret = js_invoke_function_0(j_calls->channel_keys_id_meth);
1929 LDKThirtyTwoBytes ret_ref;
1930 CHECK(*((uint32_t*)ret) == 32);
1931 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1934 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1935 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1936 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1937 uint64_t commitment_tx_ref = 0;
1938 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1939 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1940 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1941 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1942 commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1943 if (commitment_tx_var.is_owned) {
1944 commitment_tx_ref |= 1;
1946 uint32_t ret = js_invoke_function_1(j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
1947 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1948 CHECK_ACCESS(ret_ptr);
1949 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
1953 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
1954 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1955 int8_tArray secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1956 memcpy((uint8_t*)(secret_arr + 4), *secret, 32);
1957 uint32_t ret = js_invoke_function_2(j_calls->validate_counterparty_revocation_meth, idx, secret_arr);
1958 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1959 CHECK_ACCESS(ret_ptr);
1960 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1964 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1965 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1966 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1967 uint64_t commitment_tx_ref = 0;
1968 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1969 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1970 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1971 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1972 commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1973 if (commitment_tx_var.is_owned) {
1974 commitment_tx_ref |= 1;
1976 uint32_t ret = js_invoke_function_1(j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
1977 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1978 CHECK_ACCESS(ret_ptr);
1979 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
1983 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]) {
1984 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1985 LDKTransaction justice_tx_var = justice_tx;
1986 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1987 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1988 Transaction_free(justice_tx_var);
1989 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1990 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1991 uint32_t ret = js_invoke_function_4(j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
1992 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1993 CHECK_ACCESS(ret_ptr);
1994 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1998 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) {
1999 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2000 LDKTransaction justice_tx_var = justice_tx;
2001 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2002 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
2003 Transaction_free(justice_tx_var);
2004 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2005 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
2006 LDKHTLCOutputInCommitment htlc_var = *htlc;
2007 uint64_t htlc_ref = 0;
2008 htlc_var = HTLCOutputInCommitment_clone(htlc);
2009 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2010 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2011 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
2012 htlc_ref = (uint64_t)htlc_var.inner;
2013 if (htlc_var.is_owned) {
2016 uint32_t ret = js_invoke_function_5(j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
2017 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2018 CHECK_ACCESS(ret_ptr);
2019 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2023 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) {
2024 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2025 LDKTransaction htlc_tx_var = htlc_tx;
2026 int8_tArray htlc_tx_arr = init_arr(htlc_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2027 memcpy((uint8_t*)(htlc_tx_arr + 4), htlc_tx_var.data, htlc_tx_var.datalen);
2028 Transaction_free(htlc_tx_var);
2029 int8_tArray per_commitment_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
2030 memcpy((uint8_t*)(per_commitment_point_arr + 4), per_commitment_point.compressed_form, 33);
2031 LDKHTLCOutputInCommitment htlc_var = *htlc;
2032 uint64_t htlc_ref = 0;
2033 htlc_var = HTLCOutputInCommitment_clone(htlc);
2034 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2035 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2036 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
2037 htlc_ref = (uint64_t)htlc_var.inner;
2038 if (htlc_var.is_owned) {
2041 uint32_t ret = js_invoke_function_5(j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
2042 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2043 CHECK_ACCESS(ret_ptr);
2044 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2048 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
2049 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2050 LDKClosingTransaction closing_tx_var = *closing_tx;
2051 uint64_t closing_tx_ref = 0;
2052 closing_tx_var = ClosingTransaction_clone(closing_tx);
2053 CHECK((((uint64_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2054 CHECK((((uint64_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2055 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
2056 closing_tx_ref = (uint64_t)closing_tx_var.inner;
2057 if (closing_tx_var.is_owned) {
2058 closing_tx_ref |= 1;
2060 uint32_t ret = js_invoke_function_1(j_calls->sign_closing_transaction_meth, closing_tx_ref);
2061 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2062 CHECK_ACCESS(ret_ptr);
2063 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2067 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2068 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2069 LDKUnsignedChannelAnnouncement msg_var = *msg;
2070 uint64_t msg_ref = 0;
2071 msg_var = UnsignedChannelAnnouncement_clone(msg);
2072 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2073 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2074 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2075 msg_ref = (uint64_t)msg_var.inner;
2076 if (msg_var.is_owned) {
2079 uint32_t ret = js_invoke_function_1(j_calls->sign_channel_announcement_meth, msg_ref);
2080 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2081 CHECK_ACCESS(ret_ptr);
2082 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2086 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2087 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2088 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2089 uint64_t channel_parameters_ref = 0;
2090 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
2091 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2092 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2093 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
2094 channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
2095 if (channel_parameters_var.is_owned) {
2096 channel_parameters_ref |= 1;
2098 js_invoke_function_1(j_calls->ready_channel_meth, channel_parameters_ref);
2100 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
2101 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
2102 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2104 static inline LDKBaseSign LDKBaseSign_init (/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
2105 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
2106 atomic_init(&calls->refcnt, 1);
2107 //TODO: Assign calls->o from o
2109 LDKChannelPublicKeys pubkeys_conv;
2110 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2111 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2112 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2115 .this_arg = (void*) calls,
2116 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
2117 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
2118 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
2119 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
2120 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
2121 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
2122 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
2123 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
2124 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
2125 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
2126 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
2127 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
2128 .ready_channel = ready_channel_LDKBaseSign_jcall,
2129 .free = LDKBaseSign_JCalls_free,
2130 .pubkeys = pubkeys_conv,
2131 .set_pubkeys = NULL,
2135 long __attribute__((visibility("default"))) TS_LDKBaseSign_new(/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
2136 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
2137 *res_ptr = LDKBaseSign_init(o, pubkeys);
2138 return (long)res_ptr;
2140 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
2141 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2142 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2143 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2144 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
2145 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
2149 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
2150 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2151 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2152 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2153 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2154 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
2158 uint32_t __attribute__((visibility("default"))) TS_BaseSign_validate_holder_commitment(uint32_t this_arg, uint32_t holder_tx) {
2159 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2160 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2161 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2162 LDKHolderCommitmentTransaction holder_tx_conv;
2163 holder_tx_conv.inner = (void*)(holder_tx & (~1));
2164 holder_tx_conv.is_owned = false;
2165 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
2166 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2167 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv);
2168 return (uint64_t)ret_conv;
2171 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_channel_keys_id(uint32_t this_arg) {
2172 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2173 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2174 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2175 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2176 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
2180 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_counterparty_commitment(uint32_t this_arg, uint32_t commitment_tx) {
2181 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2182 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2183 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2184 LDKCommitmentTransaction commitment_tx_conv;
2185 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2186 commitment_tx_conv.is_owned = false;
2187 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2188 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2189 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2190 return (uint64_t)ret_conv;
2193 uint32_t __attribute__((visibility("default"))) TS_BaseSign_validate_counterparty_revocation(uint32_t this_arg, int64_t idx, int8_tArray secret) {
2194 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2195 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2196 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2197 unsigned char secret_arr[32];
2198 CHECK(*((uint32_t*)secret) == 32);
2199 memcpy(secret_arr, (uint8_t*)(secret + 4), 32);
2200 unsigned char (*secret_ref)[32] = &secret_arr;
2201 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2202 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
2203 return (uint64_t)ret_conv;
2206 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_holder_commitment_and_htlcs(uint32_t this_arg, uint32_t commitment_tx) {
2207 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2208 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2209 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2210 LDKHolderCommitmentTransaction commitment_tx_conv;
2211 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2212 commitment_tx_conv.is_owned = false;
2213 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2214 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2215 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2216 return (uint64_t)ret_conv;
2219 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_justice_revoked_output(uint32_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key) {
2220 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2221 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2222 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2223 LDKTransaction justice_tx_ref;
2224 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
2225 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2226 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
2227 justice_tx_ref.data_is_owned = true;
2228 unsigned char per_commitment_key_arr[32];
2229 CHECK(*((uint32_t*)per_commitment_key) == 32);
2230 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
2231 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2232 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2233 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2234 return (uint64_t)ret_conv;
2237 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_justice_revoked_htlc(uint32_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key, uint32_t htlc) {
2238 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2239 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2240 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2241 LDKTransaction justice_tx_ref;
2242 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
2243 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2244 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
2245 justice_tx_ref.data_is_owned = true;
2246 unsigned char per_commitment_key_arr[32];
2247 CHECK(*((uint32_t*)per_commitment_key) == 32);
2248 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
2249 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2250 LDKHTLCOutputInCommitment htlc_conv;
2251 htlc_conv.inner = (void*)(htlc & (~1));
2252 htlc_conv.is_owned = false;
2253 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2254 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2255 *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);
2256 return (uint64_t)ret_conv;
2259 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_counterparty_htlc_transaction(uint32_t this_arg, int8_tArray htlc_tx, int64_t input, int64_t amount, int8_tArray per_commitment_point, uint32_t htlc) {
2260 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2261 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2262 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2263 LDKTransaction htlc_tx_ref;
2264 htlc_tx_ref.datalen = *((uint32_t*)htlc_tx);
2265 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2266 memcpy(htlc_tx_ref.data, (uint8_t*)(htlc_tx + 4), htlc_tx_ref.datalen);
2267 htlc_tx_ref.data_is_owned = true;
2268 LDKPublicKey per_commitment_point_ref;
2269 CHECK(*((uint32_t*)per_commitment_point) == 33);
2270 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
2271 LDKHTLCOutputInCommitment htlc_conv;
2272 htlc_conv.inner = (void*)(htlc & (~1));
2273 htlc_conv.is_owned = false;
2274 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2275 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2276 *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);
2277 return (uint64_t)ret_conv;
2280 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_closing_transaction(uint32_t this_arg, uint32_t closing_tx) {
2281 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2282 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2283 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2284 LDKClosingTransaction closing_tx_conv;
2285 closing_tx_conv.inner = (void*)(closing_tx & (~1));
2286 closing_tx_conv.is_owned = false;
2287 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
2288 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2289 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
2290 return (uint64_t)ret_conv;
2293 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
2294 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2295 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2296 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2297 LDKUnsignedChannelAnnouncement msg_conv;
2298 msg_conv.inner = (void*)(msg & (~1));
2299 msg_conv.is_owned = false;
2300 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
2301 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2302 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2303 return (uint64_t)ret_conv;
2306 void __attribute__((visibility("default"))) TS_BaseSign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
2307 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2308 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2309 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2310 LDKChannelTransactionParameters channel_parameters_conv;
2311 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2312 channel_parameters_conv.is_owned = false;
2313 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
2314 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2317 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
2318 if (this_arg->set_pubkeys != NULL)
2319 this_arg->set_pubkeys(this_arg);
2320 return this_arg->pubkeys;
2322 uint32_t __attribute__((visibility("default"))) TS_BaseSign_get_pubkeys(uint32_t this_arg) {
2323 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2324 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2325 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2326 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
2327 uint64_t ret_ref = 0;
2328 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2329 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2330 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2331 ret_ref = (uint64_t)ret_var.inner;
2332 if (ret_var.is_owned) {
2338 typedef struct LDKSign_JCalls {
2339 atomic_size_t refcnt;
2340 LDKBaseSign_JCalls* BaseSign;
2341 uint32_t write_meth;
2343 static void LDKSign_JCalls_free(void* this_arg) {
2344 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2345 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2346 js_free(j_calls->write_meth);
2350 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
2351 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2352 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
2353 LDKCVec_u8Z ret_ref;
2354 ret_ref.datalen = *((uint32_t*)ret);
2355 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2356 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
2359 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
2360 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
2361 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2362 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
2364 static inline LDKSign LDKSign_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* BaseSign, uint32_t pubkeys) {
2365 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2366 atomic_init(&calls->refcnt, 1);
2367 //TODO: Assign calls->o from o
2369 LDKChannelPublicKeys pubkeys_conv;
2370 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2371 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2372 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2375 .this_arg = (void*) calls,
2376 .write = write_LDKSign_jcall,
2377 .cloned = LDKSign_JCalls_cloned,
2378 .free = LDKSign_JCalls_free,
2379 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
2381 calls->BaseSign = ret.BaseSign.this_arg;
2384 long __attribute__((visibility("default"))) TS_LDKSign_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* BaseSign, uint32_t pubkeys) {
2385 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2386 *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
2387 return (long)res_ptr;
2389 int8_tArray __attribute__((visibility("default"))) TS_Sign_write(uint32_t this_arg) {
2390 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2391 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2392 LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
2393 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2394 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2395 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
2396 CVec_u8Z_free(ret_var);
2400 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_ok(uint32_t arg) {
2401 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2402 CHECK(val->result_ok);
2403 LDKSign* res_ret = MALLOC(sizeof(LDKSign), "LDKSign");
2404 *res_ret = Sign_clone(&(*val->contents.result));
2405 return (uint64_t)res_ret;
2407 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_err(uint32_t arg) {
2408 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2409 CHECK(!val->result_ok);
2410 LDKDecodeError err_var = (*val->contents.err);
2411 uint64_t err_ref = 0;
2412 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2413 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2414 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
2415 err_ref = (uint64_t)err_var.inner & ~1;
2418 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_get_ok(uint32_t arg) {
2419 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2420 CHECK(val->result_ok);
2421 int8_tArray es_arr = init_arr(68, sizeof(uint8_t), "Native int8_tArray Bytes");
2422 memcpy((uint8_t*)(es_arr + 4), (*val->contents.result).serialized_form, 68);
2425 void __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_get_err(uint32_t arg) {
2426 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2427 CHECK(!val->result_ok);
2428 return *val->contents.err;
2430 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2431 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2432 for (size_t i = 0; i < ret.datalen; i++) {
2433 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2437 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t arg) {
2438 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2439 CHECK(val->result_ok);
2440 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
2441 ptrArray res_arr = NULL;
2442 res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
2443 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
2444 for (size_t m = 0; m < res_var.datalen; m++) {
2445 LDKCVec_u8Z res_conv_12_var = res_var.data[m];
2446 int8_tArray res_conv_12_arr = init_arr(res_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2447 memcpy((uint8_t*)(res_conv_12_arr + 4), res_conv_12_var.data, res_conv_12_var.datalen);
2448 res_arr_ptr[m] = res_conv_12_arr;
2453 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t arg) {
2454 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2455 CHECK(!val->result_ok);
2456 return *val->contents.err;
2458 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t arg) {
2459 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2460 CHECK(val->result_ok);
2461 LDKInMemorySigner res_var = (*val->contents.result);
2462 uint64_t res_ref = 0;
2463 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2464 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2465 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
2466 res_ref = (uint64_t)res_var.inner & ~1;
2469 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_err(uint32_t arg) {
2470 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2471 CHECK(!val->result_ok);
2472 LDKDecodeError err_var = (*val->contents.err);
2473 uint64_t err_ref = 0;
2474 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2475 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2476 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
2477 err_ref = (uint64_t)err_var.inner & ~1;
2480 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2481 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2482 for (size_t i = 0; i < ret.datalen; i++) {
2483 ret.data[i] = TxOut_clone(&orig->data[i]);
2487 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_ok(uint32_t arg) {
2488 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2489 CHECK(val->result_ok);
2490 LDKTransaction res_var = (*val->contents.result);
2491 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2492 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
2495 void __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_err(uint32_t arg) {
2496 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2497 CHECK(!val->result_ok);
2498 return *val->contents.err;
2500 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR tuple){
2501 return ThirtyTwoBytes_clone(&tuple->a);
2503 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t tuple) {
2504 LDKC2Tuple_BlockHashChannelMonitorZ* tuple_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(tuple & ~1);
2505 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2506 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_BlockHashChannelMonitorZ_get_a(tuple_conv).data, 32);
2510 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR tuple){
2511 return ChannelMonitor_clone(&tuple->b);
2513 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t tuple) {
2514 LDKC2Tuple_BlockHashChannelMonitorZ* tuple_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(tuple & ~1);
2515 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(tuple_conv);
2516 uint64_t ret_ref = 0;
2517 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2518 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2519 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2520 ret_ref = (uint64_t)ret_var.inner;
2521 if (ret_var.is_owned) {
2527 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
2528 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
2529 for (size_t i = 0; i < ret.datalen; i++) {
2530 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
2534 uint32_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(uint32_t arg) {
2535 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2536 CHECK(val->result_ok);
2537 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
2538 uint32_tArray res_arr = NULL;
2539 res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2540 uint32_t *res_arr_ptr = (uint32_t*)(res_arr + 4);
2541 for (size_t j = 0; j < res_var.datalen; j++) {
2542 LDKC2Tuple_BlockHashChannelMonitorZ* res_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2543 *res_conv_35_conv = res_var.data[j];
2544 *res_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone(res_conv_35_conv);
2545 res_arr_ptr[j] = ((uint64_t)res_conv_35_conv);
2550 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(uint32_t arg) {
2551 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2552 CHECK(!val->result_ok);
2553 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
2556 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u16Z_ref_from_ptr(uint32_t ptr) {
2557 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
2559 case LDKCOption_u16Z_Some: {
2560 return 0 /* LDKCOption_u16Z - Some */; (void) obj->some;
2562 case LDKCOption_u16Z_None: {
2563 return 0 /* LDKCOption_u16Z - None */;
2568 uint32_t __attribute__((visibility("default"))) TS_LDKAPIError_ref_from_ptr(uint32_t ptr) {
2569 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
2571 case LDKAPIError_APIMisuseError: {
2572 LDKStr err_str = obj->api_misuse_error.err;
2573 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2574 return 0 /* LDKAPIError - APIMisuseError */; (void) err_conv;
2576 case LDKAPIError_FeeRateTooHigh: {
2577 LDKStr err_str = obj->fee_rate_too_high.err;
2578 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2579 return 0 /* LDKAPIError - FeeRateTooHigh */; (void) err_conv; (void) obj->fee_rate_too_high.feerate;
2581 case LDKAPIError_RouteError: {
2582 LDKStr err_str = obj->route_error.err;
2583 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2584 return 0 /* LDKAPIError - RouteError */; (void) err_conv;
2586 case LDKAPIError_ChannelUnavailable: {
2587 LDKStr err_str = obj->channel_unavailable.err;
2588 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2589 return 0 /* LDKAPIError - ChannelUnavailable */; (void) err_conv;
2591 case LDKAPIError_MonitorUpdateFailed: {
2592 return 0 /* LDKAPIError - MonitorUpdateFailed */;
2594 case LDKAPIError_IncompatibleShutdownScript: {
2595 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
2596 uint64_t script_ref = 0;
2597 CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2598 CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2599 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
2600 script_ref = (uint64_t)script_var.inner & ~1;
2601 return 0 /* LDKAPIError - IncompatibleShutdownScript */; (void) script_ref;
2606 void __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_ok(uint32_t arg) {
2607 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2608 CHECK(val->result_ok);
2609 return *val->contents.result;
2611 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_err(uint32_t arg) {
2612 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2613 CHECK(!val->result_ok);
2614 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2617 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2618 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2619 for (size_t i = 0; i < ret.datalen; i++) {
2620 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
2624 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
2625 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
2626 for (size_t i = 0; i < ret.datalen; i++) {
2627 ret.data[i] = APIError_clone(&orig->data[i]);
2631 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult__u832APIErrorZ_get_ok(uint32_t arg) {
2632 LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1);
2633 CHECK(val->result_ok);
2634 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2635 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2638 uint32_t __attribute__((visibility("default"))) TS_LDKCResult__u832APIErrorZ_get_err(uint32_t arg) {
2639 LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1);
2640 CHECK(!val->result_ok);
2641 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2644 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentSendFailure_ref_from_ptr(uint32_t ptr) {
2645 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
2647 case LDKPaymentSendFailure_ParameterError: {
2648 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
2649 return 0 /* LDKPaymentSendFailure - ParameterError */; (void) parameter_error_ref;
2651 case LDKPaymentSendFailure_PathParameterError: {
2652 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
2653 uint32_tArray path_parameter_error_arr = NULL;
2654 path_parameter_error_arr = init_arr(path_parameter_error_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2655 uint32_t *path_parameter_error_arr_ptr = (uint32_t*)(path_parameter_error_arr + 4);
2656 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
2657 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2658 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
2659 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
2660 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
2663 return 0 /* LDKPaymentSendFailure - PathParameterError */; (void) path_parameter_error_arr;
2665 case LDKPaymentSendFailure_AllFailedRetrySafe: {
2666 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
2667 uint32_tArray all_failed_retry_safe_arr = NULL;
2668 all_failed_retry_safe_arr = init_arr(all_failed_retry_safe_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2669 uint32_t *all_failed_retry_safe_arr_ptr = (uint32_t*)(all_failed_retry_safe_arr + 4);
2670 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
2671 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
2672 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
2675 return 0 /* LDKPaymentSendFailure - AllFailedRetrySafe */; (void) all_failed_retry_safe_arr;
2677 case LDKPaymentSendFailure_PartialFailure: {
2678 LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
2679 uint32_tArray results_arr = NULL;
2680 results_arr = init_arr(results_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2681 uint32_t *results_arr_ptr = (uint32_t*)(results_arr + 4);
2682 for (size_t w = 0; w < results_var.datalen; w++) {
2683 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2684 *results_conv_22_conv = results_var.data[w];
2685 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
2686 results_arr_ptr[w] = (uint64_t)results_conv_22_conv;
2689 LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
2690 uint64_t failed_paths_retry_ref = 0;
2691 if ((uint64_t)failed_paths_retry_var.inner > 4096) {
2692 CHECK((((uint64_t)failed_paths_retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2693 CHECK((((uint64_t)&failed_paths_retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2694 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
2695 failed_paths_retry_ref = (uint64_t)failed_paths_retry_var.inner & ~1;
2697 int8_tArray payment_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2698 memcpy((uint8_t*)(payment_id_arr + 4), obj->partial_failure.payment_id.data, 32);
2699 return 0 /* LDKPaymentSendFailure - PartialFailure */; (void) results_arr; (void) failed_paths_retry_ref; (void) payment_id_arr;
2704 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentSendFailureZ_get_ok(uint32_t arg) {
2705 LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
2706 CHECK(val->result_ok);
2707 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2708 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2711 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentSendFailureZ_get_err(uint32_t arg) {
2712 LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
2713 CHECK(!val->result_ok);
2714 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2717 void __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_ok(uint32_t arg) {
2718 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2719 CHECK(val->result_ok);
2720 return *val->contents.result;
2722 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_err(uint32_t arg) {
2723 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2724 CHECK(!val->result_ok);
2725 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2728 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){
2729 return ThirtyTwoBytes_clone(&tuple->a);
2731 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint32_t tuple) {
2732 LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1);
2733 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2734 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentIdZ_get_a(tuple_conv).data, 32);
2738 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){
2739 return ThirtyTwoBytes_clone(&tuple->b);
2741 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint32_t tuple) {
2742 LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1);
2743 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2744 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentIdZ_get_b(tuple_conv).data, 32);
2748 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint32_t arg) {
2749 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
2750 CHECK(val->result_ok);
2751 LDKC2Tuple_PaymentHashPaymentIdZ* res_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
2752 *res_conv = (*val->contents.result);
2753 *res_conv = C2Tuple_PaymentHashPaymentIdZ_clone(res_conv);
2754 return ((uint64_t)res_conv);
2756 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint32_t arg) {
2757 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
2758 CHECK(!val->result_ok);
2759 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2762 uint32_t __attribute__((visibility("default"))) TS_LDKNetAddress_ref_from_ptr(uint32_t ptr) {
2763 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
2765 case LDKNetAddress_IPv4: {
2766 int8_tArray addr_arr = init_arr(4, sizeof(uint8_t), "Native int8_tArray Bytes");
2767 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv4.addr.data, 4);
2768 return 0 /* LDKNetAddress - IPv4 */; (void) addr_arr; (void) obj->i_pv4.port;
2770 case LDKNetAddress_IPv6: {
2771 int8_tArray addr_arr = init_arr(16, sizeof(uint8_t), "Native int8_tArray Bytes");
2772 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv6.addr.data, 16);
2773 return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port;
2775 case LDKNetAddress_OnionV2: {
2776 int8_tArray onion_v2_arr = init_arr(12, sizeof(uint8_t), "Native int8_tArray Bytes");
2777 memcpy((uint8_t*)(onion_v2_arr + 4), obj->onion_v2.data, 12);
2778 return 0 /* LDKNetAddress - OnionV2 */; (void) onion_v2_arr;
2780 case LDKNetAddress_OnionV3: {
2781 int8_tArray ed25519_pubkey_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2782 memcpy((uint8_t*)(ed25519_pubkey_arr + 4), obj->onion_v3.ed25519_pubkey.data, 32);
2783 return 0 /* LDKNetAddress - OnionV3 */; (void) ed25519_pubkey_arr; (void) obj->onion_v3.checksum; (void) obj->onion_v3.version; (void) obj->onion_v3.port;
2788 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
2789 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
2790 for (size_t i = 0; i < ret.datalen; i++) {
2791 ret.data[i] = NetAddress_clone(&orig->data[i]);
2795 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR tuple){
2796 return ThirtyTwoBytes_clone(&tuple->a);
2798 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint32_t tuple) {
2799 LDKC2Tuple_PaymentHashPaymentSecretZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(tuple & ~1);
2800 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2801 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentSecretZ_get_a(tuple_conv).data, 32);
2805 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR tuple){
2806 return ThirtyTwoBytes_clone(&tuple->b);
2808 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint32_t tuple) {
2809 LDKC2Tuple_PaymentHashPaymentSecretZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(tuple & ~1);
2810 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2811 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentSecretZ_get_b(tuple_conv).data, 32);
2815 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(uint32_t arg) {
2816 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1);
2817 CHECK(val->result_ok);
2818 LDKC2Tuple_PaymentHashPaymentSecretZ* res_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
2819 *res_conv = (*val->contents.result);
2820 *res_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(res_conv);
2821 return ((uint64_t)res_conv);
2823 void __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(uint32_t arg) {
2824 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1);
2825 CHECK(!val->result_ok);
2826 return *val->contents.err;
2828 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(uint32_t arg) {
2829 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1);
2830 CHECK(val->result_ok);
2831 LDKC2Tuple_PaymentHashPaymentSecretZ* res_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
2832 *res_conv = (*val->contents.result);
2833 *res_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(res_conv);
2834 return ((uint64_t)res_conv);
2836 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(uint32_t arg) {
2837 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1);
2838 CHECK(!val->result_ok);
2839 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2842 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretNoneZ_get_ok(uint32_t arg) {
2843 LDKCResult_PaymentSecretNoneZ *val = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1);
2844 CHECK(val->result_ok);
2845 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2846 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2849 void __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretNoneZ_get_err(uint32_t arg) {
2850 LDKCResult_PaymentSecretNoneZ *val = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1);
2851 CHECK(!val->result_ok);
2852 return *val->contents.err;
2854 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_ok(uint32_t arg) {
2855 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
2856 CHECK(val->result_ok);
2857 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2858 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2861 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_err(uint32_t arg) {
2862 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
2863 CHECK(!val->result_ok);
2864 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2867 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentPreimageAPIErrorZ_get_ok(uint32_t arg) {
2868 LDKCResult_PaymentPreimageAPIErrorZ *val = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1);
2869 CHECK(val->result_ok);
2870 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2871 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2874 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentPreimageAPIErrorZ_get_err(uint32_t arg) {
2875 LDKCResult_PaymentPreimageAPIErrorZ *val = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1);
2876 CHECK(!val->result_ok);
2877 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2880 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
2881 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
2882 for (size_t i = 0; i < ret.datalen; i++) {
2883 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
2887 typedef struct LDKWatch_JCalls {
2888 atomic_size_t refcnt;
2889 uint32_t watch_channel_meth;
2890 uint32_t update_channel_meth;
2891 uint32_t release_pending_monitor_events_meth;
2893 static void LDKWatch_JCalls_free(void* this_arg) {
2894 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2895 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2896 js_free(j_calls->watch_channel_meth);
2897 js_free(j_calls->update_channel_meth);
2898 js_free(j_calls->release_pending_monitor_events_meth);
2902 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2903 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2904 LDKOutPoint funding_txo_var = funding_txo;
2905 uint64_t funding_txo_ref = 0;
2906 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2907 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2908 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2909 funding_txo_ref = (uint64_t)funding_txo_var.inner;
2910 if (funding_txo_var.is_owned) {
2911 funding_txo_ref |= 1;
2913 LDKChannelMonitor monitor_var = monitor;
2914 uint64_t monitor_ref = 0;
2915 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2916 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2917 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
2918 monitor_ref = (uint64_t)monitor_var.inner;
2919 if (monitor_var.is_owned) {
2922 uint32_t ret = js_invoke_function_2(j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2923 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2924 CHECK_ACCESS(ret_ptr);
2925 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
2929 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2930 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2931 LDKOutPoint funding_txo_var = funding_txo;
2932 uint64_t funding_txo_ref = 0;
2933 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2934 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2935 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2936 funding_txo_ref = (uint64_t)funding_txo_var.inner;
2937 if (funding_txo_var.is_owned) {
2938 funding_txo_ref |= 1;
2940 LDKChannelMonitorUpdate update_var = update;
2941 uint64_t update_ref = 0;
2942 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2943 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2944 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
2945 update_ref = (uint64_t)update_var.inner;
2946 if (update_var.is_owned) {
2949 uint32_t ret = js_invoke_function_2(j_calls->update_channel_meth, funding_txo_ref, update_ref);
2950 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2951 CHECK_ACCESS(ret_ptr);
2952 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
2956 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
2957 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2958 uint32_tArray ret = js_invoke_function_0(j_calls->release_pending_monitor_events_meth);
2959 LDKCVec_MonitorEventZ ret_constr;
2960 ret_constr.datalen = *((uint32_t*)ret);
2961 if (ret_constr.datalen > 0)
2962 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2964 ret_constr.data = NULL;
2965 uint32_t* ret_vals = (uint32_t*)(ret + 4);
2966 for (size_t o = 0; o < ret_constr.datalen; o++) {
2967 uint32_t ret_conv_14 = ret_vals[o];
2968 void* ret_conv_14_ptr = (void*)(((uint64_t)ret_conv_14) & ~1);
2969 CHECK_ACCESS(ret_conv_14_ptr);
2970 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(ret_conv_14_ptr);
2971 FREE((void*)ret_conv_14);
2972 ret_constr.data[o] = ret_conv_14_conv;
2976 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
2977 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
2978 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2980 static inline LDKWatch LDKWatch_init (/*TODO: JS Object Reference */void* o) {
2981 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2982 atomic_init(&calls->refcnt, 1);
2983 //TODO: Assign calls->o from o
2986 .this_arg = (void*) calls,
2987 .watch_channel = watch_channel_LDKWatch_jcall,
2988 .update_channel = update_channel_LDKWatch_jcall,
2989 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
2990 .free = LDKWatch_JCalls_free,
2994 long __attribute__((visibility("default"))) TS_LDKWatch_new(/*TODO: JS Object Reference */void* o) {
2995 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2996 *res_ptr = LDKWatch_init(o);
2997 return (long)res_ptr;
2999 uint32_t __attribute__((visibility("default"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
3000 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3001 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3002 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
3003 LDKOutPoint funding_txo_conv;
3004 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3005 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3006 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
3007 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3008 LDKChannelMonitor monitor_conv;
3009 monitor_conv.inner = (void*)(monitor & (~1));
3010 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
3011 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
3012 monitor_conv = ChannelMonitor_clone(&monitor_conv);
3013 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3014 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
3015 return (uint64_t)ret_conv;
3018 uint32_t __attribute__((visibility("default"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
3019 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3020 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3021 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
3022 LDKOutPoint funding_txo_conv;
3023 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3024 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3025 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
3026 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3027 LDKChannelMonitorUpdate update_conv;
3028 update_conv.inner = (void*)(update & (~1));
3029 update_conv.is_owned = (update & 1) || (update == 0);
3030 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
3031 update_conv = ChannelMonitorUpdate_clone(&update_conv);
3032 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3033 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
3034 return (uint64_t)ret_conv;
3037 uint32_tArray __attribute__((visibility("default"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
3038 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3039 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3040 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
3041 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
3042 uint32_tArray ret_arr = NULL;
3043 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3044 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
3045 for (size_t o = 0; o < ret_var.datalen; o++) {
3046 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3047 *ret_conv_14_copy = ret_var.data[o];
3048 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
3049 ret_arr_ptr[o] = ret_conv_14_ref;
3056 typedef struct LDKBroadcasterInterface_JCalls {
3057 atomic_size_t refcnt;
3058 uint32_t broadcast_transaction_meth;
3059 } LDKBroadcasterInterface_JCalls;
3060 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
3061 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3062 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3063 js_free(j_calls->broadcast_transaction_meth);
3067 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
3068 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3069 LDKTransaction tx_var = tx;
3070 int8_tArray tx_arr = init_arr(tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3071 memcpy((uint8_t*)(tx_arr + 4), tx_var.data, tx_var.datalen);
3072 Transaction_free(tx_var);
3073 js_invoke_function_1(j_calls->broadcast_transaction_meth, tx_arr);
3075 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
3076 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
3077 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3079 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (/*TODO: JS Object Reference */void* o) {
3080 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
3081 atomic_init(&calls->refcnt, 1);
3082 //TODO: Assign calls->o from o
3084 LDKBroadcasterInterface ret = {
3085 .this_arg = (void*) calls,
3086 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
3087 .free = LDKBroadcasterInterface_JCalls_free,
3091 long __attribute__((visibility("default"))) TS_LDKBroadcasterInterface_new(/*TODO: JS Object Reference */void* o) {
3092 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
3093 *res_ptr = LDKBroadcasterInterface_init(o);
3094 return (long)res_ptr;
3096 void __attribute__((visibility("default"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
3097 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3098 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3099 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
3100 LDKTransaction tx_ref;
3101 tx_ref.datalen = *((uint32_t*)tx);
3102 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
3103 memcpy(tx_ref.data, (uint8_t*)(tx + 4), tx_ref.datalen);
3104 tx_ref.data_is_owned = true;
3105 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
3108 typedef struct LDKKeysInterface_JCalls {
3109 atomic_size_t refcnt;
3110 uint32_t get_node_secret_meth;
3111 uint32_t get_destination_script_meth;
3112 uint32_t get_shutdown_scriptpubkey_meth;
3113 uint32_t get_channel_signer_meth;
3114 uint32_t get_secure_random_bytes_meth;
3115 uint32_t read_chan_signer_meth;
3116 uint32_t sign_invoice_meth;
3117 uint32_t get_inbound_payment_key_material_meth;
3118 } LDKKeysInterface_JCalls;
3119 static void LDKKeysInterface_JCalls_free(void* this_arg) {
3120 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3121 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3122 js_free(j_calls->get_node_secret_meth);
3123 js_free(j_calls->get_destination_script_meth);
3124 js_free(j_calls->get_shutdown_scriptpubkey_meth);
3125 js_free(j_calls->get_channel_signer_meth);
3126 js_free(j_calls->get_secure_random_bytes_meth);
3127 js_free(j_calls->read_chan_signer_meth);
3128 js_free(j_calls->sign_invoice_meth);
3129 js_free(j_calls->get_inbound_payment_key_material_meth);
3133 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
3134 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3135 int8_tArray ret = js_invoke_function_0(j_calls->get_node_secret_meth);
3136 LDKSecretKey ret_ref;
3137 CHECK(*((uint32_t*)ret) == 32);
3138 memcpy(ret_ref.bytes, (uint8_t*)(ret + 4), 32);
3141 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
3142 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3143 int8_tArray ret = js_invoke_function_0(j_calls->get_destination_script_meth);
3144 LDKCVec_u8Z ret_ref;
3145 ret_ref.datalen = *((uint32_t*)ret);
3146 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3147 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
3150 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
3151 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3152 uint32_t ret = js_invoke_function_0(j_calls->get_shutdown_scriptpubkey_meth);
3153 LDKShutdownScript ret_conv;
3154 ret_conv.inner = (void*)(ret & (~1));
3155 ret_conv.is_owned = (ret & 1) || (ret == 0);
3156 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
3159 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
3160 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3161 uint32_t ret = js_invoke_function_2(j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
3162 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
3163 CHECK_ACCESS(ret_ptr);
3164 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
3168 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
3169 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3170 int8_tArray ret = js_invoke_function_0(j_calls->get_secure_random_bytes_meth);
3171 LDKThirtyTwoBytes ret_ref;
3172 CHECK(*((uint32_t*)ret) == 32);
3173 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
3176 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
3177 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3178 LDKu8slice reader_var = reader;
3179 int8_tArray reader_arr = init_arr(reader_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3180 memcpy((uint8_t*)(reader_arr + 4), reader_var.data, reader_var.datalen);
3181 uint32_t ret = js_invoke_function_1(j_calls->read_chan_signer_meth, reader_arr);
3182 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
3183 CHECK_ACCESS(ret_ptr);
3184 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
3188 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
3189 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3190 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
3191 int8_tArray invoice_preimage_arr = init_arr(invoice_preimage_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3192 memcpy((uint8_t*)(invoice_preimage_arr + 4), invoice_preimage_var.data, invoice_preimage_var.datalen);
3193 CVec_u8Z_free(invoice_preimage_var);
3194 uint32_t ret = js_invoke_function_1(j_calls->sign_invoice_meth, invoice_preimage_arr);
3195 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
3196 CHECK_ACCESS(ret_ptr);
3197 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
3201 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
3202 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3203 int8_tArray ret = js_invoke_function_0(j_calls->get_inbound_payment_key_material_meth);
3204 LDKThirtyTwoBytes ret_ref;
3205 CHECK(*((uint32_t*)ret) == 32);
3206 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
3209 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
3210 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
3211 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3213 static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Reference */void* o) {
3214 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
3215 atomic_init(&calls->refcnt, 1);
3216 //TODO: Assign calls->o from o
3218 LDKKeysInterface ret = {
3219 .this_arg = (void*) calls,
3220 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
3221 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
3222 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
3223 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
3224 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
3225 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
3226 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
3227 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
3228 .free = LDKKeysInterface_JCalls_free,
3232 long __attribute__((visibility("default"))) TS_LDKKeysInterface_new(/*TODO: JS Object Reference */void* o) {
3233 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
3234 *res_ptr = LDKKeysInterface_init(o);
3235 return (long)res_ptr;
3237 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_node_secret(uint32_t this_arg) {
3238 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3239 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3240 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3241 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3242 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
3246 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
3247 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3248 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3249 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3250 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
3251 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3252 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3253 CVec_u8Z_free(ret_var);
3257 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint32_t this_arg) {
3258 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3259 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3260 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3261 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
3262 uint64_t ret_ref = 0;
3263 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3264 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3265 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3266 ret_ref = (uint64_t)ret_var.inner;
3267 if (ret_var.is_owned) {
3273 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
3274 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3275 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3276 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3277 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
3278 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
3279 return (uint64_t)ret_ret;
3282 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
3283 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3284 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3285 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3286 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3287 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
3291 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
3292 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3293 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3294 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3295 LDKu8slice reader_ref;
3296 reader_ref.datalen = *((uint32_t*)reader);
3297 reader_ref.data = (int8_t*)(reader + 4);
3298 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
3299 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
3300 return (uint64_t)ret_conv;
3303 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_sign_invoice(uint32_t this_arg, int8_tArray invoice_preimage) {
3304 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3305 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3306 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3307 LDKCVec_u8Z invoice_preimage_ref;
3308 invoice_preimage_ref.datalen = *((uint32_t*)invoice_preimage);
3309 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
3310 memcpy(invoice_preimage_ref.data, (uint8_t*)(invoice_preimage + 4), invoice_preimage_ref.datalen);
3311 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
3312 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
3313 return (uint64_t)ret_conv;
3316 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_inbound_payment_key_material(uint32_t this_arg) {
3317 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3318 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3319 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3320 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3321 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
3325 typedef struct LDKFeeEstimator_JCalls {
3326 atomic_size_t refcnt;
3327 uint32_t get_est_sat_per_1000_weight_meth;
3328 } LDKFeeEstimator_JCalls;
3329 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
3330 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3331 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3332 js_free(j_calls->get_est_sat_per_1000_weight_meth);
3336 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
3337 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3338 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
3339 return js_invoke_function_1(j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
3341 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
3342 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
3343 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3345 static inline LDKFeeEstimator LDKFeeEstimator_init (/*TODO: JS Object Reference */void* o) {
3346 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
3347 atomic_init(&calls->refcnt, 1);
3348 //TODO: Assign calls->o from o
3350 LDKFeeEstimator ret = {
3351 .this_arg = (void*) calls,
3352 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
3353 .free = LDKFeeEstimator_JCalls_free,
3357 long __attribute__((visibility("default"))) TS_LDKFeeEstimator_new(/*TODO: JS Object Reference */void* o) {
3358 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
3359 *res_ptr = LDKFeeEstimator_init(o);
3360 return (long)res_ptr;
3362 int32_t __attribute__((visibility("default"))) TS_FeeEstimator_get_est_sat_per_1000_weight(uint32_t this_arg, uint32_t confirmation_target) {
3363 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3364 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3365 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
3366 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
3367 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
3371 typedef struct LDKLogger_JCalls {
3372 atomic_size_t refcnt;
3375 static void LDKLogger_JCalls_free(void* this_arg) {
3376 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3377 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3378 js_free(j_calls->log_meth);
3382 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
3383 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3384 LDKRecord record_var = *record;
3385 uint64_t record_ref = 0;
3386 record_var = Record_clone(record);
3387 CHECK((((uint64_t)record_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3388 CHECK((((uint64_t)&record_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3389 CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
3390 record_ref = (uint64_t)record_var.inner;
3391 if (record_var.is_owned) {
3394 js_invoke_function_1(j_calls->log_meth, record_ref);
3396 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
3397 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
3398 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3400 static inline LDKLogger LDKLogger_init (/*TODO: JS Object Reference */void* o) {
3401 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3402 atomic_init(&calls->refcnt, 1);
3403 //TODO: Assign calls->o from o
3406 .this_arg = (void*) calls,
3407 .log = log_LDKLogger_jcall,
3408 .free = LDKLogger_JCalls_free,
3412 long __attribute__((visibility("default"))) TS_LDKLogger_new(/*TODO: JS Object Reference */void* o) {
3413 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3414 *res_ptr = LDKLogger_init(o);
3415 return (long)res_ptr;
3417 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR tuple){
3418 return ThirtyTwoBytes_clone(&tuple->a);
3420 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint32_t tuple) {
3421 LDKC2Tuple_BlockHashChannelManagerZ* tuple_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(tuple & ~1);
3422 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3423 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_BlockHashChannelManagerZ_get_a(tuple_conv).data, 32);
3427 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR tuple){
3430 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint32_t tuple) {
3431 LDKC2Tuple_BlockHashChannelManagerZ* tuple_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(tuple & ~1);
3432 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(tuple_conv);
3433 uint64_t ret_ref = 0;
3434 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3435 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3436 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3437 ret_ref = (uint64_t)ret_var.inner & ~1;
3441 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t arg) {
3442 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3443 CHECK(val->result_ok);
3444 LDKC2Tuple_BlockHashChannelManagerZ* res_conv = &(*val->contents.result);
3445 // Warning: we really need to clone here, but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
3446 return ((uint64_t)res_conv) | 1;
3448 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t arg) {
3449 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3450 CHECK(!val->result_ok);
3451 LDKDecodeError err_var = (*val->contents.err);
3452 uint64_t err_ref = 0;
3453 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3454 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3455 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
3456 err_ref = (uint64_t)err_var.inner & ~1;
3459 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t arg) {
3460 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
3461 CHECK(val->result_ok);
3462 LDKChannelConfig res_var = (*val->contents.result);
3463 uint64_t res_ref = 0;
3464 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3465 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3466 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3467 res_ref = (uint64_t)res_var.inner & ~1;
3470 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_err(uint32_t arg) {
3471 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
3472 CHECK(!val->result_ok);
3473 LDKDecodeError err_var = (*val->contents.err);
3474 uint64_t err_ref = 0;
3475 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3476 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3477 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
3478 err_ref = (uint64_t)err_var.inner & ~1;
3481 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_ok(uint32_t arg) {
3482 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
3483 CHECK(val->result_ok);
3484 LDKOutPoint res_var = (*val->contents.result);
3485 uint64_t res_ref = 0;
3486 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3487 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3488 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3489 res_ref = (uint64_t)res_var.inner & ~1;
3492 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_err(uint32_t arg) {
3493 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
3494 CHECK(!val->result_ok);
3495 LDKDecodeError err_var = (*val->contents.err);
3496 uint64_t err_ref = 0;
3497 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3498 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3499 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
3500 err_ref = (uint64_t)err_var.inner & ~1;
3503 typedef struct LDKType_JCalls {
3504 atomic_size_t refcnt;
3505 uint32_t type_id_meth;
3506 uint32_t debug_str_meth;
3507 uint32_t write_meth;
3509 static void LDKType_JCalls_free(void* this_arg) {
3510 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3511 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3512 js_free(j_calls->type_id_meth);
3513 js_free(j_calls->debug_str_meth);
3514 js_free(j_calls->write_meth);
3518 uint16_t type_id_LDKType_jcall(const void* this_arg) {
3519 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3520 return js_invoke_function_0(j_calls->type_id_meth);
3522 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
3523 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3524 uint32_t ret = js_invoke_function_0(j_calls->debug_str_meth);
3525 LDKStr ret_conv = str_ref_to_owned_c(ret);
3528 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
3529 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3530 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
3531 LDKCVec_u8Z ret_ref;
3532 ret_ref.datalen = *((uint32_t*)ret);
3533 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3534 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
3537 static void LDKType_JCalls_cloned(LDKType* new_obj) {
3538 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
3539 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3541 static inline LDKType LDKType_init (/*TODO: JS Object Reference */void* o) {
3542 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
3543 atomic_init(&calls->refcnt, 1);
3544 //TODO: Assign calls->o from o
3547 .this_arg = (void*) calls,
3548 .type_id = type_id_LDKType_jcall,
3549 .debug_str = debug_str_LDKType_jcall,
3550 .write = write_LDKType_jcall,
3551 .cloned = LDKType_JCalls_cloned,
3552 .free = LDKType_JCalls_free,
3556 long __attribute__((visibility("default"))) TS_LDKType_new(/*TODO: JS Object Reference */void* o) {
3557 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
3558 *res_ptr = LDKType_init(o);
3559 return (long)res_ptr;
3561 int16_t __attribute__((visibility("default"))) TS_Type_type_id(uint32_t this_arg) {
3562 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3563 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3564 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
3565 int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
3569 jstring __attribute__((visibility("default"))) TS_Type_debug_str(uint32_t this_arg) {
3570 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3571 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3572 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
3573 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
3574 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
3579 int8_tArray __attribute__((visibility("default"))) TS_Type_write(uint32_t this_arg) {
3580 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3581 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3582 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
3583 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3584 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3585 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3586 CVec_u8Z_free(ret_var);
3590 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_TypeZ_ref_from_ptr(uint32_t ptr) {
3591 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
3593 case LDKCOption_TypeZ_Some: {
3594 LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
3595 *some_ret = Type_clone(&obj->some);
3596 return 0 /* LDKCOption_TypeZ - Some */; (void) (uint64_t)some_ret;
3598 case LDKCOption_TypeZ_None: {
3599 return 0 /* LDKCOption_TypeZ - None */;
3604 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_get_ok(uint32_t arg) {
3605 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
3606 CHECK(val->result_ok);
3607 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
3610 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_get_err(uint32_t arg) {
3611 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
3612 CHECK(!val->result_ok);
3613 LDKDecodeError err_var = (*val->contents.err);
3614 uint64_t err_ref = 0;
3615 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3616 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3617 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
3618 err_ref = (uint64_t)err_var.inner & ~1;
3621 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentError_ref_from_ptr(uint32_t ptr) {
3622 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
3624 case LDKPaymentError_Invoice: {
3625 LDKStr invoice_str = obj->invoice;
3626 jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
3627 return 0 /* LDKPaymentError - Invoice */; (void) invoice_conv;
3629 case LDKPaymentError_Routing: {
3630 LDKLightningError routing_var = obj->routing;
3631 uint64_t routing_ref = 0;
3632 CHECK((((uint64_t)routing_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3633 CHECK((((uint64_t)&routing_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3634 CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
3635 routing_ref = (uint64_t)routing_var.inner & ~1;
3636 return 0 /* LDKPaymentError - Routing */; (void) routing_ref;
3638 case LDKPaymentError_Sending: {
3639 uint64_t sending_ref = ((uint64_t)&obj->sending) | 1;
3640 return 0 /* LDKPaymentError - Sending */; (void) sending_ref;
3645 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentErrorZ_get_ok(uint32_t arg) {
3646 LDKCResult_PaymentIdPaymentErrorZ *val = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
3647 CHECK(val->result_ok);
3648 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3649 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
3652 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentErrorZ_get_err(uint32_t arg) {
3653 LDKCResult_PaymentIdPaymentErrorZ *val = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
3654 CHECK(!val->result_ok);
3655 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3658 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_get_ok(uint32_t arg) {
3659 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
3660 CHECK(val->result_ok);
3661 uint32_t res_conv = LDKSiPrefix_to_js((*val->contents.result));
3664 void __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_get_err(uint32_t arg) {
3665 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
3666 CHECK(!val->result_ok);
3667 return *val->contents.err;
3669 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_get_ok(uint32_t arg) {
3670 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
3671 CHECK(val->result_ok);
3672 LDKInvoice res_var = (*val->contents.result);
3673 uint64_t res_ref = 0;
3674 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3675 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3676 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3677 res_ref = (uint64_t)res_var.inner & ~1;
3680 void __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_get_err(uint32_t arg) {
3681 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
3682 CHECK(!val->result_ok);
3683 return *val->contents.err;
3685 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_get_ok(uint32_t arg) {
3686 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
3687 CHECK(val->result_ok);
3688 LDKSignedRawInvoice res_var = (*val->contents.result);
3689 uint64_t res_ref = 0;
3690 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3691 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3692 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3693 res_ref = (uint64_t)res_var.inner & ~1;
3696 void __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_get_err(uint32_t arg) {
3697 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
3698 CHECK(!val->result_ok);
3699 return *val->contents.err;
3701 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
3702 return RawInvoice_clone(&tuple->a);
3704 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint32_t tuple) {
3705 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
3706 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(tuple_conv);
3707 uint64_t ret_ref = 0;
3708 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3709 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3710 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3711 ret_ref = (uint64_t)ret_var.inner;
3712 if (ret_var.is_owned) {
3718 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
3719 return ThirtyTwoBytes_clone(&tuple->b);
3721 int8_tArray __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint32_t tuple) {
3722 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
3723 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3724 memcpy((uint8_t*)(ret_arr + 4), C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(tuple_conv).data, 32);
3728 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
3729 return InvoiceSignature_clone(&tuple->c);
3731 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint32_t tuple) {
3732 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
3733 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(tuple_conv);
3734 uint64_t ret_ref = 0;
3735 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3736 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3737 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3738 ret_ref = (uint64_t)ret_var.inner;
3739 if (ret_var.is_owned) {
3745 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_get_ok(uint32_t arg) {
3746 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
3747 CHECK(val->result_ok);
3748 LDKPayeePubKey res_var = (*val->contents.result);
3749 uint64_t res_ref = 0;
3750 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3751 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3752 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3753 res_ref = (uint64_t)res_var.inner & ~1;
3756 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_get_err(uint32_t arg) {
3757 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
3758 CHECK(!val->result_ok);
3759 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
3762 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
3763 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
3764 for (size_t i = 0; i < ret.datalen; i++) {
3765 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
3769 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_get_ok(uint32_t arg) {
3770 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
3771 CHECK(val->result_ok);
3772 LDKPositiveTimestamp res_var = (*val->contents.result);
3773 uint64_t res_ref = 0;
3774 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3775 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3776 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3777 res_ref = (uint64_t)res_var.inner & ~1;
3780 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_get_err(uint32_t arg) {
3781 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
3782 CHECK(!val->result_ok);
3783 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3786 void __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_get_ok(uint32_t arg) {
3787 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
3788 CHECK(val->result_ok);
3789 return *val->contents.result;
3791 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_get_err(uint32_t arg) {
3792 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
3793 CHECK(!val->result_ok);
3794 uint32_t err_conv = LDKSemanticError_to_js((*val->contents.err));
3797 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_get_ok(uint32_t arg) {
3798 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
3799 CHECK(val->result_ok);
3800 LDKInvoice res_var = (*val->contents.result);
3801 uint64_t res_ref = 0;
3802 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3803 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3804 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3805 res_ref = (uint64_t)res_var.inner & ~1;
3808 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_get_err(uint32_t arg) {
3809 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
3810 CHECK(!val->result_ok);
3811 uint32_t err_conv = LDKSemanticError_to_js((*val->contents.err));
3814 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_get_ok(uint32_t arg) {
3815 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
3816 CHECK(val->result_ok);
3817 LDKDescription res_var = (*val->contents.result);
3818 uint64_t res_ref = 0;
3819 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3820 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3821 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3822 res_ref = (uint64_t)res_var.inner & ~1;
3825 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_get_err(uint32_t arg) {
3826 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
3827 CHECK(!val->result_ok);
3828 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3831 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_get_ok(uint32_t arg) {
3832 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
3833 CHECK(val->result_ok);
3834 LDKExpiryTime res_var = (*val->contents.result);
3835 uint64_t res_ref = 0;
3836 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3837 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3838 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3839 res_ref = (uint64_t)res_var.inner & ~1;
3842 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_get_err(uint32_t arg) {
3843 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
3844 CHECK(!val->result_ok);
3845 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3848 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_get_ok(uint32_t arg) {
3849 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
3850 CHECK(val->result_ok);
3851 LDKPrivateRoute res_var = (*val->contents.result);
3852 uint64_t res_ref = 0;
3853 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3854 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3855 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3856 res_ref = (uint64_t)res_var.inner & ~1;
3859 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_get_err(uint32_t arg) {
3860 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
3861 CHECK(!val->result_ok);
3862 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3865 jstring __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_get_ok(uint32_t arg) {
3866 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
3867 CHECK(val->result_ok);
3868 LDKStr res_str = (*val->contents.result);
3869 jstring res_conv = str_ref_to_ts(res_str.chars, res_str.len);
3872 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_get_err(uint32_t arg) {
3873 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
3874 CHECK(!val->result_ok);
3875 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
3878 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3879 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
3880 CHECK(val->result_ok);
3881 LDKChannelMonitorUpdate res_var = (*val->contents.result);
3882 uint64_t res_ref = 0;
3883 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3884 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3885 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3886 res_ref = (uint64_t)res_var.inner & ~1;
3889 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t arg) {
3890 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
3891 CHECK(!val->result_ok);
3892 LDKDecodeError err_var = (*val->contents.err);
3893 uint64_t err_ref = 0;
3894 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3895 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3896 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
3897 err_ref = (uint64_t)err_var.inner & ~1;
3900 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_MonitorEventZ_ref_from_ptr(uint32_t ptr) {
3901 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
3903 case LDKCOption_MonitorEventZ_Some: {
3904 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
3905 return 0 /* LDKCOption_MonitorEventZ - Some */; (void) some_ref;
3907 case LDKCOption_MonitorEventZ_None: {
3908 return 0 /* LDKCOption_MonitorEventZ - None */;
3913 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint32_t arg) {
3914 LDKCResult_COption_MonitorEventZDecodeErrorZ *val = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
3915 CHECK(val->result_ok);
3916 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
3919 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_MonitorEventZDecodeErrorZ_get_err(uint32_t arg) {
3920 LDKCResult_COption_MonitorEventZDecodeErrorZ *val = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
3921 CHECK(!val->result_ok);
3922 LDKDecodeError err_var = (*val->contents.err);
3923 uint64_t err_ref = 0;
3924 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3925 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3926 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
3927 err_ref = (uint64_t)err_var.inner & ~1;
3930 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3931 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
3932 CHECK(val->result_ok);
3933 LDKHTLCUpdate res_var = (*val->contents.result);
3934 uint64_t res_ref = 0;
3935 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3936 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3937 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3938 res_ref = (uint64_t)res_var.inner & ~1;
3941 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t arg) {
3942 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
3943 CHECK(!val->result_ok);
3944 LDKDecodeError err_var = (*val->contents.err);
3945 uint64_t err_ref = 0;
3946 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3947 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3948 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
3949 err_ref = (uint64_t)err_var.inner & ~1;
3952 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){
3953 return OutPoint_clone(&tuple->a);
3955 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_get_a(uint32_t tuple) {
3956 LDKC2Tuple_OutPointScriptZ* tuple_conv = (LDKC2Tuple_OutPointScriptZ*)(tuple & ~1);
3957 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(tuple_conv);
3958 uint64_t ret_ref = 0;
3959 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3960 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3961 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3962 ret_ref = (uint64_t)ret_var.inner;
3963 if (ret_var.is_owned) {
3969 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){
3970 return CVec_u8Z_clone(&tuple->b);
3972 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_get_b(uint32_t tuple) {
3973 LDKC2Tuple_OutPointScriptZ* tuple_conv = (LDKC2Tuple_OutPointScriptZ*)(tuple & ~1);
3974 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(tuple_conv);
3975 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3976 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3977 CVec_u8Z_free(ret_var);
3981 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR tuple){
3984 int32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_get_a(uint32_t tuple) {
3985 LDKC2Tuple_u32ScriptZ* tuple_conv = (LDKC2Tuple_u32ScriptZ*)(tuple & ~1);
3986 int32_t ret_val = C2Tuple_u32ScriptZ_get_a(tuple_conv);
3990 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR tuple){
3991 return CVec_u8Z_clone(&tuple->b);
3993 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_get_b(uint32_t tuple) {
3994 LDKC2Tuple_u32ScriptZ* tuple_conv = (LDKC2Tuple_u32ScriptZ*)(tuple & ~1);
3995 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(tuple_conv);
3996 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3997 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3998 CVec_u8Z_free(ret_var);
4002 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
4003 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
4004 for (size_t i = 0; i < ret.datalen; i++) {
4005 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
4009 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR tuple){
4010 return ThirtyTwoBytes_clone(&tuple->a);
4012 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint32_t tuple) {
4013 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(tuple & ~1);
4014 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4015 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(tuple_conv).data, 32);
4019 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR tuple){
4020 return CVec_C2Tuple_u32ScriptZZ_clone(&tuple->b);
4022 uint32_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint32_t tuple) {
4023 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(tuple & ~1);
4024 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(tuple_conv);
4025 uint32_tArray ret_arr = NULL;
4026 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
4027 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
4028 for (size_t v = 0; v < ret_var.datalen; v++) {
4029 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
4030 *ret_conv_21_conv = ret_var.data[v];
4031 ret_arr_ptr[v] = ((uint64_t)ret_conv_21_conv);
4038 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
4039 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 };
4040 for (size_t i = 0; i < ret.datalen; i++) {
4041 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
4045 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
4046 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
4047 for (size_t i = 0; i < ret.datalen; i++) {
4048 ret.data[i] = Event_clone(&orig->data[i]);
4052 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR tuple){
4055 int32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_get_a(uint32_t tuple) {
4056 LDKC2Tuple_u32TxOutZ* tuple_conv = (LDKC2Tuple_u32TxOutZ*)(tuple & ~1);
4057 int32_t ret_val = C2Tuple_u32TxOutZ_get_a(tuple_conv);
4061 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR tuple){
4062 return TxOut_clone(&tuple->b);
4064 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_get_b(uint32_t tuple) {
4065 LDKC2Tuple_u32TxOutZ* tuple_conv = (LDKC2Tuple_u32TxOutZ*)(tuple & ~1);
4066 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
4067 *ret_ref = C2Tuple_u32TxOutZ_get_b(tuple_conv);
4068 return (uint64_t)ret_ref;
4071 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
4072 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
4073 for (size_t i = 0; i < ret.datalen; i++) {
4074 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
4078 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR tuple){
4079 return ThirtyTwoBytes_clone(&tuple->a);
4081 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t tuple) {
4082 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(tuple & ~1);
4083 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4084 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(tuple_conv).data, 32);
4088 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR tuple){
4089 return CVec_C2Tuple_u32TxOutZZ_clone(&tuple->b);
4091 uint32_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t tuple) {
4092 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(tuple & ~1);
4093 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(tuple_conv);
4094 uint32_tArray ret_arr = NULL;
4095 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
4096 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
4097 for (size_t u = 0; u < ret_var.datalen; u++) {
4098 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
4099 *ret_conv_20_conv = ret_var.data[u];
4100 ret_arr_ptr[u] = ((uint64_t)ret_conv_20_conv);
4107 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
4108 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 };
4109 for (size_t i = 0; i < ret.datalen; i++) {
4110 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
4114 uint32_t __attribute__((visibility("default"))) TS_LDKBalance_ref_from_ptr(uint32_t ptr) {
4115 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
4117 case LDKBalance_ClaimableOnChannelClose: {
4118 return 0 /* LDKBalance - ClaimableOnChannelClose */; (void) obj->claimable_on_channel_close.claimable_amount_satoshis;
4120 case LDKBalance_ClaimableAwaitingConfirmations: {
4121 return 0 /* LDKBalance - ClaimableAwaitingConfirmations */; (void) obj->claimable_awaiting_confirmations.claimable_amount_satoshis; (void) obj->claimable_awaiting_confirmations.confirmation_height;
4123 case LDKBalance_ContentiousClaimable: {
4124 return 0 /* LDKBalance - ContentiousClaimable */; (void) obj->contentious_claimable.claimable_amount_satoshis; (void) obj->contentious_claimable.timeout_height;
4126 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
4127 return 0 /* LDKBalance - MaybeClaimableHTLCAwaitingTimeout */; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
4132 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
4133 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
4134 for (size_t i = 0; i < ret.datalen; i++) {
4135 ret.data[i] = Balance_clone(&orig->data[i]);
4139 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t arg) {
4140 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
4141 CHECK(val->result_ok);
4142 LDKC2Tuple_BlockHashChannelMonitorZ* res_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
4143 *res_conv = (*val->contents.result);
4144 *res_conv = C2Tuple_BlockHashChannelMonitorZ_clone(res_conv);
4145 return ((uint64_t)res_conv);
4147 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t arg) {
4148 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
4149 CHECK(!val->result_ok);
4150 LDKDecodeError err_var = (*val->contents.err);
4151 uint64_t err_ref = 0;
4152 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4153 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4154 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4155 err_ref = (uint64_t)err_var.inner & ~1;
4158 void __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_ok(uint32_t arg) {
4159 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4160 CHECK(val->result_ok);
4161 return *val->contents.result;
4163 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_err(uint32_t arg) {
4164 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4165 CHECK(!val->result_ok);
4166 LDKLightningError err_var = (*val->contents.err);
4167 uint64_t err_ref = 0;
4168 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4169 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4170 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4171 err_ref = (uint64_t)err_var.inner & ~1;
4174 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR tuple){
4177 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint32_t tuple) {
4178 LDKC2Tuple_PublicKeyTypeZ* tuple_conv = (LDKC2Tuple_PublicKeyTypeZ*)(tuple & ~1);
4179 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4180 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PublicKeyTypeZ_get_a(tuple_conv).compressed_form, 33);
4184 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR tuple){
4185 return Type_clone(&tuple->b);
4187 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint32_t tuple) {
4188 LDKC2Tuple_PublicKeyTypeZ* tuple_conv = (LDKC2Tuple_PublicKeyTypeZ*)(tuple & ~1);
4189 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
4190 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(tuple_conv);
4191 return (uint64_t)ret_ret;
4194 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
4195 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
4196 for (size_t i = 0; i < ret.datalen; i++) {
4197 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
4201 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_ok(uint32_t arg) {
4202 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4203 CHECK(val->result_ok);
4204 return *val->contents.result;
4206 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_err(uint32_t arg) {
4207 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4208 CHECK(!val->result_ok);
4209 LDKLightningError err_var = (*val->contents.err);
4210 uint64_t err_ref = 0;
4211 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4212 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4213 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4214 err_ref = (uint64_t)err_var.inner & ~1;
4217 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
4218 return ChannelAnnouncement_clone(&tuple->a);
4220 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t tuple) {
4221 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
4222 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(tuple_conv);
4223 uint64_t ret_ref = 0;
4224 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4225 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4226 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4227 ret_ref = (uint64_t)ret_var.inner;
4228 if (ret_var.is_owned) {
4234 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
4235 return ChannelUpdate_clone(&tuple->b);
4237 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t tuple) {
4238 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
4239 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(tuple_conv);
4240 uint64_t ret_ref = 0;
4241 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4242 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4243 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4244 ret_ref = (uint64_t)ret_var.inner;
4245 if (ret_var.is_owned) {
4251 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
4252 return ChannelUpdate_clone(&tuple->c);
4254 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t tuple) {
4255 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
4256 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(tuple_conv);
4257 uint64_t ret_ref = 0;
4258 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4259 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4260 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4261 ret_ref = (uint64_t)ret_var.inner;
4262 if (ret_var.is_owned) {
4268 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
4269 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
4270 for (size_t i = 0; i < ret.datalen; i++) {
4271 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
4275 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
4276 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
4277 for (size_t i = 0; i < ret.datalen; i++) {
4278 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
4282 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t arg) {
4283 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4284 CHECK(val->result_ok);
4285 LDKCVec_u8Z res_var = (*val->contents.result);
4286 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
4287 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
4290 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t arg) {
4291 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4292 CHECK(!val->result_ok);
4293 LDKPeerHandleError err_var = (*val->contents.err);
4294 uint64_t err_ref = 0;
4295 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4296 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4297 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4298 err_ref = (uint64_t)err_var.inner & ~1;
4301 void __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_ok(uint32_t arg) {
4302 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4303 CHECK(val->result_ok);
4304 return *val->contents.result;
4306 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_err(uint32_t arg) {
4307 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4308 CHECK(!val->result_ok);
4309 LDKPeerHandleError err_var = (*val->contents.err);
4310 uint64_t err_ref = 0;
4311 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4312 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4313 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4314 err_ref = (uint64_t)err_var.inner & ~1;
4317 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_ok(uint32_t arg) {
4318 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4319 CHECK(val->result_ok);
4320 return *val->contents.result;
4322 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_err(uint32_t arg) {
4323 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4324 CHECK(!val->result_ok);
4325 LDKPeerHandleError err_var = (*val->contents.err);
4326 uint64_t err_ref = 0;
4327 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4328 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4329 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4330 err_ref = (uint64_t)err_var.inner & ~1;
4333 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeIdDecodeErrorZ_get_ok(uint32_t arg) {
4334 LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
4335 CHECK(val->result_ok);
4336 LDKNodeId res_var = (*val->contents.result);
4337 uint64_t res_ref = 0;
4338 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4339 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4340 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4341 res_ref = (uint64_t)res_var.inner & ~1;
4344 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeIdDecodeErrorZ_get_err(uint32_t arg) {
4345 LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
4346 CHECK(!val->result_ok);
4347 LDKDecodeError err_var = (*val->contents.err);
4348 uint64_t err_ref = 0;
4349 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4350 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4351 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4352 err_ref = (uint64_t)err_var.inner & ~1;
4355 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint32_t arg) {
4356 LDKCResult_COption_NetworkUpdateZDecodeErrorZ *val = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
4357 CHECK(val->result_ok);
4358 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
4361 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint32_t arg) {
4362 LDKCResult_COption_NetworkUpdateZDecodeErrorZ *val = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
4363 CHECK(!val->result_ok);
4364 LDKDecodeError err_var = (*val->contents.err);
4365 uint64_t err_ref = 0;
4366 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4367 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4368 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4369 err_ref = (uint64_t)err_var.inner & ~1;
4372 typedef struct LDKAccess_JCalls {
4373 atomic_size_t refcnt;
4374 uint32_t get_utxo_meth;
4376 static void LDKAccess_JCalls_free(void* this_arg) {
4377 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4378 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4379 js_free(j_calls->get_utxo_meth);
4383 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
4384 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4385 int8_tArray genesis_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4386 memcpy((uint8_t*)(genesis_hash_arr + 4), *genesis_hash, 32);
4387 uint32_t ret = js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
4388 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
4389 CHECK_ACCESS(ret_ptr);
4390 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
4394 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
4395 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
4396 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4398 static inline LDKAccess LDKAccess_init (/*TODO: JS Object Reference */void* o) {
4399 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
4400 atomic_init(&calls->refcnt, 1);
4401 //TODO: Assign calls->o from o
4404 .this_arg = (void*) calls,
4405 .get_utxo = get_utxo_LDKAccess_jcall,
4406 .free = LDKAccess_JCalls_free,
4410 long __attribute__((visibility("default"))) TS_LDKAccess_new(/*TODO: JS Object Reference */void* o) {
4411 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
4412 *res_ptr = LDKAccess_init(o);
4413 return (long)res_ptr;
4415 uint32_t __attribute__((visibility("default"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
4416 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4417 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4418 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
4419 unsigned char genesis_hash_arr[32];
4420 CHECK(*((uint32_t*)genesis_hash) == 32);
4421 memcpy(genesis_hash_arr, (uint8_t*)(genesis_hash + 4), 32);
4422 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
4423 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4424 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
4425 return (uint64_t)ret_conv;
4428 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_AccessZ_ref_from_ptr(uint32_t ptr) {
4429 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
4431 case LDKCOption_AccessZ_Some: {
4432 LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
4433 *some_ret = obj->some;
4434 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
4435 return 0 /* LDKCOption_AccessZ - Some */; (void) (uint64_t)some_ret;
4437 case LDKCOption_AccessZ_None: {
4438 return 0 /* LDKCOption_AccessZ - None */;
4443 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
4444 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4445 CHECK(val->result_ok);
4446 LDKDirectionalChannelInfo res_var = (*val->contents.result);
4447 uint64_t res_ref = 0;
4448 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4449 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4450 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4451 res_ref = (uint64_t)res_var.inner & ~1;
4454 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
4455 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4456 CHECK(!val->result_ok);
4457 LDKDecodeError err_var = (*val->contents.err);
4458 uint64_t err_ref = 0;
4459 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4460 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4461 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4462 err_ref = (uint64_t)err_var.inner & ~1;
4465 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
4466 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4467 CHECK(val->result_ok);
4468 LDKChannelInfo res_var = (*val->contents.result);
4469 uint64_t res_ref = 0;
4470 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4471 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4472 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4473 res_ref = (uint64_t)res_var.inner & ~1;
4476 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
4477 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4478 CHECK(!val->result_ok);
4479 LDKDecodeError err_var = (*val->contents.err);
4480 uint64_t err_ref = 0;
4481 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4482 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4483 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4484 err_ref = (uint64_t)err_var.inner & ~1;
4487 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t arg) {
4488 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4489 CHECK(val->result_ok);
4490 LDKRoutingFees res_var = (*val->contents.result);
4491 uint64_t res_ref = 0;
4492 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4493 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4494 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4495 res_ref = (uint64_t)res_var.inner & ~1;
4498 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_err(uint32_t arg) {
4499 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4500 CHECK(!val->result_ok);
4501 LDKDecodeError err_var = (*val->contents.err);
4502 uint64_t err_ref = 0;
4503 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4504 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4505 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4506 err_ref = (uint64_t)err_var.inner & ~1;
4509 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t arg) {
4510 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
4511 CHECK(val->result_ok);
4512 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
4513 uint64_t res_ref = 0;
4514 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4515 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4516 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4517 res_ref = (uint64_t)res_var.inner & ~1;
4520 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t arg) {
4521 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
4522 CHECK(!val->result_ok);
4523 LDKDecodeError err_var = (*val->contents.err);
4524 uint64_t err_ref = 0;
4525 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4526 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4527 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4528 err_ref = (uint64_t)err_var.inner & ~1;
4531 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
4532 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
4533 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
4536 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_ok(uint32_t arg) {
4537 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
4538 CHECK(val->result_ok);
4539 LDKNodeInfo res_var = (*val->contents.result);
4540 uint64_t res_ref = 0;
4541 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4542 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4543 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4544 res_ref = (uint64_t)res_var.inner & ~1;
4547 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_err(uint32_t arg) {
4548 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
4549 CHECK(!val->result_ok);
4550 LDKDecodeError err_var = (*val->contents.err);
4551 uint64_t err_ref = 0;
4552 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4553 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4554 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4555 err_ref = (uint64_t)err_var.inner & ~1;
4558 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t arg) {
4559 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
4560 CHECK(val->result_ok);
4561 LDKNetworkGraph res_var = (*val->contents.result);
4562 uint64_t res_ref = 0;
4563 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4564 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4565 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4566 res_ref = (uint64_t)res_var.inner & ~1;
4569 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_err(uint32_t arg) {
4570 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
4571 CHECK(!val->result_ok);
4572 LDKDecodeError err_var = (*val->contents.err);
4573 uint64_t err_ref = 0;
4574 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4575 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4576 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4577 err_ref = (uint64_t)err_var.inner & ~1;
4580 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_CVec_NetAddressZZ_ref_from_ptr(uint32_t ptr) {
4581 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
4583 case LDKCOption_CVec_NetAddressZZ_Some: {
4584 LDKCVec_NetAddressZ some_var = obj->some;
4585 uint32_tArray some_arr = NULL;
4586 some_arr = init_arr(some_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
4587 uint32_t *some_arr_ptr = (uint32_t*)(some_arr + 4);
4588 for (size_t m = 0; m < some_var.datalen; m++) {
4589 uint64_t some_conv_12_ref = ((uint64_t)&some_var.data[m]) | 1;
4590 some_arr_ptr[m] = some_conv_12_ref;
4593 return 0 /* LDKCOption_CVec_NetAddressZZ - Some */; (void) some_arr;
4595 case LDKCOption_CVec_NetAddressZZ_None: {
4596 return 0 /* LDKCOption_CVec_NetAddressZZ - None */;
4601 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_get_ok(uint32_t arg) {
4602 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
4603 CHECK(val->result_ok);
4604 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
4607 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_get_err(uint32_t arg) {
4608 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
4609 CHECK(!val->result_ok);
4610 LDKDecodeError err_var = (*val->contents.err);
4611 uint64_t err_ref = 0;
4612 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4613 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4614 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4615 err_ref = (uint64_t)err_var.inner & ~1;
4618 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
4619 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
4620 for (size_t i = 0; i < ret.datalen; i++) {
4621 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
4625 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
4626 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
4627 for (size_t i = 0; i < ret.datalen; i++) {
4628 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
4632 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
4633 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
4634 for (size_t i = 0; i < ret.datalen; i++) {
4635 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
4639 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
4640 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
4641 for (size_t i = 0; i < ret.datalen; i++) {
4642 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
4646 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t arg) {
4647 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
4648 CHECK(val->result_ok);
4649 LDKAcceptChannel res_var = (*val->contents.result);
4650 uint64_t res_ref = 0;
4651 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4652 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4653 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4654 res_ref = (uint64_t)res_var.inner & ~1;
4657 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_err(uint32_t arg) {
4658 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
4659 CHECK(!val->result_ok);
4660 LDKDecodeError err_var = (*val->contents.err);
4661 uint64_t err_ref = 0;
4662 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4663 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4664 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4665 err_ref = (uint64_t)err_var.inner & ~1;
4668 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t arg) {
4669 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
4670 CHECK(val->result_ok);
4671 LDKAnnouncementSignatures res_var = (*val->contents.result);
4672 uint64_t res_ref = 0;
4673 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4674 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4675 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4676 res_ref = (uint64_t)res_var.inner & ~1;
4679 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t arg) {
4680 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
4681 CHECK(!val->result_ok);
4682 LDKDecodeError err_var = (*val->contents.err);
4683 uint64_t err_ref = 0;
4684 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4685 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4686 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4687 err_ref = (uint64_t)err_var.inner & ~1;
4690 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t arg) {
4691 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
4692 CHECK(val->result_ok);
4693 LDKChannelReestablish res_var = (*val->contents.result);
4694 uint64_t res_ref = 0;
4695 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4696 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4697 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4698 res_ref = (uint64_t)res_var.inner & ~1;
4701 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t arg) {
4702 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
4703 CHECK(!val->result_ok);
4704 LDKDecodeError err_var = (*val->contents.err);
4705 uint64_t err_ref = 0;
4706 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4707 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4708 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4709 err_ref = (uint64_t)err_var.inner & ~1;
4712 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t arg) {
4713 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4714 CHECK(val->result_ok);
4715 LDKClosingSigned res_var = (*val->contents.result);
4716 uint64_t res_ref = 0;
4717 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4718 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4719 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4720 res_ref = (uint64_t)res_var.inner & ~1;
4723 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_err(uint32_t arg) {
4724 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4725 CHECK(!val->result_ok);
4726 LDKDecodeError err_var = (*val->contents.err);
4727 uint64_t err_ref = 0;
4728 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4729 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4730 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4731 err_ref = (uint64_t)err_var.inner & ~1;
4734 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint32_t arg) {
4735 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
4736 CHECK(val->result_ok);
4737 LDKClosingSignedFeeRange res_var = (*val->contents.result);
4738 uint64_t res_ref = 0;
4739 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4740 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4741 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4742 res_ref = (uint64_t)res_var.inner & ~1;
4745 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint32_t arg) {
4746 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
4747 CHECK(!val->result_ok);
4748 LDKDecodeError err_var = (*val->contents.err);
4749 uint64_t err_ref = 0;
4750 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4751 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4752 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4753 err_ref = (uint64_t)err_var.inner & ~1;
4756 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t arg) {
4757 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4758 CHECK(val->result_ok);
4759 LDKCommitmentSigned res_var = (*val->contents.result);
4760 uint64_t res_ref = 0;
4761 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4762 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4763 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4764 res_ref = (uint64_t)res_var.inner & ~1;
4767 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t arg) {
4768 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4769 CHECK(!val->result_ok);
4770 LDKDecodeError err_var = (*val->contents.err);
4771 uint64_t err_ref = 0;
4772 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4773 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4774 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4775 err_ref = (uint64_t)err_var.inner & ~1;
4778 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t arg) {
4779 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4780 CHECK(val->result_ok);
4781 LDKFundingCreated res_var = (*val->contents.result);
4782 uint64_t res_ref = 0;
4783 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4784 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4785 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4786 res_ref = (uint64_t)res_var.inner & ~1;
4789 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_err(uint32_t arg) {
4790 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4791 CHECK(!val->result_ok);
4792 LDKDecodeError err_var = (*val->contents.err);
4793 uint64_t err_ref = 0;
4794 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4795 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4796 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4797 err_ref = (uint64_t)err_var.inner & ~1;
4800 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_ok(uint32_t arg) {
4801 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4802 CHECK(val->result_ok);
4803 LDKFundingSigned res_var = (*val->contents.result);
4804 uint64_t res_ref = 0;
4805 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4806 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4807 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4808 res_ref = (uint64_t)res_var.inner & ~1;
4811 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_err(uint32_t arg) {
4812 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4813 CHECK(!val->result_ok);
4814 LDKDecodeError err_var = (*val->contents.err);
4815 uint64_t err_ref = 0;
4816 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4817 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4818 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4819 err_ref = (uint64_t)err_var.inner & ~1;
4822 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_ok(uint32_t arg) {
4823 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4824 CHECK(val->result_ok);
4825 LDKFundingLocked res_var = (*val->contents.result);
4826 uint64_t res_ref = 0;
4827 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4828 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4829 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4830 res_ref = (uint64_t)res_var.inner & ~1;
4833 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_err(uint32_t arg) {
4834 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4835 CHECK(!val->result_ok);
4836 LDKDecodeError err_var = (*val->contents.err);
4837 uint64_t err_ref = 0;
4838 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4839 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4840 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4841 err_ref = (uint64_t)err_var.inner & ~1;
4844 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_ok(uint32_t arg) {
4845 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4846 CHECK(val->result_ok);
4847 LDKInit res_var = (*val->contents.result);
4848 uint64_t res_ref = 0;
4849 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4850 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4851 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4852 res_ref = (uint64_t)res_var.inner & ~1;
4855 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_err(uint32_t arg) {
4856 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4857 CHECK(!val->result_ok);
4858 LDKDecodeError err_var = (*val->contents.err);
4859 uint64_t err_ref = 0;
4860 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4861 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4862 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4863 err_ref = (uint64_t)err_var.inner & ~1;
4866 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_ok(uint32_t arg) {
4867 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4868 CHECK(val->result_ok);
4869 LDKOpenChannel res_var = (*val->contents.result);
4870 uint64_t res_ref = 0;
4871 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4872 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4873 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4874 res_ref = (uint64_t)res_var.inner & ~1;
4877 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_err(uint32_t arg) {
4878 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4879 CHECK(!val->result_ok);
4880 LDKDecodeError err_var = (*val->contents.err);
4881 uint64_t err_ref = 0;
4882 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4883 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4884 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4885 err_ref = (uint64_t)err_var.inner & ~1;
4888 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t arg) {
4889 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4890 CHECK(val->result_ok);
4891 LDKRevokeAndACK res_var = (*val->contents.result);
4892 uint64_t res_ref = 0;
4893 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4894 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4895 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4896 res_ref = (uint64_t)res_var.inner & ~1;
4899 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t arg) {
4900 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4901 CHECK(!val->result_ok);
4902 LDKDecodeError err_var = (*val->contents.err);
4903 uint64_t err_ref = 0;
4904 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4905 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4906 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4907 err_ref = (uint64_t)err_var.inner & ~1;
4910 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_ok(uint32_t arg) {
4911 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4912 CHECK(val->result_ok);
4913 LDKShutdown res_var = (*val->contents.result);
4914 uint64_t res_ref = 0;
4915 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4916 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4917 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4918 res_ref = (uint64_t)res_var.inner & ~1;
4921 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_err(uint32_t arg) {
4922 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4923 CHECK(!val->result_ok);
4924 LDKDecodeError err_var = (*val->contents.err);
4925 uint64_t err_ref = 0;
4926 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4927 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4928 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4929 err_ref = (uint64_t)err_var.inner & ~1;
4932 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4933 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4934 CHECK(val->result_ok);
4935 LDKUpdateFailHTLC res_var = (*val->contents.result);
4936 uint64_t res_ref = 0;
4937 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4938 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4939 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4940 res_ref = (uint64_t)res_var.inner & ~1;
4943 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t arg) {
4944 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4945 CHECK(!val->result_ok);
4946 LDKDecodeError err_var = (*val->contents.err);
4947 uint64_t err_ref = 0;
4948 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4949 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4950 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4951 err_ref = (uint64_t)err_var.inner & ~1;
4954 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4955 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
4956 CHECK(val->result_ok);
4957 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
4958 uint64_t res_ref = 0;
4959 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4960 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4961 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4962 res_ref = (uint64_t)res_var.inner & ~1;
4965 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t arg) {
4966 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
4967 CHECK(!val->result_ok);
4968 LDKDecodeError err_var = (*val->contents.err);
4969 uint64_t err_ref = 0;
4970 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4971 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4972 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4973 err_ref = (uint64_t)err_var.inner & ~1;
4976 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t arg) {
4977 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
4978 CHECK(val->result_ok);
4979 LDKUpdateFee res_var = (*val->contents.result);
4980 uint64_t res_ref = 0;
4981 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4982 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4983 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4984 res_ref = (uint64_t)res_var.inner & ~1;
4987 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_err(uint32_t arg) {
4988 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
4989 CHECK(!val->result_ok);
4990 LDKDecodeError err_var = (*val->contents.err);
4991 uint64_t err_ref = 0;
4992 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4993 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4994 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4995 err_ref = (uint64_t)err_var.inner & ~1;
4998 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4999 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
5000 CHECK(val->result_ok);
5001 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
5002 uint64_t res_ref = 0;
5003 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5004 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5005 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5006 res_ref = (uint64_t)res_var.inner & ~1;
5009 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t arg) {
5010 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
5011 CHECK(!val->result_ok);
5012 LDKDecodeError err_var = (*val->contents.err);
5013 uint64_t err_ref = 0;
5014 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5015 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5016 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5017 err_ref = (uint64_t)err_var.inner & ~1;
5020 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t arg) {
5021 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5022 CHECK(val->result_ok);
5023 LDKUpdateAddHTLC res_var = (*val->contents.result);
5024 uint64_t res_ref = 0;
5025 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5026 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5027 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5028 res_ref = (uint64_t)res_var.inner & ~1;
5031 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t arg) {
5032 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5033 CHECK(!val->result_ok);
5034 LDKDecodeError err_var = (*val->contents.err);
5035 uint64_t err_ref = 0;
5036 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5037 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5038 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5039 err_ref = (uint64_t)err_var.inner & ~1;
5042 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_ok(uint32_t arg) {
5043 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5044 CHECK(val->result_ok);
5045 LDKPing res_var = (*val->contents.result);
5046 uint64_t res_ref = 0;
5047 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5048 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5049 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5050 res_ref = (uint64_t)res_var.inner & ~1;
5053 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_err(uint32_t arg) {
5054 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5055 CHECK(!val->result_ok);
5056 LDKDecodeError err_var = (*val->contents.err);
5057 uint64_t err_ref = 0;
5058 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5059 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5060 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5061 err_ref = (uint64_t)err_var.inner & ~1;
5064 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_ok(uint32_t arg) {
5065 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5066 CHECK(val->result_ok);
5067 LDKPong res_var = (*val->contents.result);
5068 uint64_t res_ref = 0;
5069 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5070 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5071 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5072 res_ref = (uint64_t)res_var.inner & ~1;
5075 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_err(uint32_t arg) {
5076 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5077 CHECK(!val->result_ok);
5078 LDKDecodeError err_var = (*val->contents.err);
5079 uint64_t err_ref = 0;
5080 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5081 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5082 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5083 err_ref = (uint64_t)err_var.inner & ~1;
5086 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5087 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5088 CHECK(val->result_ok);
5089 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
5090 uint64_t res_ref = 0;
5091 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5092 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5093 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5094 res_ref = (uint64_t)res_var.inner & ~1;
5097 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5098 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5099 CHECK(!val->result_ok);
5100 LDKDecodeError err_var = (*val->contents.err);
5101 uint64_t err_ref = 0;
5102 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5103 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5104 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5105 err_ref = (uint64_t)err_var.inner & ~1;
5108 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5109 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5110 CHECK(val->result_ok);
5111 LDKChannelAnnouncement res_var = (*val->contents.result);
5112 uint64_t res_ref = 0;
5113 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5114 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5115 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5116 res_ref = (uint64_t)res_var.inner & ~1;
5119 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5120 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5121 CHECK(!val->result_ok);
5122 LDKDecodeError err_var = (*val->contents.err);
5123 uint64_t err_ref = 0;
5124 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5125 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5126 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5127 err_ref = (uint64_t)err_var.inner & ~1;
5130 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
5131 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5132 CHECK(val->result_ok);
5133 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
5134 uint64_t res_ref = 0;
5135 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5136 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5137 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5138 res_ref = (uint64_t)res_var.inner & ~1;
5141 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
5142 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5143 CHECK(!val->result_ok);
5144 LDKDecodeError err_var = (*val->contents.err);
5145 uint64_t err_ref = 0;
5146 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5147 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5148 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5149 err_ref = (uint64_t)err_var.inner & ~1;
5152 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
5153 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
5154 CHECK(val->result_ok);
5155 LDKChannelUpdate res_var = (*val->contents.result);
5156 uint64_t res_ref = 0;
5157 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5158 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5159 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5160 res_ref = (uint64_t)res_var.inner & ~1;
5163 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
5164 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
5165 CHECK(!val->result_ok);
5166 LDKDecodeError err_var = (*val->contents.err);
5167 uint64_t err_ref = 0;
5168 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5169 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5170 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5171 err_ref = (uint64_t)err_var.inner & ~1;
5174 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t arg) {
5175 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
5176 CHECK(val->result_ok);
5177 LDKErrorMessage res_var = (*val->contents.result);
5178 uint64_t res_ref = 0;
5179 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5180 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5181 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5182 res_ref = (uint64_t)res_var.inner & ~1;
5185 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_err(uint32_t arg) {
5186 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
5187 CHECK(!val->result_ok);
5188 LDKDecodeError err_var = (*val->contents.err);
5189 uint64_t err_ref = 0;
5190 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5191 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5192 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5193 err_ref = (uint64_t)err_var.inner & ~1;
5196 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5197 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5198 CHECK(val->result_ok);
5199 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
5200 uint64_t res_ref = 0;
5201 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5202 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5203 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5204 res_ref = (uint64_t)res_var.inner & ~1;
5207 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5208 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5209 CHECK(!val->result_ok);
5210 LDKDecodeError err_var = (*val->contents.err);
5211 uint64_t err_ref = 0;
5212 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5213 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5214 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5215 err_ref = (uint64_t)err_var.inner & ~1;
5218 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5219 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5220 CHECK(val->result_ok);
5221 LDKNodeAnnouncement res_var = (*val->contents.result);
5222 uint64_t res_ref = 0;
5223 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5224 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5225 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5226 res_ref = (uint64_t)res_var.inner & ~1;
5229 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5230 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5231 CHECK(!val->result_ok);
5232 LDKDecodeError err_var = (*val->contents.err);
5233 uint64_t err_ref = 0;
5234 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5235 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5236 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5237 err_ref = (uint64_t)err_var.inner & ~1;
5240 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t arg) {
5241 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5242 CHECK(val->result_ok);
5243 LDKQueryShortChannelIds res_var = (*val->contents.result);
5244 uint64_t res_ref = 0;
5245 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5246 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5247 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5248 res_ref = (uint64_t)res_var.inner & ~1;
5251 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t arg) {
5252 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5253 CHECK(!val->result_ok);
5254 LDKDecodeError err_var = (*val->contents.err);
5255 uint64_t err_ref = 0;
5256 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5257 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5258 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5259 err_ref = (uint64_t)err_var.inner & ~1;
5262 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t arg) {
5263 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5264 CHECK(val->result_ok);
5265 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
5266 uint64_t res_ref = 0;
5267 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5268 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5269 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5270 res_ref = (uint64_t)res_var.inner & ~1;
5273 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t arg) {
5274 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5275 CHECK(!val->result_ok);
5276 LDKDecodeError err_var = (*val->contents.err);
5277 uint64_t err_ref = 0;
5278 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5279 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5280 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5281 err_ref = (uint64_t)err_var.inner & ~1;
5284 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
5285 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5286 CHECK(val->result_ok);
5287 LDKQueryChannelRange res_var = (*val->contents.result);
5288 uint64_t res_ref = 0;
5289 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5290 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5291 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5292 res_ref = (uint64_t)res_var.inner & ~1;
5295 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
5296 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5297 CHECK(!val->result_ok);
5298 LDKDecodeError err_var = (*val->contents.err);
5299 uint64_t err_ref = 0;
5300 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5301 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5302 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5303 err_ref = (uint64_t)err_var.inner & ~1;
5306 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
5307 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5308 CHECK(val->result_ok);
5309 LDKReplyChannelRange res_var = (*val->contents.result);
5310 uint64_t res_ref = 0;
5311 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5312 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5313 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5314 res_ref = (uint64_t)res_var.inner & ~1;
5317 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
5318 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5319 CHECK(!val->result_ok);
5320 LDKDecodeError err_var = (*val->contents.err);
5321 uint64_t err_ref = 0;
5322 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5323 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5324 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5325 err_ref = (uint64_t)err_var.inner & ~1;
5328 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t arg) {
5329 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5330 CHECK(val->result_ok);
5331 LDKGossipTimestampFilter res_var = (*val->contents.result);
5332 uint64_t res_ref = 0;
5333 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5334 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5335 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5336 res_ref = (uint64_t)res_var.inner & ~1;
5339 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t arg) {
5340 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5341 CHECK(!val->result_ok);
5342 LDKDecodeError err_var = (*val->contents.err);
5343 uint64_t err_ref = 0;
5344 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5345 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5346 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5347 err_ref = (uint64_t)err_var.inner & ~1;
5350 uint32_t __attribute__((visibility("default"))) TS_LDKSignOrCreationError_ref_from_ptr(uint32_t ptr) {
5351 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
5353 case LDKSignOrCreationError_SignError: {
5354 return 0 /* LDKSignOrCreationError - SignError */;
5356 case LDKSignOrCreationError_CreationError: {
5357 uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
5358 return 0 /* LDKSignOrCreationError - CreationError */; (void) creation_error_conv;
5363 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_get_ok(uint32_t arg) {
5364 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5365 CHECK(val->result_ok);
5366 LDKInvoice res_var = (*val->contents.result);
5367 uint64_t res_ref = 0;
5368 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5369 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5370 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5371 res_ref = (uint64_t)res_var.inner & ~1;
5374 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_get_err(uint32_t arg) {
5375 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5376 CHECK(!val->result_ok);
5377 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
5380 typedef struct LDKFilter_JCalls {
5381 atomic_size_t refcnt;
5382 uint32_t register_tx_meth;
5383 uint32_t register_output_meth;
5385 static void LDKFilter_JCalls_free(void* this_arg) {
5386 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5387 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5388 js_free(j_calls->register_tx_meth);
5389 js_free(j_calls->register_output_meth);
5393 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
5394 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5395 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5396 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
5397 LDKu8slice script_pubkey_var = script_pubkey;
5398 int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5399 memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
5400 js_invoke_function_2(j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
5402 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
5403 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5404 LDKWatchedOutput output_var = output;
5405 uint64_t output_ref = 0;
5406 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5407 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5408 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
5409 output_ref = (uint64_t)output_var.inner;
5410 if (output_var.is_owned) {
5413 uint32_t ret = js_invoke_function_1(j_calls->register_output_meth, output_ref);
5414 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
5415 CHECK_ACCESS(ret_ptr);
5416 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
5420 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
5421 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
5422 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5424 static inline LDKFilter LDKFilter_init (/*TODO: JS Object Reference */void* o) {
5425 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
5426 atomic_init(&calls->refcnt, 1);
5427 //TODO: Assign calls->o from o
5430 .this_arg = (void*) calls,
5431 .register_tx = register_tx_LDKFilter_jcall,
5432 .register_output = register_output_LDKFilter_jcall,
5433 .free = LDKFilter_JCalls_free,
5437 long __attribute__((visibility("default"))) TS_LDKFilter_new(/*TODO: JS Object Reference */void* o) {
5438 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
5439 *res_ptr = LDKFilter_init(o);
5440 return (long)res_ptr;
5442 void __attribute__((visibility("default"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
5443 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5444 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5445 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
5446 unsigned char txid_arr[32];
5447 CHECK(*((uint32_t*)txid) == 32);
5448 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
5449 unsigned char (*txid_ref)[32] = &txid_arr;
5450 LDKu8slice script_pubkey_ref;
5451 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
5452 script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
5453 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
5456 uint32_t __attribute__((visibility("default"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
5457 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5458 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5459 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
5460 LDKWatchedOutput output_conv;
5461 output_conv.inner = (void*)(output & (~1));
5462 output_conv.is_owned = (output & 1) || (output == 0);
5463 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
5464 output_conv = WatchedOutput_clone(&output_conv);
5465 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
5466 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
5467 uint64_t ret_ref = (uint64_t)ret_copy;
5471 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_FilterZ_ref_from_ptr(uint32_t ptr) {
5472 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
5474 case LDKCOption_FilterZ_Some: {
5475 LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
5476 *some_ret = obj->some;
5477 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
5478 return 0 /* LDKCOption_FilterZ - Some */; (void) (uint64_t)some_ret;
5480 case LDKCOption_FilterZ_None: {
5481 return 0 /* LDKCOption_FilterZ - None */;
5486 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_LockedChannelMonitorNoneZ_get_ok(uint32_t arg) {
5487 LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1);
5488 CHECK(val->result_ok);
5489 LDKLockedChannelMonitor res_var = (*val->contents.result);
5490 uint64_t res_ref = 0;
5491 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5492 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5493 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5494 res_ref = (uint64_t)res_var.inner & ~1;
5497 void __attribute__((visibility("default"))) TS_LDKCResult_LockedChannelMonitorNoneZ_get_err(uint32_t arg) {
5498 LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1);
5499 CHECK(!val->result_ok);
5500 return *val->contents.err;
5502 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
5503 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
5504 for (size_t i = 0; i < ret.datalen; i++) {
5505 ret.data[i] = OutPoint_clone(&orig->data[i]);
5509 typedef struct LDKMessageSendEventsProvider_JCalls {
5510 atomic_size_t refcnt;
5511 uint32_t get_and_clear_pending_msg_events_meth;
5512 } LDKMessageSendEventsProvider_JCalls;
5513 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
5514 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5515 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5516 js_free(j_calls->get_and_clear_pending_msg_events_meth);
5520 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
5521 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5522 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_events_meth);
5523 LDKCVec_MessageSendEventZ ret_constr;
5524 ret_constr.datalen = *((uint32_t*)ret);
5525 if (ret_constr.datalen > 0)
5526 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5528 ret_constr.data = NULL;
5529 uint32_t* ret_vals = (uint32_t*)(ret + 4);
5530 for (size_t s = 0; s < ret_constr.datalen; s++) {
5531 uint32_t ret_conv_18 = ret_vals[s];
5532 void* ret_conv_18_ptr = (void*)(((uint64_t)ret_conv_18) & ~1);
5533 CHECK_ACCESS(ret_conv_18_ptr);
5534 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
5535 FREE((void*)ret_conv_18);
5536 ret_constr.data[s] = ret_conv_18_conv;
5540 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
5541 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
5542 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5544 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (/*TODO: JS Object Reference */void* o) {
5545 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
5546 atomic_init(&calls->refcnt, 1);
5547 //TODO: Assign calls->o from o
5549 LDKMessageSendEventsProvider ret = {
5550 .this_arg = (void*) calls,
5551 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
5552 .free = LDKMessageSendEventsProvider_JCalls_free,
5556 long __attribute__((visibility("default"))) TS_LDKMessageSendEventsProvider_new(/*TODO: JS Object Reference */void* o) {
5557 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
5558 *res_ptr = LDKMessageSendEventsProvider_init(o);
5559 return (long)res_ptr;
5561 uint32_tArray __attribute__((visibility("default"))) TS_MessageSendEventsProvider_get_and_clear_pending_msg_events(uint32_t this_arg) {
5562 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5563 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5564 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
5565 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
5566 uint32_tArray ret_arr = NULL;
5567 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5568 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
5569 for (size_t s = 0; s < ret_var.datalen; s++) {
5570 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
5571 *ret_conv_18_copy = ret_var.data[s];
5572 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
5573 ret_arr_ptr[s] = ret_conv_18_ref;
5580 typedef struct LDKEventHandler_JCalls {
5581 atomic_size_t refcnt;
5582 uint32_t handle_event_meth;
5583 } LDKEventHandler_JCalls;
5584 static void LDKEventHandler_JCalls_free(void* this_arg) {
5585 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
5586 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5587 js_free(j_calls->handle_event_meth);
5591 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
5592 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
5593 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
5594 *ret_event = Event_clone(event);
5595 js_invoke_function_1(j_calls->handle_event_meth, (uint64_t)ret_event);
5597 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
5598 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
5599 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5601 static inline LDKEventHandler LDKEventHandler_init (/*TODO: JS Object Reference */void* o) {
5602 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
5603 atomic_init(&calls->refcnt, 1);
5604 //TODO: Assign calls->o from o
5606 LDKEventHandler ret = {
5607 .this_arg = (void*) calls,
5608 .handle_event = handle_event_LDKEventHandler_jcall,
5609 .free = LDKEventHandler_JCalls_free,
5613 long __attribute__((visibility("default"))) TS_LDKEventHandler_new(/*TODO: JS Object Reference */void* o) {
5614 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
5615 *res_ptr = LDKEventHandler_init(o);
5616 return (long)res_ptr;
5618 void __attribute__((visibility("default"))) TS_EventHandler_handle_event(uint32_t this_arg, uint32_t event) {
5619 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5620 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5621 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
5622 LDKEvent* event_conv = (LDKEvent*)event;
5623 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
5626 typedef struct LDKEventsProvider_JCalls {
5627 atomic_size_t refcnt;
5628 uint32_t process_pending_events_meth;
5629 } LDKEventsProvider_JCalls;
5630 static void LDKEventsProvider_JCalls_free(void* this_arg) {
5631 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
5632 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5633 js_free(j_calls->process_pending_events_meth);
5637 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
5638 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
5639 LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
5640 *handler_ret = handler;
5641 js_invoke_function_1(j_calls->process_pending_events_meth, (uint64_t)handler_ret);
5643 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
5644 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
5645 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5647 static inline LDKEventsProvider LDKEventsProvider_init (/*TODO: JS Object Reference */void* o) {
5648 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
5649 atomic_init(&calls->refcnt, 1);
5650 //TODO: Assign calls->o from o
5652 LDKEventsProvider ret = {
5653 .this_arg = (void*) calls,
5654 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
5655 .free = LDKEventsProvider_JCalls_free,
5659 long __attribute__((visibility("default"))) TS_LDKEventsProvider_new(/*TODO: JS Object Reference */void* o) {
5660 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
5661 *res_ptr = LDKEventsProvider_init(o);
5662 return (long)res_ptr;
5664 void __attribute__((visibility("default"))) TS_EventsProvider_process_pending_events(uint32_t this_arg, uint32_t handler) {
5665 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5666 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5667 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
5668 void* handler_ptr = (void*)(((uint64_t)handler) & ~1);
5669 CHECK_ACCESS(handler_ptr);
5670 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
5671 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
5674 typedef struct LDKListen_JCalls {
5675 atomic_size_t refcnt;
5676 uint32_t block_connected_meth;
5677 uint32_t block_disconnected_meth;
5679 static void LDKListen_JCalls_free(void* this_arg) {
5680 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
5681 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5682 js_free(j_calls->block_connected_meth);
5683 js_free(j_calls->block_disconnected_meth);
5687 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
5688 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
5689 LDKu8slice block_var = block;
5690 int8_tArray block_arr = init_arr(block_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5691 memcpy((uint8_t*)(block_arr + 4), block_var.data, block_var.datalen);
5692 js_invoke_function_2(j_calls->block_connected_meth, block_arr, height);
5694 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
5695 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
5696 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5697 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5698 js_invoke_function_2(j_calls->block_disconnected_meth, header_arr, height);
5700 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
5701 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
5702 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5704 static inline LDKListen LDKListen_init (/*TODO: JS Object Reference */void* o) {
5705 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
5706 atomic_init(&calls->refcnt, 1);
5707 //TODO: Assign calls->o from o
5710 .this_arg = (void*) calls,
5711 .block_connected = block_connected_LDKListen_jcall,
5712 .block_disconnected = block_disconnected_LDKListen_jcall,
5713 .free = LDKListen_JCalls_free,
5717 long __attribute__((visibility("default"))) TS_LDKListen_new(/*TODO: JS Object Reference */void* o) {
5718 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
5719 *res_ptr = LDKListen_init(o);
5720 return (long)res_ptr;
5722 void __attribute__((visibility("default"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
5723 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5724 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5725 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
5726 LDKu8slice block_ref;
5727 block_ref.datalen = *((uint32_t*)block);
5728 block_ref.data = (int8_t*)(block + 4);
5729 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
5732 void __attribute__((visibility("default"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
5733 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5734 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5735 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
5736 unsigned char header_arr[80];
5737 CHECK(*((uint32_t*)header) == 80);
5738 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5739 unsigned char (*header_ref)[80] = &header_arr;
5740 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
5743 typedef struct LDKConfirm_JCalls {
5744 atomic_size_t refcnt;
5745 uint32_t transactions_confirmed_meth;
5746 uint32_t transaction_unconfirmed_meth;
5747 uint32_t best_block_updated_meth;
5748 uint32_t get_relevant_txids_meth;
5749 } LDKConfirm_JCalls;
5750 static void LDKConfirm_JCalls_free(void* this_arg) {
5751 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5752 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5753 js_free(j_calls->transactions_confirmed_meth);
5754 js_free(j_calls->transaction_unconfirmed_meth);
5755 js_free(j_calls->best_block_updated_meth);
5756 js_free(j_calls->get_relevant_txids_meth);
5760 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
5761 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5762 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5763 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5764 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
5765 uint32_tArray txdata_arr = NULL;
5766 txdata_arr = init_arr(txdata_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5767 uint32_t *txdata_arr_ptr = (uint32_t*)(txdata_arr + 4);
5768 for (size_t c = 0; c < txdata_var.datalen; c++) {
5769 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5770 *txdata_conv_28_conv = txdata_var.data[c];
5771 txdata_arr_ptr[c] = ((uint64_t)txdata_conv_28_conv);
5774 FREE(txdata_var.data);
5775 js_invoke_function_3(j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
5777 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
5778 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5779 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5780 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
5781 js_invoke_function_1(j_calls->transaction_unconfirmed_meth, txid_arr);
5783 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
5784 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5785 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5786 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5787 js_invoke_function_2(j_calls->best_block_updated_meth, header_arr, height);
5789 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
5790 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5791 ptrArray ret = js_invoke_function_0(j_calls->get_relevant_txids_meth);
5792 LDKCVec_TxidZ ret_constr;
5793 ret_constr.datalen = *((uint32_t*)ret);
5794 if (ret_constr.datalen > 0)
5795 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
5797 ret_constr.data = NULL;
5798 int8_tArray* ret_vals = (int8_tArray*)(ret + 4);
5799 for (size_t m = 0; m < ret_constr.datalen; m++) {
5800 int8_tArray ret_conv_12 = ret_vals[m];
5801 LDKThirtyTwoBytes ret_conv_12_ref;
5802 CHECK(*((uint32_t*)ret_conv_12) == 32);
5803 memcpy(ret_conv_12_ref.data, (uint8_t*)(ret_conv_12 + 4), 32);
5804 ret_constr.data[m] = ret_conv_12_ref;
5808 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
5809 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
5810 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5812 static inline LDKConfirm LDKConfirm_init (/*TODO: JS Object Reference */void* o) {
5813 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
5814 atomic_init(&calls->refcnt, 1);
5815 //TODO: Assign calls->o from o
5818 .this_arg = (void*) calls,
5819 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
5820 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
5821 .best_block_updated = best_block_updated_LDKConfirm_jcall,
5822 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
5823 .free = LDKConfirm_JCalls_free,
5827 long __attribute__((visibility("default"))) TS_LDKConfirm_new(/*TODO: JS Object Reference */void* o) {
5828 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
5829 *res_ptr = LDKConfirm_init(o);
5830 return (long)res_ptr;
5832 void __attribute__((visibility("default"))) TS_Confirm_transactions_confirmed(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
5833 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5834 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5835 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
5836 unsigned char header_arr[80];
5837 CHECK(*((uint32_t*)header) == 80);
5838 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5839 unsigned char (*header_ref)[80] = &header_arr;
5840 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
5841 txdata_constr.datalen = *((uint32_t*)txdata);
5842 if (txdata_constr.datalen > 0)
5843 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5845 txdata_constr.data = NULL;
5846 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
5847 for (size_t c = 0; c < txdata_constr.datalen; c++) {
5848 uint32_t txdata_conv_28 = txdata_vals[c];
5849 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
5850 CHECK_ACCESS(txdata_conv_28_ptr);
5851 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
5852 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
5853 txdata_constr.data[c] = txdata_conv_28_conv;
5855 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
5858 void __attribute__((visibility("default"))) TS_Confirm_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid) {
5859 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5860 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5861 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
5862 unsigned char txid_arr[32];
5863 CHECK(*((uint32_t*)txid) == 32);
5864 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
5865 unsigned char (*txid_ref)[32] = &txid_arr;
5866 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
5869 void __attribute__((visibility("default"))) TS_Confirm_best_block_updated(uint32_t this_arg, int8_tArray header, int32_t height) {
5870 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5871 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5872 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
5873 unsigned char header_arr[80];
5874 CHECK(*((uint32_t*)header) == 80);
5875 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5876 unsigned char (*header_ref)[80] = &header_arr;
5877 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
5880 ptrArray __attribute__((visibility("default"))) TS_Confirm_get_relevant_txids(uint32_t this_arg) {
5881 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5882 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5883 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
5884 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
5885 ptrArray ret_arr = NULL;
5886 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
5887 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
5888 for (size_t m = 0; m < ret_var.datalen; m++) {
5889 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5890 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
5891 ret_arr_ptr[m] = ret_conv_12_arr;
5898 typedef struct LDKPersist_JCalls {
5899 atomic_size_t refcnt;
5900 uint32_t persist_new_channel_meth;
5901 uint32_t update_persisted_channel_meth;
5902 } LDKPersist_JCalls;
5903 static void LDKPersist_JCalls_free(void* this_arg) {
5904 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5905 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5906 js_free(j_calls->persist_new_channel_meth);
5907 js_free(j_calls->update_persisted_channel_meth);
5911 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
5912 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5913 LDKOutPoint channel_id_var = channel_id;
5914 uint64_t channel_id_ref = 0;
5915 CHECK((((uint64_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5916 CHECK((((uint64_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5917 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
5918 channel_id_ref = (uint64_t)channel_id_var.inner;
5919 if (channel_id_var.is_owned) {
5920 channel_id_ref |= 1;
5922 LDKChannelMonitor data_var = *data;
5923 uint64_t data_ref = 0;
5924 data_var = ChannelMonitor_clone(data);
5925 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5926 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5927 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
5928 data_ref = (uint64_t)data_var.inner;
5929 if (data_var.is_owned) {
5932 LDKMonitorUpdateId update_id_var = update_id;
5933 uint64_t update_id_ref = 0;
5934 CHECK((((uint64_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5935 CHECK((((uint64_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5936 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
5937 update_id_ref = (uint64_t)update_id_var.inner;
5938 if (update_id_var.is_owned) {
5941 uint32_t ret = js_invoke_function_3(j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
5942 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
5943 CHECK_ACCESS(ret_ptr);
5944 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5948 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
5949 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5950 LDKOutPoint channel_id_var = channel_id;
5951 uint64_t channel_id_ref = 0;
5952 CHECK((((uint64_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5953 CHECK((((uint64_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5954 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
5955 channel_id_ref = (uint64_t)channel_id_var.inner;
5956 if (channel_id_var.is_owned) {
5957 channel_id_ref |= 1;
5959 LDKChannelMonitorUpdate update_var = *update;
5960 uint64_t update_ref = 0;
5961 if ((uint64_t)update_var.inner > 4096) {
5962 update_var = ChannelMonitorUpdate_clone(update);
5963 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5964 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5965 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
5966 update_ref = (uint64_t)update_var.inner;
5967 if (update_var.is_owned) {
5971 LDKChannelMonitor data_var = *data;
5972 uint64_t data_ref = 0;
5973 data_var = ChannelMonitor_clone(data);
5974 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5975 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5976 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
5977 data_ref = (uint64_t)data_var.inner;
5978 if (data_var.is_owned) {
5981 LDKMonitorUpdateId update_id_var = update_id;
5982 uint64_t update_id_ref = 0;
5983 CHECK((((uint64_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5984 CHECK((((uint64_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5985 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
5986 update_id_ref = (uint64_t)update_id_var.inner;
5987 if (update_id_var.is_owned) {
5990 uint32_t ret = js_invoke_function_4(j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
5991 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
5992 CHECK_ACCESS(ret_ptr);
5993 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5997 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
5998 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
5999 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6001 static inline LDKPersist LDKPersist_init (/*TODO: JS Object Reference */void* o) {
6002 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
6003 atomic_init(&calls->refcnt, 1);
6004 //TODO: Assign calls->o from o
6007 .this_arg = (void*) calls,
6008 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
6009 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
6010 .free = LDKPersist_JCalls_free,
6014 long __attribute__((visibility("default"))) TS_LDKPersist_new(/*TODO: JS Object Reference */void* o) {
6015 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
6016 *res_ptr = LDKPersist_init(o);
6017 return (long)res_ptr;
6019 uint32_t __attribute__((visibility("default"))) TS_Persist_persist_new_channel(uint32_t this_arg, uint32_t channel_id, uint32_t data, uint32_t update_id) {
6020 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6021 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6022 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
6023 LDKOutPoint channel_id_conv;
6024 channel_id_conv.inner = (void*)(channel_id & (~1));
6025 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
6026 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
6027 channel_id_conv = OutPoint_clone(&channel_id_conv);
6028 LDKChannelMonitor data_conv;
6029 data_conv.inner = (void*)(data & (~1));
6030 data_conv.is_owned = false;
6031 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
6032 LDKMonitorUpdateId update_id_conv;
6033 update_id_conv.inner = (void*)(update_id & (~1));
6034 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
6035 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
6036 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
6037 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6038 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
6039 return (uint64_t)ret_conv;
6042 uint32_t __attribute__((visibility("default"))) TS_Persist_update_persisted_channel(uint32_t this_arg, uint32_t channel_id, uint32_t update, uint32_t data, uint32_t update_id) {
6043 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6044 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6045 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
6046 LDKOutPoint channel_id_conv;
6047 channel_id_conv.inner = (void*)(channel_id & (~1));
6048 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
6049 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
6050 channel_id_conv = OutPoint_clone(&channel_id_conv);
6051 LDKChannelMonitorUpdate update_conv;
6052 update_conv.inner = (void*)(update & (~1));
6053 update_conv.is_owned = false;
6054 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
6055 LDKChannelMonitor data_conv;
6056 data_conv.inner = (void*)(data & (~1));
6057 data_conv.is_owned = false;
6058 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
6059 LDKMonitorUpdateId update_id_conv;
6060 update_id_conv.inner = (void*)(update_id & (~1));
6061 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
6062 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
6063 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
6064 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6065 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
6066 return (uint64_t)ret_conv;
6069 typedef struct LDKChannelMessageHandler_JCalls {
6070 atomic_size_t refcnt;
6071 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
6072 uint32_t handle_open_channel_meth;
6073 uint32_t handle_accept_channel_meth;
6074 uint32_t handle_funding_created_meth;
6075 uint32_t handle_funding_signed_meth;
6076 uint32_t handle_funding_locked_meth;
6077 uint32_t handle_shutdown_meth;
6078 uint32_t handle_closing_signed_meth;
6079 uint32_t handle_update_add_htlc_meth;
6080 uint32_t handle_update_fulfill_htlc_meth;
6081 uint32_t handle_update_fail_htlc_meth;
6082 uint32_t handle_update_fail_malformed_htlc_meth;
6083 uint32_t handle_commitment_signed_meth;
6084 uint32_t handle_revoke_and_ack_meth;
6085 uint32_t handle_update_fee_meth;
6086 uint32_t handle_announcement_signatures_meth;
6087 uint32_t peer_disconnected_meth;
6088 uint32_t peer_connected_meth;
6089 uint32_t handle_channel_reestablish_meth;
6090 uint32_t handle_channel_update_meth;
6091 uint32_t handle_error_meth;
6092 } LDKChannelMessageHandler_JCalls;
6093 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
6094 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6095 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6096 js_free(j_calls->handle_open_channel_meth);
6097 js_free(j_calls->handle_accept_channel_meth);
6098 js_free(j_calls->handle_funding_created_meth);
6099 js_free(j_calls->handle_funding_signed_meth);
6100 js_free(j_calls->handle_funding_locked_meth);
6101 js_free(j_calls->handle_shutdown_meth);
6102 js_free(j_calls->handle_closing_signed_meth);
6103 js_free(j_calls->handle_update_add_htlc_meth);
6104 js_free(j_calls->handle_update_fulfill_htlc_meth);
6105 js_free(j_calls->handle_update_fail_htlc_meth);
6106 js_free(j_calls->handle_update_fail_malformed_htlc_meth);
6107 js_free(j_calls->handle_commitment_signed_meth);
6108 js_free(j_calls->handle_revoke_and_ack_meth);
6109 js_free(j_calls->handle_update_fee_meth);
6110 js_free(j_calls->handle_announcement_signatures_meth);
6111 js_free(j_calls->peer_disconnected_meth);
6112 js_free(j_calls->peer_connected_meth);
6113 js_free(j_calls->handle_channel_reestablish_meth);
6114 js_free(j_calls->handle_channel_update_meth);
6115 js_free(j_calls->handle_error_meth);
6119 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
6120 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6121 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6122 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6123 LDKInitFeatures their_features_var = their_features;
6124 uint64_t their_features_ref = 0;
6125 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6126 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6127 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
6128 their_features_ref = (uint64_t)their_features_var.inner;
6129 if (their_features_var.is_owned) {
6130 their_features_ref |= 1;
6132 LDKOpenChannel msg_var = *msg;
6133 uint64_t msg_ref = 0;
6134 msg_var = OpenChannel_clone(msg);
6135 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6136 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6137 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6138 msg_ref = (uint64_t)msg_var.inner;
6139 if (msg_var.is_owned) {
6142 js_invoke_function_3(j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
6144 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
6145 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6146 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6147 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6148 LDKInitFeatures their_features_var = their_features;
6149 uint64_t their_features_ref = 0;
6150 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6151 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6152 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
6153 their_features_ref = (uint64_t)their_features_var.inner;
6154 if (their_features_var.is_owned) {
6155 their_features_ref |= 1;
6157 LDKAcceptChannel msg_var = *msg;
6158 uint64_t msg_ref = 0;
6159 msg_var = AcceptChannel_clone(msg);
6160 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6161 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6162 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6163 msg_ref = (uint64_t)msg_var.inner;
6164 if (msg_var.is_owned) {
6167 js_invoke_function_3(j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
6169 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
6170 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6171 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6172 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6173 LDKFundingCreated msg_var = *msg;
6174 uint64_t msg_ref = 0;
6175 msg_var = FundingCreated_clone(msg);
6176 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6177 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6178 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6179 msg_ref = (uint64_t)msg_var.inner;
6180 if (msg_var.is_owned) {
6183 js_invoke_function_2(j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
6185 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
6186 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6187 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6188 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6189 LDKFundingSigned msg_var = *msg;
6190 uint64_t msg_ref = 0;
6191 msg_var = FundingSigned_clone(msg);
6192 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6193 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6194 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6195 msg_ref = (uint64_t)msg_var.inner;
6196 if (msg_var.is_owned) {
6199 js_invoke_function_2(j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
6201 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
6202 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6203 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6204 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6205 LDKFundingLocked msg_var = *msg;
6206 uint64_t msg_ref = 0;
6207 msg_var = FundingLocked_clone(msg);
6208 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6209 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6210 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6211 msg_ref = (uint64_t)msg_var.inner;
6212 if (msg_var.is_owned) {
6215 js_invoke_function_2(j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
6217 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
6218 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6219 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6220 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6221 LDKInitFeatures their_features_var = *their_features;
6222 uint64_t their_features_ref = 0;
6223 their_features_var = InitFeatures_clone(their_features);
6224 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6225 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6226 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
6227 their_features_ref = (uint64_t)their_features_var.inner;
6228 if (their_features_var.is_owned) {
6229 their_features_ref |= 1;
6231 LDKShutdown msg_var = *msg;
6232 uint64_t msg_ref = 0;
6233 msg_var = Shutdown_clone(msg);
6234 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6235 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6236 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6237 msg_ref = (uint64_t)msg_var.inner;
6238 if (msg_var.is_owned) {
6241 js_invoke_function_3(j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
6243 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
6244 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6245 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6246 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6247 LDKClosingSigned msg_var = *msg;
6248 uint64_t msg_ref = 0;
6249 msg_var = ClosingSigned_clone(msg);
6250 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6251 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6252 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6253 msg_ref = (uint64_t)msg_var.inner;
6254 if (msg_var.is_owned) {
6257 js_invoke_function_2(j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
6259 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
6260 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6261 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6262 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6263 LDKUpdateAddHTLC msg_var = *msg;
6264 uint64_t msg_ref = 0;
6265 msg_var = UpdateAddHTLC_clone(msg);
6266 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6267 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6268 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6269 msg_ref = (uint64_t)msg_var.inner;
6270 if (msg_var.is_owned) {
6273 js_invoke_function_2(j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
6275 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
6276 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6277 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6278 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6279 LDKUpdateFulfillHTLC msg_var = *msg;
6280 uint64_t msg_ref = 0;
6281 msg_var = UpdateFulfillHTLC_clone(msg);
6282 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6283 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6284 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6285 msg_ref = (uint64_t)msg_var.inner;
6286 if (msg_var.is_owned) {
6289 js_invoke_function_2(j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
6291 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
6292 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6293 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6294 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6295 LDKUpdateFailHTLC msg_var = *msg;
6296 uint64_t msg_ref = 0;
6297 msg_var = UpdateFailHTLC_clone(msg);
6298 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6299 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6300 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6301 msg_ref = (uint64_t)msg_var.inner;
6302 if (msg_var.is_owned) {
6305 js_invoke_function_2(j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
6307 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
6308 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6309 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6310 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6311 LDKUpdateFailMalformedHTLC msg_var = *msg;
6312 uint64_t msg_ref = 0;
6313 msg_var = UpdateFailMalformedHTLC_clone(msg);
6314 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6315 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6316 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6317 msg_ref = (uint64_t)msg_var.inner;
6318 if (msg_var.is_owned) {
6321 js_invoke_function_2(j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
6323 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
6324 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6325 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6326 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6327 LDKCommitmentSigned msg_var = *msg;
6328 uint64_t msg_ref = 0;
6329 msg_var = CommitmentSigned_clone(msg);
6330 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6331 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6332 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6333 msg_ref = (uint64_t)msg_var.inner;
6334 if (msg_var.is_owned) {
6337 js_invoke_function_2(j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
6339 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
6340 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6341 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6342 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6343 LDKRevokeAndACK msg_var = *msg;
6344 uint64_t msg_ref = 0;
6345 msg_var = RevokeAndACK_clone(msg);
6346 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6347 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6348 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6349 msg_ref = (uint64_t)msg_var.inner;
6350 if (msg_var.is_owned) {
6353 js_invoke_function_2(j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
6355 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
6356 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6357 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6358 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6359 LDKUpdateFee msg_var = *msg;
6360 uint64_t msg_ref = 0;
6361 msg_var = UpdateFee_clone(msg);
6362 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6363 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6364 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6365 msg_ref = (uint64_t)msg_var.inner;
6366 if (msg_var.is_owned) {
6369 js_invoke_function_2(j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
6371 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
6372 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6373 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6374 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6375 LDKAnnouncementSignatures msg_var = *msg;
6376 uint64_t msg_ref = 0;
6377 msg_var = AnnouncementSignatures_clone(msg);
6378 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6379 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6380 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6381 msg_ref = (uint64_t)msg_var.inner;
6382 if (msg_var.is_owned) {
6385 js_invoke_function_2(j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
6387 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
6388 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6389 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6390 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6391 js_invoke_function_2(j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
6393 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
6394 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6395 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6396 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6397 LDKInit msg_var = *msg;
6398 uint64_t msg_ref = 0;
6399 msg_var = Init_clone(msg);
6400 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6401 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6402 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6403 msg_ref = (uint64_t)msg_var.inner;
6404 if (msg_var.is_owned) {
6407 js_invoke_function_2(j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
6409 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
6410 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6411 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6412 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6413 LDKChannelReestablish msg_var = *msg;
6414 uint64_t msg_ref = 0;
6415 msg_var = ChannelReestablish_clone(msg);
6416 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6417 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6418 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6419 msg_ref = (uint64_t)msg_var.inner;
6420 if (msg_var.is_owned) {
6423 js_invoke_function_2(j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
6425 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
6426 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6427 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6428 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6429 LDKChannelUpdate msg_var = *msg;
6430 uint64_t msg_ref = 0;
6431 msg_var = ChannelUpdate_clone(msg);
6432 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6433 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6434 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6435 msg_ref = (uint64_t)msg_var.inner;
6436 if (msg_var.is_owned) {
6439 js_invoke_function_2(j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
6441 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
6442 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6443 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6444 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6445 LDKErrorMessage msg_var = *msg;
6446 uint64_t msg_ref = 0;
6447 msg_var = ErrorMessage_clone(msg);
6448 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6449 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6450 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6451 msg_ref = (uint64_t)msg_var.inner;
6452 if (msg_var.is_owned) {
6455 js_invoke_function_2(j_calls->handle_error_meth, their_node_id_arr, msg_ref);
6457 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
6458 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
6459 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6460 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
6462 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
6463 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
6464 atomic_init(&calls->refcnt, 1);
6465 //TODO: Assign calls->o from o
6467 LDKChannelMessageHandler ret = {
6468 .this_arg = (void*) calls,
6469 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
6470 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
6471 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
6472 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
6473 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
6474 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
6475 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
6476 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
6477 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
6478 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
6479 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
6480 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
6481 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
6482 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
6483 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
6484 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
6485 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
6486 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
6487 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
6488 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
6489 .free = LDKChannelMessageHandler_JCalls_free,
6490 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
6492 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
6495 long __attribute__((visibility("default"))) TS_LDKChannelMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
6496 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
6497 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
6498 return (long)res_ptr;
6500 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_open_channel(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
6501 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6502 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6503 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6504 LDKPublicKey their_node_id_ref;
6505 CHECK(*((uint32_t*)their_node_id) == 33);
6506 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6507 LDKInitFeatures their_features_conv;
6508 their_features_conv.inner = (void*)(their_features & (~1));
6509 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
6510 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
6511 their_features_conv = InitFeatures_clone(&their_features_conv);
6512 LDKOpenChannel msg_conv;
6513 msg_conv.inner = (void*)(msg & (~1));
6514 msg_conv.is_owned = false;
6515 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6516 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
6519 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_accept_channel(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
6520 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6521 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6522 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6523 LDKPublicKey their_node_id_ref;
6524 CHECK(*((uint32_t*)their_node_id) == 33);
6525 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6526 LDKInitFeatures their_features_conv;
6527 their_features_conv.inner = (void*)(their_features & (~1));
6528 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
6529 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
6530 their_features_conv = InitFeatures_clone(&their_features_conv);
6531 LDKAcceptChannel msg_conv;
6532 msg_conv.inner = (void*)(msg & (~1));
6533 msg_conv.is_owned = false;
6534 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6535 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
6538 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_created(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6539 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6540 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6541 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6542 LDKPublicKey their_node_id_ref;
6543 CHECK(*((uint32_t*)their_node_id) == 33);
6544 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6545 LDKFundingCreated msg_conv;
6546 msg_conv.inner = (void*)(msg & (~1));
6547 msg_conv.is_owned = false;
6548 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6549 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6552 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6553 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6554 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6555 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6556 LDKPublicKey their_node_id_ref;
6557 CHECK(*((uint32_t*)their_node_id) == 33);
6558 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6559 LDKFundingSigned msg_conv;
6560 msg_conv.inner = (void*)(msg & (~1));
6561 msg_conv.is_owned = false;
6562 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6563 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6566 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_locked(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6567 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6568 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6569 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6570 LDKPublicKey their_node_id_ref;
6571 CHECK(*((uint32_t*)their_node_id) == 33);
6572 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6573 LDKFundingLocked msg_conv;
6574 msg_conv.inner = (void*)(msg & (~1));
6575 msg_conv.is_owned = false;
6576 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6577 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6580 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_shutdown(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
6581 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6582 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6583 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6584 LDKPublicKey their_node_id_ref;
6585 CHECK(*((uint32_t*)their_node_id) == 33);
6586 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6587 LDKInitFeatures their_features_conv;
6588 their_features_conv.inner = (void*)(their_features & (~1));
6589 their_features_conv.is_owned = false;
6590 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
6591 LDKShutdown msg_conv;
6592 msg_conv.inner = (void*)(msg & (~1));
6593 msg_conv.is_owned = false;
6594 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6595 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
6598 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_closing_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6599 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6600 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6601 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6602 LDKPublicKey their_node_id_ref;
6603 CHECK(*((uint32_t*)their_node_id) == 33);
6604 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6605 LDKClosingSigned msg_conv;
6606 msg_conv.inner = (void*)(msg & (~1));
6607 msg_conv.is_owned = false;
6608 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6609 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6612 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_add_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6613 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6614 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6615 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6616 LDKPublicKey their_node_id_ref;
6617 CHECK(*((uint32_t*)their_node_id) == 33);
6618 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6619 LDKUpdateAddHTLC msg_conv;
6620 msg_conv.inner = (void*)(msg & (~1));
6621 msg_conv.is_owned = false;
6622 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6623 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6626 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fulfill_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6627 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6628 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6629 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6630 LDKPublicKey their_node_id_ref;
6631 CHECK(*((uint32_t*)their_node_id) == 33);
6632 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6633 LDKUpdateFulfillHTLC msg_conv;
6634 msg_conv.inner = (void*)(msg & (~1));
6635 msg_conv.is_owned = false;
6636 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6637 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6640 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6641 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6642 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6643 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6644 LDKPublicKey their_node_id_ref;
6645 CHECK(*((uint32_t*)their_node_id) == 33);
6646 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6647 LDKUpdateFailHTLC msg_conv;
6648 msg_conv.inner = (void*)(msg & (~1));
6649 msg_conv.is_owned = false;
6650 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6651 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6654 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_malformed_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6655 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6656 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6657 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6658 LDKPublicKey their_node_id_ref;
6659 CHECK(*((uint32_t*)their_node_id) == 33);
6660 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6661 LDKUpdateFailMalformedHTLC msg_conv;
6662 msg_conv.inner = (void*)(msg & (~1));
6663 msg_conv.is_owned = false;
6664 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6665 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6668 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_commitment_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6669 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6670 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6671 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6672 LDKPublicKey their_node_id_ref;
6673 CHECK(*((uint32_t*)their_node_id) == 33);
6674 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6675 LDKCommitmentSigned msg_conv;
6676 msg_conv.inner = (void*)(msg & (~1));
6677 msg_conv.is_owned = false;
6678 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6679 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6682 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_revoke_and_ack(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6683 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6684 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6685 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6686 LDKPublicKey their_node_id_ref;
6687 CHECK(*((uint32_t*)their_node_id) == 33);
6688 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6689 LDKRevokeAndACK msg_conv;
6690 msg_conv.inner = (void*)(msg & (~1));
6691 msg_conv.is_owned = false;
6692 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6693 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6696 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fee(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6697 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6698 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6699 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6700 LDKPublicKey their_node_id_ref;
6701 CHECK(*((uint32_t*)their_node_id) == 33);
6702 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6703 LDKUpdateFee msg_conv;
6704 msg_conv.inner = (void*)(msg & (~1));
6705 msg_conv.is_owned = false;
6706 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6707 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6710 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_announcement_signatures(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6711 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6712 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6713 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6714 LDKPublicKey their_node_id_ref;
6715 CHECK(*((uint32_t*)their_node_id) == 33);
6716 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6717 LDKAnnouncementSignatures msg_conv;
6718 msg_conv.inner = (void*)(msg & (~1));
6719 msg_conv.is_owned = false;
6720 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6721 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6724 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_disconnected(uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
6725 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6726 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6727 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6728 LDKPublicKey their_node_id_ref;
6729 CHECK(*((uint32_t*)their_node_id) == 33);
6730 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6731 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
6734 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6735 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6736 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6737 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6738 LDKPublicKey their_node_id_ref;
6739 CHECK(*((uint32_t*)their_node_id) == 33);
6740 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6742 msg_conv.inner = (void*)(msg & (~1));
6743 msg_conv.is_owned = false;
6744 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6745 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6748 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_reestablish(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6749 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6750 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6751 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6752 LDKPublicKey their_node_id_ref;
6753 CHECK(*((uint32_t*)their_node_id) == 33);
6754 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6755 LDKChannelReestablish msg_conv;
6756 msg_conv.inner = (void*)(msg & (~1));
6757 msg_conv.is_owned = false;
6758 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6759 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6762 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_update(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6763 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6764 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6765 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6766 LDKPublicKey their_node_id_ref;
6767 CHECK(*((uint32_t*)their_node_id) == 33);
6768 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6769 LDKChannelUpdate msg_conv;
6770 msg_conv.inner = (void*)(msg & (~1));
6771 msg_conv.is_owned = false;
6772 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6773 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6776 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6777 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6778 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6779 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6780 LDKPublicKey their_node_id_ref;
6781 CHECK(*((uint32_t*)their_node_id) == 33);
6782 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6783 LDKErrorMessage msg_conv;
6784 msg_conv.inner = (void*)(msg & (~1));
6785 msg_conv.is_owned = false;
6786 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6787 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6790 typedef struct LDKRoutingMessageHandler_JCalls {
6791 atomic_size_t refcnt;
6792 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
6793 uint32_t handle_node_announcement_meth;
6794 uint32_t handle_channel_announcement_meth;
6795 uint32_t handle_channel_update_meth;
6796 uint32_t get_next_channel_announcements_meth;
6797 uint32_t get_next_node_announcements_meth;
6798 uint32_t sync_routing_table_meth;
6799 uint32_t handle_reply_channel_range_meth;
6800 uint32_t handle_reply_short_channel_ids_end_meth;
6801 uint32_t handle_query_channel_range_meth;
6802 uint32_t handle_query_short_channel_ids_meth;
6803 } LDKRoutingMessageHandler_JCalls;
6804 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
6805 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6806 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6807 js_free(j_calls->handle_node_announcement_meth);
6808 js_free(j_calls->handle_channel_announcement_meth);
6809 js_free(j_calls->handle_channel_update_meth);
6810 js_free(j_calls->get_next_channel_announcements_meth);
6811 js_free(j_calls->get_next_node_announcements_meth);
6812 js_free(j_calls->sync_routing_table_meth);
6813 js_free(j_calls->handle_reply_channel_range_meth);
6814 js_free(j_calls->handle_reply_short_channel_ids_end_meth);
6815 js_free(j_calls->handle_query_channel_range_meth);
6816 js_free(j_calls->handle_query_short_channel_ids_meth);
6820 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
6821 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6822 LDKNodeAnnouncement msg_var = *msg;
6823 uint64_t msg_ref = 0;
6824 msg_var = NodeAnnouncement_clone(msg);
6825 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6826 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6827 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6828 msg_ref = (uint64_t)msg_var.inner;
6829 if (msg_var.is_owned) {
6832 uint32_t ret = js_invoke_function_1(j_calls->handle_node_announcement_meth, msg_ref);
6833 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6834 CHECK_ACCESS(ret_ptr);
6835 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
6839 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
6840 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6841 LDKChannelAnnouncement msg_var = *msg;
6842 uint64_t msg_ref = 0;
6843 msg_var = ChannelAnnouncement_clone(msg);
6844 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6845 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6846 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6847 msg_ref = (uint64_t)msg_var.inner;
6848 if (msg_var.is_owned) {
6851 uint32_t ret = js_invoke_function_1(j_calls->handle_channel_announcement_meth, msg_ref);
6852 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6853 CHECK_ACCESS(ret_ptr);
6854 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
6858 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
6859 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6860 LDKChannelUpdate msg_var = *msg;
6861 uint64_t msg_ref = 0;
6862 msg_var = ChannelUpdate_clone(msg);
6863 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6864 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6865 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6866 msg_ref = (uint64_t)msg_var.inner;
6867 if (msg_var.is_owned) {
6870 uint32_t ret = js_invoke_function_1(j_calls->handle_channel_update_meth, msg_ref);
6871 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6872 CHECK_ACCESS(ret_ptr);
6873 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
6877 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
6878 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6879 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
6880 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
6881 ret_constr.datalen = *((uint32_t*)ret);
6882 if (ret_constr.datalen > 0)
6883 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
6885 ret_constr.data = NULL;
6886 uint32_t* ret_vals = (uint32_t*)(ret + 4);
6887 for (size_t h = 0; h < ret_constr.datalen; h++) {
6888 uint32_t ret_conv_59 = ret_vals[h];
6889 void* ret_conv_59_ptr = (void*)(((uint64_t)ret_conv_59) & ~1);
6890 CHECK_ACCESS(ret_conv_59_ptr);
6891 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
6892 FREE((void*)ret_conv_59);
6893 ret_constr.data[h] = ret_conv_59_conv;
6897 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
6898 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6899 int8_tArray starting_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6900 memcpy((uint8_t*)(starting_point_arr + 4), starting_point.compressed_form, 33);
6901 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
6902 LDKCVec_NodeAnnouncementZ ret_constr;
6903 ret_constr.datalen = *((uint32_t*)ret);
6904 if (ret_constr.datalen > 0)
6905 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
6907 ret_constr.data = NULL;
6908 uint32_t* ret_vals = (uint32_t*)(ret + 4);
6909 for (size_t s = 0; s < ret_constr.datalen; s++) {
6910 uint32_t ret_conv_18 = ret_vals[s];
6911 LDKNodeAnnouncement ret_conv_18_conv;
6912 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
6913 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
6914 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
6915 ret_constr.data[s] = ret_conv_18_conv;
6919 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
6920 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6921 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6922 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6923 LDKInit init_var = *init;
6924 uint64_t init_ref = 0;
6925 init_var = Init_clone(init);
6926 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6927 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6928 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
6929 init_ref = (uint64_t)init_var.inner;
6930 if (init_var.is_owned) {
6933 js_invoke_function_2(j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
6935 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
6936 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6937 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6938 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6939 LDKReplyChannelRange msg_var = msg;
6940 uint64_t msg_ref = 0;
6941 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6942 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6943 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6944 msg_ref = (uint64_t)msg_var.inner;
6945 if (msg_var.is_owned) {
6948 uint32_t ret = js_invoke_function_2(j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
6949 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6950 CHECK_ACCESS(ret_ptr);
6951 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
6955 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
6956 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6957 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6958 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6959 LDKReplyShortChannelIdsEnd msg_var = msg;
6960 uint64_t msg_ref = 0;
6961 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6962 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6963 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6964 msg_ref = (uint64_t)msg_var.inner;
6965 if (msg_var.is_owned) {
6968 uint32_t ret = js_invoke_function_2(j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
6969 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6970 CHECK_ACCESS(ret_ptr);
6971 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
6975 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
6976 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6977 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6978 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6979 LDKQueryChannelRange msg_var = msg;
6980 uint64_t msg_ref = 0;
6981 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6982 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6983 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6984 msg_ref = (uint64_t)msg_var.inner;
6985 if (msg_var.is_owned) {
6988 uint32_t ret = js_invoke_function_2(j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
6989 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6990 CHECK_ACCESS(ret_ptr);
6991 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
6995 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
6996 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6997 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6998 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6999 LDKQueryShortChannelIds msg_var = msg;
7000 uint64_t msg_ref = 0;
7001 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7002 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7003 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7004 msg_ref = (uint64_t)msg_var.inner;
7005 if (msg_var.is_owned) {
7008 uint32_t ret = js_invoke_function_2(j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
7009 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7010 CHECK_ACCESS(ret_ptr);
7011 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
7015 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
7016 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
7017 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7018 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
7020 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
7021 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
7022 atomic_init(&calls->refcnt, 1);
7023 //TODO: Assign calls->o from o
7025 LDKRoutingMessageHandler ret = {
7026 .this_arg = (void*) calls,
7027 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
7028 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
7029 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
7030 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
7031 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
7032 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
7033 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
7034 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
7035 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
7036 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
7037 .free = LDKRoutingMessageHandler_JCalls_free,
7038 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
7040 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
7043 long __attribute__((visibility("default"))) TS_LDKRoutingMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
7044 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
7045 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
7046 return (long)res_ptr;
7048 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
7049 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7050 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7051 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7052 LDKNodeAnnouncement msg_conv;
7053 msg_conv.inner = (void*)(msg & (~1));
7054 msg_conv.is_owned = false;
7055 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7056 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
7057 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
7058 return (uint64_t)ret_conv;
7061 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
7062 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7063 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7064 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7065 LDKChannelAnnouncement msg_conv;
7066 msg_conv.inner = (void*)(msg & (~1));
7067 msg_conv.is_owned = false;
7068 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7069 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
7070 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
7071 return (uint64_t)ret_conv;
7074 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
7075 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7076 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7077 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7078 LDKChannelUpdate msg_conv;
7079 msg_conv.inner = (void*)(msg & (~1));
7080 msg_conv.is_owned = false;
7081 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7082 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
7083 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
7084 return (uint64_t)ret_conv;
7087 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_channel_announcements(uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
7088 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7089 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7090 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7091 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
7092 uint32_tArray ret_arr = NULL;
7093 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
7094 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
7095 for (size_t h = 0; h < ret_var.datalen; h++) {
7096 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
7097 *ret_conv_59_conv = ret_var.data[h];
7098 ret_arr_ptr[h] = ((uint64_t)ret_conv_59_conv);
7105 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_node_announcements(uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
7106 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7107 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7108 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7109 LDKPublicKey starting_point_ref;
7110 CHECK(*((uint32_t*)starting_point) == 33);
7111 memcpy(starting_point_ref.compressed_form, (uint8_t*)(starting_point + 4), 33);
7112 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
7113 uint32_tArray ret_arr = NULL;
7114 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
7115 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
7116 for (size_t s = 0; s < ret_var.datalen; s++) {
7117 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
7118 uint64_t ret_conv_18_ref = 0;
7119 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7120 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7121 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
7122 ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
7123 if (ret_conv_18_var.is_owned) {
7124 ret_conv_18_ref |= 1;
7126 ret_arr_ptr[s] = ret_conv_18_ref;
7133 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_sync_routing_table(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
7134 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7135 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7136 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7137 LDKPublicKey their_node_id_ref;
7138 CHECK(*((uint32_t*)their_node_id) == 33);
7139 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7141 init_conv.inner = (void*)(init & (~1));
7142 init_conv.is_owned = false;
7143 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
7144 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
7147 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_reply_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7148 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7149 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7150 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7151 LDKPublicKey their_node_id_ref;
7152 CHECK(*((uint32_t*)their_node_id) == 33);
7153 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7154 LDKReplyChannelRange msg_conv;
7155 msg_conv.inner = (void*)(msg & (~1));
7156 msg_conv.is_owned = (msg & 1) || (msg == 0);
7157 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7158 msg_conv = ReplyChannelRange_clone(&msg_conv);
7159 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7160 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7161 return (uint64_t)ret_conv;
7164 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_reply_short_channel_ids_end(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7165 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7166 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7167 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7168 LDKPublicKey their_node_id_ref;
7169 CHECK(*((uint32_t*)their_node_id) == 33);
7170 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7171 LDKReplyShortChannelIdsEnd msg_conv;
7172 msg_conv.inner = (void*)(msg & (~1));
7173 msg_conv.is_owned = (msg & 1) || (msg == 0);
7174 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7175 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
7176 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7177 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7178 return (uint64_t)ret_conv;
7181 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7182 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7183 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7184 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7185 LDKPublicKey their_node_id_ref;
7186 CHECK(*((uint32_t*)their_node_id) == 33);
7187 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7188 LDKQueryChannelRange msg_conv;
7189 msg_conv.inner = (void*)(msg & (~1));
7190 msg_conv.is_owned = (msg & 1) || (msg == 0);
7191 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7192 msg_conv = QueryChannelRange_clone(&msg_conv);
7193 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7194 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7195 return (uint64_t)ret_conv;
7198 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_short_channel_ids(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7199 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7200 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7201 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7202 LDKPublicKey their_node_id_ref;
7203 CHECK(*((uint32_t*)their_node_id) == 33);
7204 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7205 LDKQueryShortChannelIds msg_conv;
7206 msg_conv.inner = (void*)(msg & (~1));
7207 msg_conv.is_owned = (msg & 1) || (msg == 0);
7208 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7209 msg_conv = QueryShortChannelIds_clone(&msg_conv);
7210 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7211 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7212 return (uint64_t)ret_conv;
7215 typedef struct LDKCustomMessageReader_JCalls {
7216 atomic_size_t refcnt;
7218 } LDKCustomMessageReader_JCalls;
7219 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
7220 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
7221 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7222 js_free(j_calls->read_meth);
7226 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
7227 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
7228 LDKu8slice buffer_var = buffer;
7229 int8_tArray buffer_arr = init_arr(buffer_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7230 memcpy((uint8_t*)(buffer_arr + 4), buffer_var.data, buffer_var.datalen);
7231 uint32_t ret = js_invoke_function_2(j_calls->read_meth, message_type, buffer_arr);
7232 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7233 CHECK_ACCESS(ret_ptr);
7234 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
7238 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
7239 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
7240 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7242 static inline LDKCustomMessageReader LDKCustomMessageReader_init (/*TODO: JS Object Reference */void* o) {
7243 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
7244 atomic_init(&calls->refcnt, 1);
7245 //TODO: Assign calls->o from o
7247 LDKCustomMessageReader ret = {
7248 .this_arg = (void*) calls,
7249 .read = read_LDKCustomMessageReader_jcall,
7250 .free = LDKCustomMessageReader_JCalls_free,
7254 long __attribute__((visibility("default"))) TS_LDKCustomMessageReader_new(/*TODO: JS Object Reference */void* o) {
7255 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
7256 *res_ptr = LDKCustomMessageReader_init(o);
7257 return (long)res_ptr;
7259 uint32_t __attribute__((visibility("default"))) TS_CustomMessageReader_read(uint32_t this_arg, int16_t message_type, int8_tArray buffer) {
7260 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7261 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7262 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
7263 LDKu8slice buffer_ref;
7264 buffer_ref.datalen = *((uint32_t*)buffer);
7265 buffer_ref.data = (int8_t*)(buffer + 4);
7266 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
7267 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
7268 return (uint64_t)ret_conv;
7271 typedef struct LDKCustomMessageHandler_JCalls {
7272 atomic_size_t refcnt;
7273 LDKCustomMessageReader_JCalls* CustomMessageReader;
7274 uint32_t handle_custom_message_meth;
7275 uint32_t get_and_clear_pending_msg_meth;
7276 } LDKCustomMessageHandler_JCalls;
7277 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
7278 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
7279 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7280 js_free(j_calls->handle_custom_message_meth);
7281 js_free(j_calls->get_and_clear_pending_msg_meth);
7285 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
7286 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
7287 LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
7289 int8_tArray sender_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
7290 memcpy((uint8_t*)(sender_node_id_arr + 4), sender_node_id.compressed_form, 33);
7291 uint32_t ret = js_invoke_function_2(j_calls->handle_custom_message_meth, (uint64_t)msg_ret, sender_node_id_arr);
7292 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7293 CHECK_ACCESS(ret_ptr);
7294 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
7298 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
7299 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
7300 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_meth);
7301 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
7302 ret_constr.datalen = *((uint32_t*)ret);
7303 if (ret_constr.datalen > 0)
7304 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
7306 ret_constr.data = NULL;
7307 uint32_t* ret_vals = (uint32_t*)(ret + 4);
7308 for (size_t z = 0; z < ret_constr.datalen; z++) {
7309 uint32_t ret_conv_25 = ret_vals[z];
7310 void* ret_conv_25_ptr = (void*)(((uint64_t)ret_conv_25) & ~1);
7311 CHECK_ACCESS(ret_conv_25_ptr);
7312 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
7313 FREE((void*)ret_conv_25);
7314 ret_constr.data[z] = ret_conv_25_conv;
7318 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
7319 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
7320 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7321 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
7323 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* CustomMessageReader) {
7324 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
7325 atomic_init(&calls->refcnt, 1);
7326 //TODO: Assign calls->o from o
7328 LDKCustomMessageHandler ret = {
7329 .this_arg = (void*) calls,
7330 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
7331 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
7332 .free = LDKCustomMessageHandler_JCalls_free,
7333 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
7335 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
7338 long __attribute__((visibility("default"))) TS_LDKCustomMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* CustomMessageReader) {
7339 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
7340 *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
7341 return (long)res_ptr;
7343 uint32_t __attribute__((visibility("default"))) TS_CustomMessageHandler_handle_custom_message(uint32_t this_arg, uint32_t msg, int8_tArray sender_node_id) {
7344 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7345 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7346 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
7347 void* msg_ptr = (void*)(((uint64_t)msg) & ~1);
7348 CHECK_ACCESS(msg_ptr);
7349 LDKType msg_conv = *(LDKType*)(msg_ptr);
7350 LDKPublicKey sender_node_id_ref;
7351 CHECK(*((uint32_t*)sender_node_id) == 33);
7352 memcpy(sender_node_id_ref.compressed_form, (uint8_t*)(sender_node_id + 4), 33);
7353 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7354 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
7355 return (uint64_t)ret_conv;
7358 uint32_tArray __attribute__((visibility("default"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint32_t this_arg) {
7359 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7360 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7361 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
7362 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
7363 uint32_tArray ret_arr = NULL;
7364 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
7365 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
7366 for (size_t z = 0; z < ret_var.datalen; z++) {
7367 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
7368 *ret_conv_25_conv = ret_var.data[z];
7369 ret_arr_ptr[z] = ((uint64_t)ret_conv_25_conv);
7376 typedef struct LDKSocketDescriptor_JCalls {
7377 atomic_size_t refcnt;
7378 uint32_t send_data_meth;
7379 uint32_t disconnect_socket_meth;
7382 } LDKSocketDescriptor_JCalls;
7383 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
7384 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7385 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7386 js_free(j_calls->send_data_meth);
7387 js_free(j_calls->disconnect_socket_meth);
7388 js_free(j_calls->eq_meth);
7389 js_free(j_calls->hash_meth);
7393 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
7394 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7395 LDKu8slice data_var = data;
7396 int8_tArray data_arr = init_arr(data_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7397 memcpy((uint8_t*)(data_arr + 4), data_var.data, data_var.datalen);
7398 return js_invoke_function_2(j_calls->send_data_meth, data_arr, resume_read);
7400 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
7401 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7402 js_invoke_function_0(j_calls->disconnect_socket_meth);
7404 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
7405 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7406 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
7407 *other_arg_clone = SocketDescriptor_clone(other_arg);
7408 return js_invoke_function_1(j_calls->eq_meth, (uint64_t)other_arg_clone);
7410 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
7411 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7412 return js_invoke_function_0(j_calls->hash_meth);
7414 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
7415 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
7416 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7418 static inline LDKSocketDescriptor LDKSocketDescriptor_init (/*TODO: JS Object Reference */void* o) {
7419 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
7420 atomic_init(&calls->refcnt, 1);
7421 //TODO: Assign calls->o from o
7423 LDKSocketDescriptor ret = {
7424 .this_arg = (void*) calls,
7425 .send_data = send_data_LDKSocketDescriptor_jcall,
7426 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
7427 .eq = eq_LDKSocketDescriptor_jcall,
7428 .hash = hash_LDKSocketDescriptor_jcall,
7429 .cloned = LDKSocketDescriptor_JCalls_cloned,
7430 .free = LDKSocketDescriptor_JCalls_free,
7434 long __attribute__((visibility("default"))) TS_LDKSocketDescriptor_new(/*TODO: JS Object Reference */void* o) {
7435 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
7436 *res_ptr = LDKSocketDescriptor_init(o);
7437 return (long)res_ptr;
7439 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
7440 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7441 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7442 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
7443 LDKu8slice data_ref;
7444 data_ref.datalen = *((uint32_t*)data);
7445 data_ref.data = (int8_t*)(data + 4);
7446 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
7450 void __attribute__((visibility("default"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
7451 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7452 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7453 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
7454 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
7457 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
7458 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7459 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7460 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
7461 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
7465 typedef struct LDKScore_JCalls {
7466 atomic_size_t refcnt;
7467 uint32_t channel_penalty_msat_meth;
7468 uint32_t payment_path_failed_meth;
7469 uint32_t payment_path_successful_meth;
7470 uint32_t write_meth;
7472 static void LDKScore_JCalls_free(void* this_arg) {
7473 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7474 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7475 js_free(j_calls->channel_penalty_msat_meth);
7476 js_free(j_calls->payment_path_failed_meth);
7477 js_free(j_calls->payment_path_successful_meth);
7478 js_free(j_calls->write_meth);
7482 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, uint64_t send_amt_msat, LDKCOption_u64Z channel_capacity_msat, const LDKNodeId * source, const LDKNodeId * target) {
7483 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7484 LDKCOption_u64Z *channel_capacity_msat_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
7485 *channel_capacity_msat_copy = channel_capacity_msat;
7486 uint64_t channel_capacity_msat_ref = (uint64_t)channel_capacity_msat_copy;
7487 LDKNodeId source_var = *source;
7488 uint64_t source_ref = 0;
7489 source_var = NodeId_clone(source);
7490 CHECK((((uint64_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7491 CHECK((((uint64_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7492 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
7493 source_ref = (uint64_t)source_var.inner;
7494 if (source_var.is_owned) {
7497 LDKNodeId target_var = *target;
7498 uint64_t target_ref = 0;
7499 target_var = NodeId_clone(target);
7500 CHECK((((uint64_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7501 CHECK((((uint64_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7502 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
7503 target_ref = (uint64_t)target_var.inner;
7504 if (target_var.is_owned) {
7507 return js_invoke_function_5(j_calls->channel_penalty_msat_meth, short_channel_id, send_amt_msat, channel_capacity_msat_ref, source_ref, target_ref);
7509 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
7510 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7511 LDKCVec_RouteHopZ path_var = path;
7512 uint32_tArray path_arr = NULL;
7513 path_arr = init_arr(path_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
7514 uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4);
7515 for (size_t k = 0; k < path_var.datalen; k++) {
7516 LDKRouteHop path_conv_10_var = path_var.data[k];
7517 uint64_t path_conv_10_ref = 0;
7518 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7519 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7520 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
7521 path_conv_10_ref = (uint64_t)path_conv_10_var.inner;
7522 if (path_conv_10_var.is_owned) {
7523 path_conv_10_ref |= 1;
7525 path_arr_ptr[k] = path_conv_10_ref;
7528 FREE(path_var.data);
7529 js_invoke_function_2(j_calls->payment_path_failed_meth, path_arr, short_channel_id);
7531 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
7532 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7533 LDKCVec_RouteHopZ path_var = path;
7534 uint32_tArray path_arr = NULL;
7535 path_arr = init_arr(path_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
7536 uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4);
7537 for (size_t k = 0; k < path_var.datalen; k++) {
7538 LDKRouteHop path_conv_10_var = path_var.data[k];
7539 uint64_t path_conv_10_ref = 0;
7540 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7541 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7542 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
7543 path_conv_10_ref = (uint64_t)path_conv_10_var.inner;
7544 if (path_conv_10_var.is_owned) {
7545 path_conv_10_ref |= 1;
7547 path_arr_ptr[k] = path_conv_10_ref;
7550 FREE(path_var.data);
7551 js_invoke_function_1(j_calls->payment_path_successful_meth, path_arr);
7553 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
7554 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7555 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
7556 LDKCVec_u8Z ret_ref;
7557 ret_ref.datalen = *((uint32_t*)ret);
7558 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
7559 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
7562 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
7563 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
7564 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7566 static inline LDKScore LDKScore_init (/*TODO: JS Object Reference */void* o) {
7567 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
7568 atomic_init(&calls->refcnt, 1);
7569 //TODO: Assign calls->o from o
7572 .this_arg = (void*) calls,
7573 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
7574 .payment_path_failed = payment_path_failed_LDKScore_jcall,
7575 .payment_path_successful = payment_path_successful_LDKScore_jcall,
7576 .write = write_LDKScore_jcall,
7577 .free = LDKScore_JCalls_free,
7581 long __attribute__((visibility("default"))) TS_LDKScore_new(/*TODO: JS Object Reference */void* o) {
7582 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
7583 *res_ptr = LDKScore_init(o);
7584 return (long)res_ptr;
7586 int64_t __attribute__((visibility("default"))) TS_Score_channel_penalty_msat(uint32_t this_arg, int64_t short_channel_id, int64_t send_amt_msat, uint32_t channel_capacity_msat, uint32_t source, uint32_t target) {
7587 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7588 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7589 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
7590 void* channel_capacity_msat_ptr = (void*)(((uint64_t)channel_capacity_msat) & ~1);
7591 CHECK_ACCESS(channel_capacity_msat_ptr);
7592 LDKCOption_u64Z channel_capacity_msat_conv = *(LDKCOption_u64Z*)(channel_capacity_msat_ptr);
7593 channel_capacity_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)channel_capacity_msat) & ~1));
7594 LDKNodeId source_conv;
7595 source_conv.inner = (void*)(source & (~1));
7596 source_conv.is_owned = false;
7597 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
7598 LDKNodeId target_conv;
7599 target_conv.inner = (void*)(target & (~1));
7600 target_conv.is_owned = false;
7601 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
7602 int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, send_amt_msat, channel_capacity_msat_conv, &source_conv, &target_conv);
7606 void __attribute__((visibility("default"))) TS_Score_payment_path_failed(uint32_t this_arg, uint32_tArray path, int64_t short_channel_id) {
7607 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7608 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7609 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
7610 LDKCVec_RouteHopZ path_constr;
7611 path_constr.datalen = *((uint32_t*)path);
7612 if (path_constr.datalen > 0)
7613 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7615 path_constr.data = NULL;
7616 uint32_t* path_vals = (uint32_t*)(path + 4);
7617 for (size_t k = 0; k < path_constr.datalen; k++) {
7618 uint32_t path_conv_10 = path_vals[k];
7619 LDKRouteHop path_conv_10_conv;
7620 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
7621 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
7622 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
7623 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
7624 path_constr.data[k] = path_conv_10_conv;
7626 (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
7629 void __attribute__((visibility("default"))) TS_Score_payment_path_successful(uint32_t this_arg, uint32_tArray path) {
7630 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7631 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7632 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
7633 LDKCVec_RouteHopZ path_constr;
7634 path_constr.datalen = *((uint32_t*)path);
7635 if (path_constr.datalen > 0)
7636 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7638 path_constr.data = NULL;
7639 uint32_t* path_vals = (uint32_t*)(path + 4);
7640 for (size_t k = 0; k < path_constr.datalen; k++) {
7641 uint32_t path_conv_10 = path_vals[k];
7642 LDKRouteHop path_conv_10_conv;
7643 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
7644 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
7645 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
7646 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
7647 path_constr.data[k] = path_conv_10_conv;
7649 (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
7652 int8_tArray __attribute__((visibility("default"))) TS_Score_write(uint32_t this_arg) {
7653 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7654 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7655 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
7656 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
7657 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7658 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
7659 CVec_u8Z_free(ret_var);
7663 typedef struct LDKLockableScore_JCalls {
7664 atomic_size_t refcnt;
7666 } LDKLockableScore_JCalls;
7667 static void LDKLockableScore_JCalls_free(void* this_arg) {
7668 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
7669 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7670 js_free(j_calls->lock_meth);
7674 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
7675 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
7676 uint32_t ret = js_invoke_function_0(j_calls->lock_meth);
7677 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7678 CHECK_ACCESS(ret_ptr);
7679 LDKScore ret_conv = *(LDKScore*)(ret_ptr);// Warning: we may need a move here but no clone is available for LDKScore
7683 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
7684 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
7685 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7687 static inline LDKLockableScore LDKLockableScore_init (/*TODO: JS Object Reference */void* o) {
7688 LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
7689 atomic_init(&calls->refcnt, 1);
7690 //TODO: Assign calls->o from o
7692 LDKLockableScore ret = {
7693 .this_arg = (void*) calls,
7694 .lock = lock_LDKLockableScore_jcall,
7695 .free = LDKLockableScore_JCalls_free,
7699 long __attribute__((visibility("default"))) TS_LDKLockableScore_new(/*TODO: JS Object Reference */void* o) {
7700 LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
7701 *res_ptr = LDKLockableScore_init(o);
7702 return (long)res_ptr;
7704 uint32_t __attribute__((visibility("default"))) TS_LockableScore_lock(uint32_t this_arg) {
7705 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7706 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7707 LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
7708 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
7709 *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
7710 return (uint64_t)ret_ret;
7713 typedef struct LDKChannelManagerPersister_JCalls {
7714 atomic_size_t refcnt;
7715 uint32_t persist_manager_meth;
7716 } LDKChannelManagerPersister_JCalls;
7717 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
7718 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
7719 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7720 js_free(j_calls->persist_manager_meth);
7724 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
7725 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
7726 LDKChannelManager channel_manager_var = *channel_manager;
7727 uint64_t channel_manager_ref = 0;
7728 // Warning: we may need a move here but no clone is available for LDKChannelManager
7729 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7730 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7731 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
7732 channel_manager_ref = (uint64_t)channel_manager_var.inner;
7733 if (channel_manager_var.is_owned) {
7734 channel_manager_ref |= 1;
7736 uint32_t ret = js_invoke_function_1(j_calls->persist_manager_meth, channel_manager_ref);
7737 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7738 CHECK_ACCESS(ret_ptr);
7739 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
7743 static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) {
7744 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg;
7745 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7747 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (/*TODO: JS Object Reference */void* o) {
7748 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
7749 atomic_init(&calls->refcnt, 1);
7750 //TODO: Assign calls->o from o
7752 LDKChannelManagerPersister ret = {
7753 .this_arg = (void*) calls,
7754 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
7755 .free = LDKChannelManagerPersister_JCalls_free,
7759 long __attribute__((visibility("default"))) TS_LDKChannelManagerPersister_new(/*TODO: JS Object Reference */void* o) {
7760 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
7761 *res_ptr = LDKChannelManagerPersister_init(o);
7762 return (long)res_ptr;
7764 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerPersister_persist_manager(uint32_t this_arg, uint32_t channel_manager) {
7765 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7766 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7767 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)this_arg_ptr;
7768 LDKChannelManager channel_manager_conv;
7769 channel_manager_conv.inner = (void*)(channel_manager & (~1));
7770 channel_manager_conv.is_owned = false;
7771 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
7772 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
7773 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
7774 return (uint64_t)ret_conv;
7777 uint32_t __attribute__((visibility("default"))) TS_LDKFallback_ref_from_ptr(uint32_t ptr) {
7778 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
7780 case LDKFallback_SegWitProgram: {
7781 uint8_t version_val = obj->seg_wit_program.version._0;
7782 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
7783 int8_tArray program_arr = init_arr(program_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7784 memcpy((uint8_t*)(program_arr + 4), program_var.data, program_var.datalen);
7785 return 0 /* LDKFallback - SegWitProgram */; (void) version_val; (void) program_arr;
7787 case LDKFallback_PubKeyHash: {
7788 int8_tArray pub_key_hash_arr = init_arr(20, sizeof(uint8_t), "Native int8_tArray Bytes");
7789 memcpy((uint8_t*)(pub_key_hash_arr + 4), obj->pub_key_hash.data, 20);
7790 return 0 /* LDKFallback - PubKeyHash */; (void) pub_key_hash_arr;
7792 case LDKFallback_ScriptHash: {
7793 int8_tArray script_hash_arr = init_arr(20, sizeof(uint8_t), "Native int8_tArray Bytes");
7794 memcpy((uint8_t*)(script_hash_arr + 4), obj->script_hash.data, 20);
7795 return 0 /* LDKFallback - ScriptHash */; (void) script_hash_arr;
7800 typedef struct LDKPayer_JCalls {
7801 atomic_size_t refcnt;
7802 uint32_t node_id_meth;
7803 uint32_t first_hops_meth;
7804 uint32_t send_payment_meth;
7805 uint32_t send_spontaneous_payment_meth;
7806 uint32_t retry_payment_meth;
7807 uint32_t abandon_payment_meth;
7809 static void LDKPayer_JCalls_free(void* this_arg) {
7810 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
7811 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7812 js_free(j_calls->node_id_meth);
7813 js_free(j_calls->first_hops_meth);
7814 js_free(j_calls->send_payment_meth);
7815 js_free(j_calls->send_spontaneous_payment_meth);
7816 js_free(j_calls->retry_payment_meth);
7817 js_free(j_calls->abandon_payment_meth);
7821 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
7822 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
7823 int8_tArray ret = js_invoke_function_0(j_calls->node_id_meth);
7824 LDKPublicKey ret_ref;
7825 CHECK(*((uint32_t*)ret) == 33);
7826 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
7829 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
7830 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
7831 uint32_tArray ret = js_invoke_function_0(j_calls->first_hops_meth);
7832 LDKCVec_ChannelDetailsZ ret_constr;
7833 ret_constr.datalen = *((uint32_t*)ret);
7834 if (ret_constr.datalen > 0)
7835 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7837 ret_constr.data = NULL;
7838 uint32_t* ret_vals = (uint32_t*)(ret + 4);
7839 for (size_t q = 0; q < ret_constr.datalen; q++) {
7840 uint32_t ret_conv_16 = ret_vals[q];
7841 LDKChannelDetails ret_conv_16_conv;
7842 ret_conv_16_conv.inner = (void*)(ret_conv_16 & (~1));
7843 ret_conv_16_conv.is_owned = (ret_conv_16 & 1) || (ret_conv_16 == 0);
7844 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
7845 ret_constr.data[q] = ret_conv_16_conv;
7849 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
7850 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
7851 LDKRoute route_var = *route;
7852 uint64_t route_ref = 0;
7853 route_var = Route_clone(route);
7854 CHECK((((uint64_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7855 CHECK((((uint64_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7856 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
7857 route_ref = (uint64_t)route_var.inner;
7858 if (route_var.is_owned) {
7861 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
7862 memcpy((uint8_t*)(payment_hash_arr + 4), payment_hash.data, 32);
7863 int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
7864 memcpy((uint8_t*)(payment_secret_arr + 4), payment_secret.data, 32);
7865 uint32_t ret = js_invoke_function_3(j_calls->send_payment_meth, route_ref, payment_hash_arr, payment_secret_arr);
7866 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7867 CHECK_ACCESS(ret_ptr);
7868 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
7872 LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) {
7873 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
7874 LDKRoute route_var = *route;
7875 uint64_t route_ref = 0;
7876 route_var = Route_clone(route);
7877 CHECK((((uint64_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7878 CHECK((((uint64_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7879 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
7880 route_ref = (uint64_t)route_var.inner;
7881 if (route_var.is_owned) {
7884 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
7885 memcpy((uint8_t*)(payment_preimage_arr + 4), payment_preimage.data, 32);
7886 uint32_t ret = js_invoke_function_2(j_calls->send_spontaneous_payment_meth, route_ref, payment_preimage_arr);
7887 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7888 CHECK_ACCESS(ret_ptr);
7889 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
7893 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
7894 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
7895 LDKRoute route_var = *route;
7896 uint64_t route_ref = 0;
7897 route_var = Route_clone(route);
7898 CHECK((((uint64_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7899 CHECK((((uint64_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7900 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
7901 route_ref = (uint64_t)route_var.inner;
7902 if (route_var.is_owned) {
7905 int8_tArray payment_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
7906 memcpy((uint8_t*)(payment_id_arr + 4), payment_id.data, 32);
7907 uint32_t ret = js_invoke_function_2(j_calls->retry_payment_meth, route_ref, payment_id_arr);
7908 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7909 CHECK_ACCESS(ret_ptr);
7910 LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
7914 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
7915 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
7916 int8_tArray payment_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
7917 memcpy((uint8_t*)(payment_id_arr + 4), payment_id.data, 32);
7918 js_invoke_function_1(j_calls->abandon_payment_meth, payment_id_arr);
7920 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
7921 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
7922 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7924 static inline LDKPayer LDKPayer_init (/*TODO: JS Object Reference */void* o) {
7925 LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
7926 atomic_init(&calls->refcnt, 1);
7927 //TODO: Assign calls->o from o
7930 .this_arg = (void*) calls,
7931 .node_id = node_id_LDKPayer_jcall,
7932 .first_hops = first_hops_LDKPayer_jcall,
7933 .send_payment = send_payment_LDKPayer_jcall,
7934 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
7935 .retry_payment = retry_payment_LDKPayer_jcall,
7936 .abandon_payment = abandon_payment_LDKPayer_jcall,
7937 .free = LDKPayer_JCalls_free,
7941 long __attribute__((visibility("default"))) TS_LDKPayer_new(/*TODO: JS Object Reference */void* o) {
7942 LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
7943 *res_ptr = LDKPayer_init(o);
7944 return (long)res_ptr;
7946 int8_tArray __attribute__((visibility("default"))) TS_Payer_node_id(uint32_t this_arg) {
7947 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7948 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7949 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
7950 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
7951 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form, 33);
7955 uint32_tArray __attribute__((visibility("default"))) TS_Payer_first_hops(uint32_t this_arg) {
7956 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7957 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7958 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
7959 LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
7960 uint32_tArray ret_arr = NULL;
7961 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
7962 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
7963 for (size_t q = 0; q < ret_var.datalen; q++) {
7964 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
7965 uint64_t ret_conv_16_ref = 0;
7966 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7967 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7968 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
7969 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
7970 if (ret_conv_16_var.is_owned) {
7971 ret_conv_16_ref |= 1;
7973 ret_arr_ptr[q] = ret_conv_16_ref;
7980 uint32_t __attribute__((visibility("default"))) TS_Payer_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
7981 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7982 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7983 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
7984 LDKRoute route_conv;
7985 route_conv.inner = (void*)(route & (~1));
7986 route_conv.is_owned = false;
7987 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
7988 LDKThirtyTwoBytes payment_hash_ref;
7989 CHECK(*((uint32_t*)payment_hash) == 32);
7990 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
7991 LDKThirtyTwoBytes payment_secret_ref;
7992 CHECK(*((uint32_t*)payment_secret) == 32);
7993 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
7994 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
7995 *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
7996 return (uint64_t)ret_conv;
7999 uint32_t __attribute__((visibility("default"))) TS_Payer_send_spontaneous_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_preimage) {
8000 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8001 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8002 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
8003 LDKRoute route_conv;
8004 route_conv.inner = (void*)(route & (~1));
8005 route_conv.is_owned = false;
8006 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
8007 LDKThirtyTwoBytes payment_preimage_ref;
8008 CHECK(*((uint32_t*)payment_preimage) == 32);
8009 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
8010 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
8011 *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref);
8012 return (uint64_t)ret_conv;
8015 uint32_t __attribute__((visibility("default"))) TS_Payer_retry_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_id) {
8016 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8017 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8018 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
8019 LDKRoute route_conv;
8020 route_conv.inner = (void*)(route & (~1));
8021 route_conv.is_owned = false;
8022 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
8023 LDKThirtyTwoBytes payment_id_ref;
8024 CHECK(*((uint32_t*)payment_id) == 32);
8025 memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32);
8026 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8027 *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
8028 return (uint64_t)ret_conv;
8031 void __attribute__((visibility("default"))) TS_Payer_abandon_payment(uint32_t this_arg, int8_tArray payment_id) {
8032 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8033 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8034 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
8035 LDKThirtyTwoBytes payment_id_ref;
8036 CHECK(*((uint32_t*)payment_id) == 32);
8037 memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32);
8038 (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
8041 typedef struct LDKRouter_JCalls {
8042 atomic_size_t refcnt;
8043 uint32_t find_route_meth;
8045 static void LDKRouter_JCalls_free(void* this_arg) {
8046 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
8047 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8048 js_free(j_calls->find_route_meth);
8052 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * params, const uint8_t (* payment_hash)[32], LDKCVec_ChannelDetailsZ * first_hops, const LDKScore * scorer) {
8053 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
8054 int8_tArray payer_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
8055 memcpy((uint8_t*)(payer_arr + 4), payer.compressed_form, 33);
8056 LDKRouteParameters params_var = *params;
8057 uint64_t params_ref = 0;
8058 params_var = RouteParameters_clone(params);
8059 CHECK((((uint64_t)params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8060 CHECK((((uint64_t)¶ms_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8061 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_var);
8062 params_ref = (uint64_t)params_var.inner;
8063 if (params_var.is_owned) {
8066 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
8067 memcpy((uint8_t*)(payment_hash_arr + 4), *payment_hash, 32);
8068 LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
8069 uint32_tArray first_hops_arr = NULL;
8070 if (first_hops != NULL) {
8071 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
8072 first_hops_arr = init_arr(first_hops_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
8073 uint32_t *first_hops_arr_ptr = (uint32_t*)(first_hops_arr + 4);
8074 for (size_t q = 0; q < first_hops_var.datalen; q++) {
8075 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
8076 uint64_t first_hops_conv_16_ref = 0;
8077 CHECK((((uint64_t)first_hops_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8078 CHECK((((uint64_t)&first_hops_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8079 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
8080 first_hops_conv_16_ref = (uint64_t)first_hops_conv_16_var.inner;
8081 if (first_hops_conv_16_var.is_owned) {
8082 first_hops_conv_16_ref |= 1;
8084 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
8088 // WARNING: This object doesn't live past this scope, needs clone!
8089 uint64_t ret_scorer = ((uint64_t)scorer) | 1;
8090 uint32_t ret = js_invoke_function_5(j_calls->find_route_meth, payer_arr, params_ref, payment_hash_arr, first_hops_arr, ret_scorer);
8091 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8092 CHECK_ACCESS(ret_ptr);
8093 LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
8097 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
8098 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
8099 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8101 static inline LDKRouter LDKRouter_init (/*TODO: JS Object Reference */void* o) {
8102 LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
8103 atomic_init(&calls->refcnt, 1);
8104 //TODO: Assign calls->o from o
8107 .this_arg = (void*) calls,
8108 .find_route = find_route_LDKRouter_jcall,
8109 .free = LDKRouter_JCalls_free,
8113 long __attribute__((visibility("default"))) TS_LDKRouter_new(/*TODO: JS Object Reference */void* o) {
8114 LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
8115 *res_ptr = LDKRouter_init(o);
8116 return (long)res_ptr;
8118 uint32_t __attribute__((visibility("default"))) TS_Router_find_route(uint32_t this_arg, int8_tArray payer, uint32_t params, int8_tArray payment_hash, uint32_tArray first_hops, uint32_t scorer) {
8119 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8120 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8121 LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
8122 LDKPublicKey payer_ref;
8123 CHECK(*((uint32_t*)payer) == 33);
8124 memcpy(payer_ref.compressed_form, (uint8_t*)(payer + 4), 33);
8125 LDKRouteParameters params_conv;
8126 params_conv.inner = (void*)(params & (~1));
8127 params_conv.is_owned = false;
8128 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
8129 unsigned char payment_hash_arr[32];
8130 CHECK(*((uint32_t*)payment_hash) == 32);
8131 memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32);
8132 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
8133 LDKCVec_ChannelDetailsZ first_hops_constr;
8134 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
8135 if (first_hops != 0) {
8136 first_hops_constr.datalen = *((uint32_t*)first_hops);
8137 if (first_hops_constr.datalen > 0)
8138 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
8140 first_hops_constr.data = NULL;
8141 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
8142 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
8143 uint32_t first_hops_conv_16 = first_hops_vals[q];
8144 LDKChannelDetails first_hops_conv_16_conv;
8145 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
8146 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
8147 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
8148 first_hops_constr.data[q] = first_hops_conv_16_conv;
8150 first_hops_ptr = &first_hops_constr;
8152 void* scorer_ptr = (void*)(((uint64_t)scorer) & ~1);
8153 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
8154 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
8155 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8156 *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, ¶ms_conv, payment_hash_ref, first_hops_ptr, scorer_conv);
8157 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
8158 return (uint64_t)ret_conv;
8161 jstring __attribute__((visibility("default"))) TS__ldk_get_compiled_version() {
8162 LDKStr ret_str = _ldk_get_compiled_version();
8163 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
8168 jstring __attribute__((visibility("default"))) TS__ldk_c_bindings_get_compiled_version() {
8169 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
8170 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
8175 void __attribute__((visibility("default"))) TS_Transaction_free(int8_tArray _res) {
8176 LDKTransaction _res_ref;
8177 _res_ref.datalen = *((uint32_t*)_res);
8178 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
8179 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
8180 _res_ref.data_is_owned = true;
8181 Transaction_free(_res_ref);
8184 uint32_t __attribute__((visibility("default"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
8185 LDKCVec_u8Z script_pubkey_ref;
8186 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
8187 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
8188 memcpy(script_pubkey_ref.data, (uint8_t*)(script_pubkey + 4), script_pubkey_ref.datalen);
8189 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8190 *ret_ref = TxOut_new(script_pubkey_ref, value);
8191 return (uint64_t)ret_ref;
8194 void __attribute__((visibility("default"))) TS_TxOut_free(uint32_t _res) {
8195 if ((_res & 1) != 0) return;
8196 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8197 CHECK_ACCESS(_res_ptr);
8198 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
8200 TxOut_free(_res_conv);
8203 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
8204 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8205 *ret_ref = TxOut_clone(arg);
8206 return (uint64_t)ret_ref;
8208 int64_t __attribute__((visibility("default"))) TS_TxOut_clone_ptr(uint32_t arg) {
8209 LDKTxOut* arg_conv = (LDKTxOut*)(arg & ~1);
8210 int64_t ret_val = TxOut_clone_ptr(arg_conv);
8214 uint32_t __attribute__((visibility("default"))) TS_TxOut_clone(uint32_t orig) {
8215 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
8216 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8217 *ret_ref = TxOut_clone(orig_conv);
8218 return (uint64_t)ret_ref;
8221 void __attribute__((visibility("default"))) TS_Str_free(jstring _res) {
8222 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
8226 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
8228 CHECK(*((uint32_t*)o) == 32);
8229 memcpy(o_ref.bytes, (uint8_t*)(o + 4), 32);
8230 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
8231 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
8232 return (uint64_t)ret_conv;
8235 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
8236 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
8237 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
8238 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
8239 return (uint64_t)ret_conv;
8242 jboolean __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_is_ok(uint32_t o) {
8243 LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)(o & ~1);
8244 jboolean ret_val = CResult_SecretKeyErrorZ_is_ok(o_conv);
8248 void __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
8249 if ((_res & 1) != 0) return;
8250 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8251 CHECK_ACCESS(_res_ptr);
8252 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
8254 CResult_SecretKeyErrorZ_free(_res_conv);
8257 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
8259 CHECK(*((uint32_t*)o) == 33);
8260 memcpy(o_ref.compressed_form, (uint8_t*)(o + 4), 33);
8261 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8262 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
8263 return (uint64_t)ret_conv;
8266 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
8267 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
8268 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8269 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
8270 return (uint64_t)ret_conv;
8273 jboolean __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_is_ok(uint32_t o) {
8274 LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)(o & ~1);
8275 jboolean ret_val = CResult_PublicKeyErrorZ_is_ok(o_conv);
8279 void __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
8280 if ((_res & 1) != 0) return;
8281 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8282 CHECK_ACCESS(_res_ptr);
8283 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
8285 CResult_PublicKeyErrorZ_free(_res_conv);
8288 static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
8289 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8290 *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
8291 return (uint64_t)ret_conv;
8293 int64_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint32_t arg) {
8294 LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
8295 int64_t ret_val = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
8299 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_clone(uint32_t orig) {
8300 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
8301 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8302 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
8303 return (uint64_t)ret_conv;
8306 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
8307 LDKTxCreationKeys o_conv;
8308 o_conv.inner = (void*)(o & (~1));
8309 o_conv.is_owned = (o & 1) || (o == 0);
8310 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8311 o_conv = TxCreationKeys_clone(&o_conv);
8312 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8313 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
8314 return (uint64_t)ret_conv;
8317 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
8318 LDKDecodeError e_conv;
8319 e_conv.inner = (void*)(e & (~1));
8320 e_conv.is_owned = (e & 1) || (e == 0);
8321 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8322 e_conv = DecodeError_clone(&e_conv);
8323 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8324 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
8325 return (uint64_t)ret_conv;
8328 jboolean __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint32_t o) {
8329 LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(o & ~1);
8330 jboolean ret_val = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
8334 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
8335 if ((_res & 1) != 0) return;
8336 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8337 CHECK_ACCESS(_res_ptr);
8338 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
8340 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
8343 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
8344 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8345 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
8346 return (uint64_t)ret_conv;
8348 int64_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint32_t arg) {
8349 LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
8350 int64_t ret_val = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
8354 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
8355 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
8356 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8357 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
8358 return (uint64_t)ret_conv;
8361 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
8362 LDKChannelPublicKeys o_conv;
8363 o_conv.inner = (void*)(o & (~1));
8364 o_conv.is_owned = (o & 1) || (o == 0);
8365 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8366 o_conv = ChannelPublicKeys_clone(&o_conv);
8367 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8368 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
8369 return (uint64_t)ret_conv;
8372 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
8373 LDKDecodeError e_conv;
8374 e_conv.inner = (void*)(e & (~1));
8375 e_conv.is_owned = (e & 1) || (e == 0);
8376 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8377 e_conv = DecodeError_clone(&e_conv);
8378 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8379 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
8380 return (uint64_t)ret_conv;
8383 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint32_t o) {
8384 LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(o & ~1);
8385 jboolean ret_val = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
8389 void __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
8390 if ((_res & 1) != 0) return;
8391 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8392 CHECK_ACCESS(_res_ptr);
8393 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
8395 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
8398 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
8399 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8400 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
8401 return (uint64_t)ret_conv;
8403 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint32_t arg) {
8404 LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
8405 int64_t ret_val = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
8409 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
8410 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
8411 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8412 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
8413 return (uint64_t)ret_conv;
8416 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
8417 LDKTxCreationKeys o_conv;
8418 o_conv.inner = (void*)(o & (~1));
8419 o_conv.is_owned = (o & 1) || (o == 0);
8420 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8421 o_conv = TxCreationKeys_clone(&o_conv);
8422 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8423 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
8424 return (uint64_t)ret_conv;
8427 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
8428 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
8429 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8430 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
8431 return (uint64_t)ret_conv;
8434 jboolean __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_is_ok(uint32_t o) {
8435 LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)(o & ~1);
8436 jboolean ret_val = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
8440 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
8441 if ((_res & 1) != 0) return;
8442 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8443 CHECK_ACCESS(_res_ptr);
8444 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
8446 CResult_TxCreationKeysErrorZ_free(_res_conv);
8449 static inline uint64_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
8450 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8451 *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
8452 return (uint64_t)ret_conv;
8454 int64_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_clone_ptr(uint32_t arg) {
8455 LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
8456 int64_t ret_val = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
8460 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_clone(uint32_t orig) {
8461 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
8462 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8463 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
8464 return (uint64_t)ret_conv;
8467 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_some(int32_t o) {
8468 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
8469 *ret_copy = COption_u32Z_some(o);
8470 uint64_t ret_ref = (uint64_t)ret_copy;
8474 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_none() {
8475 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
8476 *ret_copy = COption_u32Z_none();
8477 uint64_t ret_ref = (uint64_t)ret_copy;
8481 void __attribute__((visibility("default"))) TS_COption_u32Z_free(uint32_t _res) {
8482 if ((_res & 1) != 0) return;
8483 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8484 CHECK_ACCESS(_res_ptr);
8485 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
8487 COption_u32Z_free(_res_conv);
8490 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
8491 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
8492 *ret_copy = COption_u32Z_clone(arg);
8493 uint64_t ret_ref = (uint64_t)ret_copy;
8496 int64_t __attribute__((visibility("default"))) TS_COption_u32Z_clone_ptr(uint32_t arg) {
8497 LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)arg;
8498 int64_t ret_val = COption_u32Z_clone_ptr(arg_conv);
8502 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_clone(uint32_t orig) {
8503 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
8504 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
8505 *ret_copy = COption_u32Z_clone(orig_conv);
8506 uint64_t ret_ref = (uint64_t)ret_copy;
8510 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
8511 LDKHTLCOutputInCommitment o_conv;
8512 o_conv.inner = (void*)(o & (~1));
8513 o_conv.is_owned = (o & 1) || (o == 0);
8514 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8515 o_conv = HTLCOutputInCommitment_clone(&o_conv);
8516 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
8517 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
8518 return (uint64_t)ret_conv;
8521 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
8522 LDKDecodeError e_conv;
8523 e_conv.inner = (void*)(e & (~1));
8524 e_conv.is_owned = (e & 1) || (e == 0);
8525 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8526 e_conv = DecodeError_clone(&e_conv);
8527 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
8528 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
8529 return (uint64_t)ret_conv;
8532 jboolean __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint32_t o) {
8533 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(o & ~1);
8534 jboolean ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
8538 void __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
8539 if ((_res & 1) != 0) return;
8540 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8541 CHECK_ACCESS(_res_ptr);
8542 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
8544 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
8547 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
8548 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
8549 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
8550 return (uint64_t)ret_conv;
8552 int64_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint32_t arg) {
8553 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
8554 int64_t ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
8558 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
8559 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
8560 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
8561 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
8562 return (uint64_t)ret_conv;
8565 uint32_t __attribute__((visibility("default"))) TS_COption_NoneZ_some() {
8566 uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
8570 uint32_t __attribute__((visibility("default"))) TS_COption_NoneZ_none() {
8571 uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
8575 void __attribute__((visibility("default"))) TS_COption_NoneZ_free(uint32_t _res) {
8576 LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
8577 COption_NoneZ_free(_res_conv);
8580 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
8581 LDKCounterpartyChannelTransactionParameters o_conv;
8582 o_conv.inner = (void*)(o & (~1));
8583 o_conv.is_owned = (o & 1) || (o == 0);
8584 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8585 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
8586 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
8587 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
8588 return (uint64_t)ret_conv;
8591 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
8592 LDKDecodeError e_conv;
8593 e_conv.inner = (void*)(e & (~1));
8594 e_conv.is_owned = (e & 1) || (e == 0);
8595 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8596 e_conv = DecodeError_clone(&e_conv);
8597 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
8598 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
8599 return (uint64_t)ret_conv;
8602 jboolean __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint32_t o) {
8603 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(o & ~1);
8604 jboolean ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
8608 void __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
8609 if ((_res & 1) != 0) return;
8610 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8611 CHECK_ACCESS(_res_ptr);
8612 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
8614 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
8617 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
8618 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
8619 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
8620 return (uint64_t)ret_conv;
8622 int64_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
8623 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
8624 int64_t ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
8628 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
8629 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
8630 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
8631 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
8632 return (uint64_t)ret_conv;
8635 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
8636 LDKChannelTransactionParameters o_conv;
8637 o_conv.inner = (void*)(o & (~1));
8638 o_conv.is_owned = (o & 1) || (o == 0);
8639 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8640 o_conv = ChannelTransactionParameters_clone(&o_conv);
8641 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
8642 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
8643 return (uint64_t)ret_conv;
8646 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
8647 LDKDecodeError e_conv;
8648 e_conv.inner = (void*)(e & (~1));
8649 e_conv.is_owned = (e & 1) || (e == 0);
8650 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8651 e_conv = DecodeError_clone(&e_conv);
8652 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
8653 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
8654 return (uint64_t)ret_conv;
8657 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint32_t o) {
8658 LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(o & ~1);
8659 jboolean ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
8663 void __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
8664 if ((_res & 1) != 0) return;
8665 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8666 CHECK_ACCESS(_res_ptr);
8667 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
8669 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
8672 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
8673 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
8674 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
8675 return (uint64_t)ret_conv;
8677 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
8678 LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
8679 int64_t ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
8683 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
8684 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
8685 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
8686 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
8687 return (uint64_t)ret_conv;
8690 void __attribute__((visibility("default"))) TS_CVec_SignatureZ_free(ptrArray _res) {
8691 LDKCVec_SignatureZ _res_constr;
8692 _res_constr.datalen = *((uint32_t*)_res);
8693 if (_res_constr.datalen > 0)
8694 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8696 _res_constr.data = NULL;
8697 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
8698 for (size_t m = 0; m < _res_constr.datalen; m++) {
8699 int8_tArray _res_conv_12 = _res_vals[m];
8700 LDKSignature _res_conv_12_ref;
8701 CHECK(*((uint32_t*)_res_conv_12) == 64);
8702 memcpy(_res_conv_12_ref.compact_form, (uint8_t*)(_res_conv_12 + 4), 64);
8703 _res_constr.data[m] = _res_conv_12_ref;
8705 CVec_SignatureZ_free(_res_constr);
8708 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
8709 LDKHolderCommitmentTransaction o_conv;
8710 o_conv.inner = (void*)(o & (~1));
8711 o_conv.is_owned = (o & 1) || (o == 0);
8712 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8713 o_conv = HolderCommitmentTransaction_clone(&o_conv);
8714 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
8715 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
8716 return (uint64_t)ret_conv;
8719 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
8720 LDKDecodeError e_conv;
8721 e_conv.inner = (void*)(e & (~1));
8722 e_conv.is_owned = (e & 1) || (e == 0);
8723 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8724 e_conv = DecodeError_clone(&e_conv);
8725 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
8726 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
8727 return (uint64_t)ret_conv;
8730 jboolean __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
8731 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(o & ~1);
8732 jboolean ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
8736 void __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
8737 if ((_res & 1) != 0) return;
8738 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8739 CHECK_ACCESS(_res_ptr);
8740 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
8742 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
8745 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
8746 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
8747 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
8748 return (uint64_t)ret_conv;
8750 int64_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
8751 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
8752 int64_t ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
8756 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
8757 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
8758 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
8759 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
8760 return (uint64_t)ret_conv;
8763 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
8764 LDKBuiltCommitmentTransaction o_conv;
8765 o_conv.inner = (void*)(o & (~1));
8766 o_conv.is_owned = (o & 1) || (o == 0);
8767 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8768 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
8769 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
8770 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
8771 return (uint64_t)ret_conv;
8774 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
8775 LDKDecodeError e_conv;
8776 e_conv.inner = (void*)(e & (~1));
8777 e_conv.is_owned = (e & 1) || (e == 0);
8778 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8779 e_conv = DecodeError_clone(&e_conv);
8780 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
8781 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
8782 return (uint64_t)ret_conv;
8785 jboolean __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
8786 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(o & ~1);
8787 jboolean ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
8791 void __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
8792 if ((_res & 1) != 0) return;
8793 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8794 CHECK_ACCESS(_res_ptr);
8795 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
8797 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
8800 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
8801 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
8802 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
8803 return (uint64_t)ret_conv;
8805 int64_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
8806 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
8807 int64_t ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
8811 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
8812 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
8813 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
8814 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
8815 return (uint64_t)ret_conv;
8818 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint32_t o) {
8819 LDKTrustedClosingTransaction o_conv;
8820 o_conv.inner = (void*)(o & (~1));
8821 o_conv.is_owned = (o & 1) || (o == 0);
8822 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8823 // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction
8824 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
8825 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
8826 return (uint64_t)ret_conv;
8829 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
8830 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
8831 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
8832 return (uint64_t)ret_conv;
8835 jboolean __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint32_t o) {
8836 LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(o & ~1);
8837 jboolean ret_val = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
8841 void __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint32_t _res) {
8842 if ((_res & 1) != 0) return;
8843 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8844 CHECK_ACCESS(_res_ptr);
8845 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
8847 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
8850 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
8851 LDKCommitmentTransaction o_conv;
8852 o_conv.inner = (void*)(o & (~1));
8853 o_conv.is_owned = (o & 1) || (o == 0);
8854 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8855 o_conv = CommitmentTransaction_clone(&o_conv);
8856 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
8857 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
8858 return (uint64_t)ret_conv;
8861 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
8862 LDKDecodeError e_conv;
8863 e_conv.inner = (void*)(e & (~1));
8864 e_conv.is_owned = (e & 1) || (e == 0);
8865 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8866 e_conv = DecodeError_clone(&e_conv);
8867 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
8868 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
8869 return (uint64_t)ret_conv;
8872 jboolean __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
8873 LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(o & ~1);
8874 jboolean ret_val = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
8878 void __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
8879 if ((_res & 1) != 0) return;
8880 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8881 CHECK_ACCESS(_res_ptr);
8882 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
8884 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
8887 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
8888 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
8889 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
8890 return (uint64_t)ret_conv;
8892 int64_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
8893 LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
8894 int64_t ret_val = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
8898 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
8899 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
8900 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
8901 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
8902 return (uint64_t)ret_conv;
8905 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
8906 LDKTrustedCommitmentTransaction o_conv;
8907 o_conv.inner = (void*)(o & (~1));
8908 o_conv.is_owned = (o & 1) || (o == 0);
8909 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8910 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
8911 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
8912 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
8913 return (uint64_t)ret_conv;
8916 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
8917 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
8918 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
8919 return (uint64_t)ret_conv;
8922 jboolean __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint32_t o) {
8923 LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(o & ~1);
8924 jboolean ret_val = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
8928 void __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
8929 if ((_res & 1) != 0) return;
8930 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8931 CHECK_ACCESS(_res_ptr);
8932 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
8934 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
8937 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
8938 LDKCVec_SignatureZ o_constr;
8939 o_constr.datalen = *((uint32_t*)o);
8940 if (o_constr.datalen > 0)
8941 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8943 o_constr.data = NULL;
8944 int8_tArray* o_vals = (int8_tArray*)(o + 4);
8945 for (size_t m = 0; m < o_constr.datalen; m++) {
8946 int8_tArray o_conv_12 = o_vals[m];
8947 LDKSignature o_conv_12_ref;
8948 CHECK(*((uint32_t*)o_conv_12) == 64);
8949 memcpy(o_conv_12_ref.compact_form, (uint8_t*)(o_conv_12 + 4), 64);
8950 o_constr.data[m] = o_conv_12_ref;
8952 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
8953 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
8954 return (uint64_t)ret_conv;
8957 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_err() {
8958 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
8959 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
8960 return (uint64_t)ret_conv;
8963 jboolean __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_is_ok(uint32_t o) {
8964 LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)(o & ~1);
8965 jboolean ret_val = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
8969 void __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
8970 if ((_res & 1) != 0) return;
8971 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8972 CHECK_ACCESS(_res_ptr);
8973 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
8975 CResult_CVec_SignatureZNoneZ_free(_res_conv);
8978 static inline uint64_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
8979 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
8980 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
8981 return (uint64_t)ret_conv;
8983 int64_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_clone_ptr(uint32_t arg) {
8984 LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
8985 int64_t ret_val = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
8989 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
8990 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
8991 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
8992 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
8993 return (uint64_t)ret_conv;
8996 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint32_t o) {
8997 LDKShutdownScript o_conv;
8998 o_conv.inner = (void*)(o & (~1));
8999 o_conv.is_owned = (o & 1) || (o == 0);
9000 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9001 o_conv = ShutdownScript_clone(&o_conv);
9002 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
9003 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
9004 return (uint64_t)ret_conv;
9007 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint32_t e) {
9008 LDKDecodeError e_conv;
9009 e_conv.inner = (void*)(e & (~1));
9010 e_conv.is_owned = (e & 1) || (e == 0);
9011 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9012 e_conv = DecodeError_clone(&e_conv);
9013 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
9014 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
9015 return (uint64_t)ret_conv;
9018 jboolean __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint32_t o) {
9019 LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(o & ~1);
9020 jboolean ret_val = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
9024 void __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint32_t _res) {
9025 if ((_res & 1) != 0) return;
9026 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9027 CHECK_ACCESS(_res_ptr);
9028 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
9030 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
9033 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
9034 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
9035 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
9036 return (uint64_t)ret_conv;
9038 int64_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint32_t arg) {
9039 LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
9040 int64_t ret_val = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
9044 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint32_t orig) {
9045 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
9046 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
9047 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
9048 return (uint64_t)ret_conv;
9051 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint32_t o) {
9052 LDKShutdownScript o_conv;
9053 o_conv.inner = (void*)(o & (~1));
9054 o_conv.is_owned = (o & 1) || (o == 0);
9055 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9056 o_conv = ShutdownScript_clone(&o_conv);
9057 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
9058 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
9059 return (uint64_t)ret_conv;
9062 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint32_t e) {
9063 LDKInvalidShutdownScript e_conv;
9064 e_conv.inner = (void*)(e & (~1));
9065 e_conv.is_owned = (e & 1) || (e == 0);
9066 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9067 e_conv = InvalidShutdownScript_clone(&e_conv);
9068 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
9069 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
9070 return (uint64_t)ret_conv;
9073 jboolean __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint32_t o) {
9074 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(o & ~1);
9075 jboolean ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
9079 void __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint32_t _res) {
9080 if ((_res & 1) != 0) return;
9081 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9082 CHECK_ACCESS(_res_ptr);
9083 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
9085 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
9088 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
9089 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
9090 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
9091 return (uint64_t)ret_conv;
9093 int64_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint32_t arg) {
9094 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
9095 int64_t ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
9099 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint32_t orig) {
9100 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
9101 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
9102 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
9103 return (uint64_t)ret_conv;
9106 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_ok() {
9107 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9108 *ret_conv = CResult_NoneErrorZ_ok();
9109 return (uint64_t)ret_conv;
9112 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
9113 LDKIOError e_conv = LDKIOError_from_js(e);
9114 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9115 *ret_conv = CResult_NoneErrorZ_err(e_conv);
9116 return (uint64_t)ret_conv;
9119 jboolean __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_is_ok(uint32_t o) {
9120 LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)(o & ~1);
9121 jboolean ret_val = CResult_NoneErrorZ_is_ok(o_conv);
9125 void __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_free(uint32_t _res) {
9126 if ((_res & 1) != 0) return;
9127 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9128 CHECK_ACCESS(_res_ptr);
9129 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
9131 CResult_NoneErrorZ_free(_res_conv);
9134 static inline uint64_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
9135 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9136 *ret_conv = CResult_NoneErrorZ_clone(arg);
9137 return (uint64_t)ret_conv;
9139 int64_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_clone_ptr(uint32_t arg) {
9140 LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)(arg & ~1);
9141 int64_t ret_val = CResult_NoneErrorZ_clone_ptr(arg_conv);
9145 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_clone(uint32_t orig) {
9146 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
9147 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9148 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
9149 return (uint64_t)ret_conv;
9152 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint32_t o) {
9154 o_conv.inner = (void*)(o & (~1));
9155 o_conv.is_owned = (o & 1) || (o == 0);
9156 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9157 o_conv = RouteHop_clone(&o_conv);
9158 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9159 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
9160 return (uint64_t)ret_conv;
9163 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_err(uint32_t e) {
9164 LDKDecodeError e_conv;
9165 e_conv.inner = (void*)(e & (~1));
9166 e_conv.is_owned = (e & 1) || (e == 0);
9167 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9168 e_conv = DecodeError_clone(&e_conv);
9169 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9170 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
9171 return (uint64_t)ret_conv;
9174 jboolean __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint32_t o) {
9175 LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)(o & ~1);
9176 jboolean ret_val = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
9180 void __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_free(uint32_t _res) {
9181 if ((_res & 1) != 0) return;
9182 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9183 CHECK_ACCESS(_res_ptr);
9184 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
9186 CResult_RouteHopDecodeErrorZ_free(_res_conv);
9189 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
9190 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9191 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
9192 return (uint64_t)ret_conv;
9194 int64_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint32_t arg) {
9195 LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
9196 int64_t ret_val = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
9200 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint32_t orig) {
9201 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
9202 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9203 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
9204 return (uint64_t)ret_conv;
9207 void __attribute__((visibility("default"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
9208 LDKCVec_RouteHopZ _res_constr;
9209 _res_constr.datalen = *((uint32_t*)_res);
9210 if (_res_constr.datalen > 0)
9211 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9213 _res_constr.data = NULL;
9214 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9215 for (size_t k = 0; k < _res_constr.datalen; k++) {
9216 uint32_t _res_conv_10 = _res_vals[k];
9217 LDKRouteHop _res_conv_10_conv;
9218 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
9219 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
9220 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
9221 _res_constr.data[k] = _res_conv_10_conv;
9223 CVec_RouteHopZ_free(_res_constr);
9226 void __attribute__((visibility("default"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
9227 LDKCVec_CVec_RouteHopZZ _res_constr;
9228 _res_constr.datalen = *((uint32_t*)_res);
9229 if (_res_constr.datalen > 0)
9230 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
9232 _res_constr.data = NULL;
9233 uint32_tArray* _res_vals = (uint32_tArray*)(_res + 4);
9234 for (size_t m = 0; m < _res_constr.datalen; m++) {
9235 uint32_tArray _res_conv_12 = _res_vals[m];
9236 LDKCVec_RouteHopZ _res_conv_12_constr;
9237 _res_conv_12_constr.datalen = *((uint32_t*)_res_conv_12);
9238 if (_res_conv_12_constr.datalen > 0)
9239 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9241 _res_conv_12_constr.data = NULL;
9242 uint32_t* _res_conv_12_vals = (uint32_t*)(_res_conv_12 + 4);
9243 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
9244 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
9245 LDKRouteHop _res_conv_12_conv_10_conv;
9246 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
9247 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
9248 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
9249 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
9251 _res_constr.data[m] = _res_conv_12_constr;
9253 CVec_CVec_RouteHopZZ_free(_res_constr);
9256 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
9258 o_conv.inner = (void*)(o & (~1));
9259 o_conv.is_owned = (o & 1) || (o == 0);
9260 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9261 o_conv = Route_clone(&o_conv);
9262 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9263 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
9264 return (uint64_t)ret_conv;
9267 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
9268 LDKDecodeError e_conv;
9269 e_conv.inner = (void*)(e & (~1));
9270 e_conv.is_owned = (e & 1) || (e == 0);
9271 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9272 e_conv = DecodeError_clone(&e_conv);
9273 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9274 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
9275 return (uint64_t)ret_conv;
9278 jboolean __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint32_t o) {
9279 LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)(o & ~1);
9280 jboolean ret_val = CResult_RouteDecodeErrorZ_is_ok(o_conv);
9284 void __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
9285 if ((_res & 1) != 0) return;
9286 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9287 CHECK_ACCESS(_res_ptr);
9288 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
9290 CResult_RouteDecodeErrorZ_free(_res_conv);
9293 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
9294 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9295 *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
9296 return (uint64_t)ret_conv;
9298 int64_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint32_t arg) {
9299 LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
9300 int64_t ret_val = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
9304 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
9305 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
9306 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9307 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
9308 return (uint64_t)ret_conv;
9311 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint32_t o) {
9312 LDKRouteParameters o_conv;
9313 o_conv.inner = (void*)(o & (~1));
9314 o_conv.is_owned = (o & 1) || (o == 0);
9315 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9316 o_conv = RouteParameters_clone(&o_conv);
9317 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
9318 *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
9319 return (uint64_t)ret_conv;
9322 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint32_t e) {
9323 LDKDecodeError e_conv;
9324 e_conv.inner = (void*)(e & (~1));
9325 e_conv.is_owned = (e & 1) || (e == 0);
9326 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9327 e_conv = DecodeError_clone(&e_conv);
9328 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
9329 *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
9330 return (uint64_t)ret_conv;
9333 jboolean __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint32_t o) {
9334 LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(o & ~1);
9335 jboolean ret_val = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
9339 void __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint32_t _res) {
9340 if ((_res & 1) != 0) return;
9341 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9342 CHECK_ACCESS(_res_ptr);
9343 LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
9345 CResult_RouteParametersDecodeErrorZ_free(_res_conv);
9348 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
9349 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
9350 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
9351 return (uint64_t)ret_conv;
9353 int64_t __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
9354 LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
9355 int64_t ret_val = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
9359 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint32_t orig) {
9360 LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(orig & ~1);
9361 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
9362 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
9363 return (uint64_t)ret_conv;
9366 void __attribute__((visibility("default"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
9367 LDKCVec_RouteHintZ _res_constr;
9368 _res_constr.datalen = *((uint32_t*)_res);
9369 if (_res_constr.datalen > 0)
9370 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
9372 _res_constr.data = NULL;
9373 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9374 for (size_t l = 0; l < _res_constr.datalen; l++) {
9375 uint32_t _res_conv_11 = _res_vals[l];
9376 LDKRouteHint _res_conv_11_conv;
9377 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
9378 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
9379 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
9380 _res_constr.data[l] = _res_conv_11_conv;
9382 CVec_RouteHintZ_free(_res_constr);
9385 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_some(int64_t o) {
9386 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9387 *ret_copy = COption_u64Z_some(o);
9388 uint64_t ret_ref = (uint64_t)ret_copy;
9392 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_none() {
9393 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9394 *ret_copy = COption_u64Z_none();
9395 uint64_t ret_ref = (uint64_t)ret_copy;
9399 void __attribute__((visibility("default"))) TS_COption_u64Z_free(uint32_t _res) {
9400 if ((_res & 1) != 0) return;
9401 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9402 CHECK_ACCESS(_res_ptr);
9403 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
9405 COption_u64Z_free(_res_conv);
9408 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
9409 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9410 *ret_copy = COption_u64Z_clone(arg);
9411 uint64_t ret_ref = (uint64_t)ret_copy;
9414 int64_t __attribute__((visibility("default"))) TS_COption_u64Z_clone_ptr(uint32_t arg) {
9415 LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)arg;
9416 int64_t ret_val = COption_u64Z_clone_ptr(arg_conv);
9420 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_clone(uint32_t orig) {
9421 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
9422 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9423 *ret_copy = COption_u64Z_clone(orig_conv);
9424 uint64_t ret_ref = (uint64_t)ret_copy;
9428 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_ok(uint32_t o) {
9430 o_conv.inner = (void*)(o & (~1));
9431 o_conv.is_owned = (o & 1) || (o == 0);
9432 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9433 o_conv = Payee_clone(&o_conv);
9434 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
9435 *ret_conv = CResult_PayeeDecodeErrorZ_ok(o_conv);
9436 return (uint64_t)ret_conv;
9439 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_err(uint32_t e) {
9440 LDKDecodeError e_conv;
9441 e_conv.inner = (void*)(e & (~1));
9442 e_conv.is_owned = (e & 1) || (e == 0);
9443 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9444 e_conv = DecodeError_clone(&e_conv);
9445 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
9446 *ret_conv = CResult_PayeeDecodeErrorZ_err(e_conv);
9447 return (uint64_t)ret_conv;
9450 jboolean __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_is_ok(uint32_t o) {
9451 LDKCResult_PayeeDecodeErrorZ* o_conv = (LDKCResult_PayeeDecodeErrorZ*)(o & ~1);
9452 jboolean ret_val = CResult_PayeeDecodeErrorZ_is_ok(o_conv);
9456 void __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_free(uint32_t _res) {
9457 if ((_res & 1) != 0) return;
9458 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9459 CHECK_ACCESS(_res_ptr);
9460 LDKCResult_PayeeDecodeErrorZ _res_conv = *(LDKCResult_PayeeDecodeErrorZ*)(_res_ptr);
9462 CResult_PayeeDecodeErrorZ_free(_res_conv);
9465 static inline uint64_t CResult_PayeeDecodeErrorZ_clone_ptr(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR arg) {
9466 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
9467 *ret_conv = CResult_PayeeDecodeErrorZ_clone(arg);
9468 return (uint64_t)ret_conv;
9470 int64_t __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_clone_ptr(uint32_t arg) {
9471 LDKCResult_PayeeDecodeErrorZ* arg_conv = (LDKCResult_PayeeDecodeErrorZ*)(arg & ~1);
9472 int64_t ret_val = CResult_PayeeDecodeErrorZ_clone_ptr(arg_conv);
9476 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_clone(uint32_t orig) {
9477 LDKCResult_PayeeDecodeErrorZ* orig_conv = (LDKCResult_PayeeDecodeErrorZ*)(orig & ~1);
9478 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
9479 *ret_conv = CResult_PayeeDecodeErrorZ_clone(orig_conv);
9480 return (uint64_t)ret_conv;
9483 void __attribute__((visibility("default"))) TS_CVec_RouteHintHopZ_free(uint32_tArray _res) {
9484 LDKCVec_RouteHintHopZ _res_constr;
9485 _res_constr.datalen = *((uint32_t*)_res);
9486 if (_res_constr.datalen > 0)
9487 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
9489 _res_constr.data = NULL;
9490 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9491 for (size_t o = 0; o < _res_constr.datalen; o++) {
9492 uint32_t _res_conv_14 = _res_vals[o];
9493 LDKRouteHintHop _res_conv_14_conv;
9494 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
9495 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
9496 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
9497 _res_constr.data[o] = _res_conv_14_conv;
9499 CVec_RouteHintHopZ_free(_res_constr);
9502 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint32_t o) {
9503 LDKRouteHint o_conv;
9504 o_conv.inner = (void*)(o & (~1));
9505 o_conv.is_owned = (o & 1) || (o == 0);
9506 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9507 o_conv = RouteHint_clone(&o_conv);
9508 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
9509 *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
9510 return (uint64_t)ret_conv;
9513 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_err(uint32_t e) {
9514 LDKDecodeError e_conv;
9515 e_conv.inner = (void*)(e & (~1));
9516 e_conv.is_owned = (e & 1) || (e == 0);
9517 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9518 e_conv = DecodeError_clone(&e_conv);
9519 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
9520 *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
9521 return (uint64_t)ret_conv;
9524 jboolean __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint32_t o) {
9525 LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)(o & ~1);
9526 jboolean ret_val = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
9530 void __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_free(uint32_t _res) {
9531 if ((_res & 1) != 0) return;
9532 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9533 CHECK_ACCESS(_res_ptr);
9534 LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
9536 CResult_RouteHintDecodeErrorZ_free(_res_conv);
9539 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
9540 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
9541 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
9542 return (uint64_t)ret_conv;
9544 int64_t __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint32_t arg) {
9545 LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
9546 int64_t ret_val = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
9550 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint32_t orig) {
9551 LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)(orig & ~1);
9552 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
9553 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
9554 return (uint64_t)ret_conv;
9557 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint32_t o) {
9558 LDKRouteHintHop o_conv;
9559 o_conv.inner = (void*)(o & (~1));
9560 o_conv.is_owned = (o & 1) || (o == 0);
9561 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9562 o_conv = RouteHintHop_clone(&o_conv);
9563 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
9564 *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
9565 return (uint64_t)ret_conv;
9568 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint32_t e) {
9569 LDKDecodeError e_conv;
9570 e_conv.inner = (void*)(e & (~1));
9571 e_conv.is_owned = (e & 1) || (e == 0);
9572 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9573 e_conv = DecodeError_clone(&e_conv);
9574 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
9575 *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
9576 return (uint64_t)ret_conv;
9579 jboolean __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint32_t o) {
9580 LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(o & ~1);
9581 jboolean ret_val = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
9585 void __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint32_t _res) {
9586 if ((_res & 1) != 0) return;
9587 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9588 CHECK_ACCESS(_res_ptr);
9589 LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
9591 CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
9594 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
9595 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
9596 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
9597 return (uint64_t)ret_conv;
9599 int64_t __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint32_t arg) {
9600 LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
9601 int64_t ret_val = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
9605 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint32_t orig) {
9606 LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(orig & ~1);
9607 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
9608 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
9609 return (uint64_t)ret_conv;
9612 void __attribute__((visibility("default"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
9613 LDKCVec_ChannelDetailsZ _res_constr;
9614 _res_constr.datalen = *((uint32_t*)_res);
9615 if (_res_constr.datalen > 0)
9616 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
9618 _res_constr.data = NULL;
9619 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9620 for (size_t q = 0; q < _res_constr.datalen; q++) {
9621 uint32_t _res_conv_16 = _res_vals[q];
9622 LDKChannelDetails _res_conv_16_conv;
9623 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
9624 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
9625 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
9626 _res_constr.data[q] = _res_conv_16_conv;
9628 CVec_ChannelDetailsZ_free(_res_constr);
9631 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
9633 o_conv.inner = (void*)(o & (~1));
9634 o_conv.is_owned = (o & 1) || (o == 0);
9635 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9636 o_conv = Route_clone(&o_conv);
9637 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9638 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
9639 return (uint64_t)ret_conv;
9642 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
9643 LDKLightningError e_conv;
9644 e_conv.inner = (void*)(e & (~1));
9645 e_conv.is_owned = (e & 1) || (e == 0);
9646 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9647 e_conv = LightningError_clone(&e_conv);
9648 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9649 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
9650 return (uint64_t)ret_conv;
9653 jboolean __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_is_ok(uint32_t o) {
9654 LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)(o & ~1);
9655 jboolean ret_val = CResult_RouteLightningErrorZ_is_ok(o_conv);
9659 void __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
9660 if ((_res & 1) != 0) return;
9661 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9662 CHECK_ACCESS(_res_ptr);
9663 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
9665 CResult_RouteLightningErrorZ_free(_res_conv);
9668 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
9669 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9670 *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
9671 return (uint64_t)ret_conv;
9673 int64_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint32_t arg) {
9674 LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
9675 int64_t ret_val = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
9679 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
9680 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
9681 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9682 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
9683 return (uint64_t)ret_conv;
9686 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
9687 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9688 CHECK_ACCESS(o_ptr);
9689 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
9690 o_conv = TxOut_clone((LDKTxOut*)(((uint64_t)o) & ~1));
9691 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9692 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
9693 return (uint64_t)ret_conv;
9696 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
9697 LDKAccessError e_conv = LDKAccessError_from_js(e);
9698 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9699 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
9700 return (uint64_t)ret_conv;
9703 jboolean __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_is_ok(uint32_t o) {
9704 LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)(o & ~1);
9705 jboolean ret_val = CResult_TxOutAccessErrorZ_is_ok(o_conv);
9709 void __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
9710 if ((_res & 1) != 0) return;
9711 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9712 CHECK_ACCESS(_res_ptr);
9713 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
9715 CResult_TxOutAccessErrorZ_free(_res_conv);
9718 static inline uint64_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
9719 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9720 *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
9721 return (uint64_t)ret_conv;
9723 int64_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_clone_ptr(uint32_t arg) {
9724 LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
9725 int64_t ret_val = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
9729 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
9730 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
9731 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9732 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
9733 return (uint64_t)ret_conv;
9736 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
9737 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9738 *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
9739 return ((uint64_t)ret_conv);
9741 int64_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint32_t arg) {
9742 LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)(arg & ~1);
9743 int64_t ret_val = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
9747 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_clone(uint32_t orig) {
9748 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
9749 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9750 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
9751 return ((uint64_t)ret_conv);
9754 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
9755 LDKTransaction b_ref;
9756 b_ref.datalen = *((uint32_t*)b);
9757 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
9758 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
9759 b_ref.data_is_owned = true;
9760 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9761 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
9762 return ((uint64_t)ret_conv);
9765 void __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
9766 if ((_res & 1) != 0) return;
9767 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9768 CHECK_ACCESS(_res_ptr);
9769 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
9771 C2Tuple_usizeTransactionZ_free(_res_conv);
9774 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
9775 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
9776 _res_constr.datalen = *((uint32_t*)_res);
9777 if (_res_constr.datalen > 0)
9778 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9780 _res_constr.data = NULL;
9781 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9782 for (size_t c = 0; c < _res_constr.datalen; c++) {
9783 uint32_t _res_conv_28 = _res_vals[c];
9784 void* _res_conv_28_ptr = (void*)(((uint64_t)_res_conv_28) & ~1);
9785 CHECK_ACCESS(_res_conv_28_ptr);
9786 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
9787 FREE((void*)_res_conv_28);
9788 _res_constr.data[c] = _res_conv_28_conv;
9790 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
9793 void __attribute__((visibility("default"))) TS_CVec_TxidZ_free(ptrArray _res) {
9794 LDKCVec_TxidZ _res_constr;
9795 _res_constr.datalen = *((uint32_t*)_res);
9796 if (_res_constr.datalen > 0)
9797 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
9799 _res_constr.data = NULL;
9800 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
9801 for (size_t m = 0; m < _res_constr.datalen; m++) {
9802 int8_tArray _res_conv_12 = _res_vals[m];
9803 LDKThirtyTwoBytes _res_conv_12_ref;
9804 CHECK(*((uint32_t*)_res_conv_12) == 32);
9805 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), 32);
9806 _res_constr.data[m] = _res_conv_12_ref;
9808 CVec_TxidZ_free(_res_constr);
9811 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
9812 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9813 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
9814 return (uint64_t)ret_conv;
9817 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
9818 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
9819 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9820 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
9821 return (uint64_t)ret_conv;
9824 jboolean __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok(uint32_t o) {
9825 LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(o & ~1);
9826 jboolean ret_val = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
9830 void __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
9831 if ((_res & 1) != 0) return;
9832 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9833 CHECK_ACCESS(_res_ptr);
9834 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
9836 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
9839 static inline uint64_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
9840 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9841 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
9842 return (uint64_t)ret_conv;
9844 int64_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(uint32_t arg) {
9845 LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
9846 int64_t ret_val = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
9850 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
9851 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
9852 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9853 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
9854 return (uint64_t)ret_conv;
9857 void __attribute__((visibility("default"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
9858 LDKCVec_MonitorEventZ _res_constr;
9859 _res_constr.datalen = *((uint32_t*)_res);
9860 if (_res_constr.datalen > 0)
9861 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
9863 _res_constr.data = NULL;
9864 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9865 for (size_t o = 0; o < _res_constr.datalen; o++) {
9866 uint32_t _res_conv_14 = _res_vals[o];
9867 void* _res_conv_14_ptr = (void*)(((uint64_t)_res_conv_14) & ~1);
9868 CHECK_ACCESS(_res_conv_14_ptr);
9869 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
9870 FREE((void*)_res_conv_14);
9871 _res_constr.data[o] = _res_conv_14_conv;
9873 CVec_MonitorEventZ_free(_res_constr);
9876 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
9877 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9878 CHECK_ACCESS(o_ptr);
9879 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
9880 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1));
9881 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9882 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
9883 uint64_t ret_ref = (uint64_t)ret_copy;
9887 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
9888 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9889 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
9890 uint64_t ret_ref = (uint64_t)ret_copy;
9894 void __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint32_t _res) {
9895 if ((_res & 1) != 0) return;
9896 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9897 CHECK_ACCESS(_res_ptr);
9898 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
9900 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
9903 static inline uint64_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
9904 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9905 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
9906 uint64_t ret_ref = (uint64_t)ret_copy;
9909 int64_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_clone_ptr(uint32_t arg) {
9910 LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)arg;
9911 int64_t ret_val = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
9915 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_clone(uint32_t orig) {
9916 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
9917 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9918 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
9919 uint64_t ret_ref = (uint64_t)ret_copy;
9923 uint32_t __attribute__((visibility("default"))) TS_COption_ClosureReasonZ_some(uint32_t o) {
9924 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9925 CHECK_ACCESS(o_ptr);
9926 LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
9927 o_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)o) & ~1));
9928 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
9929 *ret_copy = COption_ClosureReasonZ_some(o_conv);
9930 uint64_t ret_ref = (uint64_t)ret_copy;
9934 uint32_t __attribute__((visibility("default"))) TS_COption_ClosureReasonZ_none() {
9935 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
9936 *ret_copy = COption_ClosureReasonZ_none();
9937 uint64_t ret_ref = (uint64_t)ret_copy;
9941 void __attribute__((visibility("default"))) TS_COption_ClosureReasonZ_free(uint32_t _res) {
9942 if ((_res & 1) != 0) return;
9943 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9944 CHECK_ACCESS(_res_ptr);
9945 LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
9947 COption_ClosureReasonZ_free(_res_conv);
9950 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
9951 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
9952 *ret_copy = COption_ClosureReasonZ_clone(arg);
9953 uint64_t ret_ref = (uint64_t)ret_copy;
9956 int64_t __attribute__((visibility("default"))) TS_COption_ClosureReasonZ_clone_ptr(uint32_t arg) {
9957 LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)arg;
9958 int64_t ret_val = COption_ClosureReasonZ_clone_ptr(arg_conv);
9962 uint32_t __attribute__((visibility("default"))) TS_COption_ClosureReasonZ_clone(uint32_t orig) {
9963 LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)orig;
9964 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
9965 *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
9966 uint64_t ret_ref = (uint64_t)ret_copy;
9970 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint32_t o) {
9971 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9972 CHECK_ACCESS(o_ptr);
9973 LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
9974 o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)(((uint64_t)o) & ~1));
9975 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
9976 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
9977 return (uint64_t)ret_conv;
9980 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint32_t e) {
9981 LDKDecodeError e_conv;
9982 e_conv.inner = (void*)(e & (~1));
9983 e_conv.is_owned = (e & 1) || (e == 0);
9984 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9985 e_conv = DecodeError_clone(&e_conv);
9986 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
9987 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
9988 return (uint64_t)ret_conv;
9991 jboolean __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint32_t o) {
9992 LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(o & ~1);
9993 jboolean ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
9997 void __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint32_t _res) {
9998 if ((_res & 1) != 0) return;
9999 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10000 CHECK_ACCESS(_res_ptr);
10001 LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
10003 CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
10006 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
10007 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
10008 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
10009 return (uint64_t)ret_conv;
10011 int64_t __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint32_t arg) {
10012 LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
10013 int64_t ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
10017 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint32_t orig) {
10018 LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(orig & ~1);
10019 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
10020 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
10021 return (uint64_t)ret_conv;
10024 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_some(uint32_t o) {
10025 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10026 CHECK_ACCESS(o_ptr);
10027 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
10028 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uint64_t)o) & ~1));
10029 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
10030 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
10031 uint64_t ret_ref = (uint64_t)ret_copy;
10035 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_none() {
10036 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
10037 *ret_copy = COption_NetworkUpdateZ_none();
10038 uint64_t ret_ref = (uint64_t)ret_copy;
10042 void __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_free(uint32_t _res) {
10043 if ((_res & 1) != 0) return;
10044 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10045 CHECK_ACCESS(_res_ptr);
10046 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
10048 COption_NetworkUpdateZ_free(_res_conv);
10051 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
10052 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
10053 *ret_copy = COption_NetworkUpdateZ_clone(arg);
10054 uint64_t ret_ref = (uint64_t)ret_copy;
10057 int64_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_clone_ptr(uint32_t arg) {
10058 LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)arg;
10059 int64_t ret_val = COption_NetworkUpdateZ_clone_ptr(arg_conv);
10063 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_clone(uint32_t orig) {
10064 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
10065 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
10066 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
10067 uint64_t ret_ref = (uint64_t)ret_copy;
10071 void __attribute__((visibility("default"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
10072 LDKCVec_SpendableOutputDescriptorZ _res_constr;
10073 _res_constr.datalen = *((uint32_t*)_res);
10074 if (_res_constr.datalen > 0)
10075 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
10077 _res_constr.data = NULL;
10078 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10079 for (size_t b = 0; b < _res_constr.datalen; b++) {
10080 uint32_t _res_conv_27 = _res_vals[b];
10081 void* _res_conv_27_ptr = (void*)(((uint64_t)_res_conv_27) & ~1);
10082 CHECK_ACCESS(_res_conv_27_ptr);
10083 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
10084 FREE((void*)_res_conv_27);
10085 _res_constr.data[b] = _res_conv_27_conv;
10087 CVec_SpendableOutputDescriptorZ_free(_res_constr);
10090 uint32_t __attribute__((visibility("default"))) TS_COption_EventZ_some(uint32_t o) {
10091 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10092 CHECK_ACCESS(o_ptr);
10093 LDKEvent o_conv = *(LDKEvent*)(o_ptr);
10094 o_conv = Event_clone((LDKEvent*)(((uint64_t)o) & ~1));
10095 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
10096 *ret_copy = COption_EventZ_some(o_conv);
10097 uint64_t ret_ref = (uint64_t)ret_copy;
10101 uint32_t __attribute__((visibility("default"))) TS_COption_EventZ_none() {
10102 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
10103 *ret_copy = COption_EventZ_none();
10104 uint64_t ret_ref = (uint64_t)ret_copy;
10108 void __attribute__((visibility("default"))) TS_COption_EventZ_free(uint32_t _res) {
10109 if ((_res & 1) != 0) return;
10110 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10111 CHECK_ACCESS(_res_ptr);
10112 LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
10114 COption_EventZ_free(_res_conv);
10117 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
10118 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
10119 *ret_copy = COption_EventZ_clone(arg);
10120 uint64_t ret_ref = (uint64_t)ret_copy;
10123 int64_t __attribute__((visibility("default"))) TS_COption_EventZ_clone_ptr(uint32_t arg) {
10124 LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)arg;
10125 int64_t ret_val = COption_EventZ_clone_ptr(arg_conv);
10129 uint32_t __attribute__((visibility("default"))) TS_COption_EventZ_clone(uint32_t orig) {
10130 LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)orig;
10131 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
10132 *ret_copy = COption_EventZ_clone(orig_conv);
10133 uint64_t ret_ref = (uint64_t)ret_copy;
10137 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint32_t o) {
10138 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10139 CHECK_ACCESS(o_ptr);
10140 LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
10141 o_conv = COption_EventZ_clone((LDKCOption_EventZ*)(((uint64_t)o) & ~1));
10142 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
10143 *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
10144 return (uint64_t)ret_conv;
10147 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint32_t e) {
10148 LDKDecodeError e_conv;
10149 e_conv.inner = (void*)(e & (~1));
10150 e_conv.is_owned = (e & 1) || (e == 0);
10151 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10152 e_conv = DecodeError_clone(&e_conv);
10153 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
10154 *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
10155 return (uint64_t)ret_conv;
10158 jboolean __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint32_t o) {
10159 LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(o & ~1);
10160 jboolean ret_val = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
10164 void __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint32_t _res) {
10165 if ((_res & 1) != 0) return;
10166 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10167 CHECK_ACCESS(_res_ptr);
10168 LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
10170 CResult_COption_EventZDecodeErrorZ_free(_res_conv);
10173 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
10174 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
10175 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
10176 return (uint64_t)ret_conv;
10178 int64_t __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint32_t arg) {
10179 LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
10180 int64_t ret_val = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
10184 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint32_t orig) {
10185 LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(orig & ~1);
10186 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
10187 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
10188 return (uint64_t)ret_conv;
10191 void __attribute__((visibility("default"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
10192 LDKCVec_MessageSendEventZ _res_constr;
10193 _res_constr.datalen = *((uint32_t*)_res);
10194 if (_res_constr.datalen > 0)
10195 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
10197 _res_constr.data = NULL;
10198 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10199 for (size_t s = 0; s < _res_constr.datalen; s++) {
10200 uint32_t _res_conv_18 = _res_vals[s];
10201 void* _res_conv_18_ptr = (void*)(((uint64_t)_res_conv_18) & ~1);
10202 CHECK_ACCESS(_res_conv_18_ptr);
10203 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
10204 FREE((void*)_res_conv_18);
10205 _res_constr.data[s] = _res_conv_18_conv;
10207 CVec_MessageSendEventZ_free(_res_constr);
10210 uint32_t __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_ok(uint32_t o) {
10211 LDKScoringParameters o_conv;
10212 o_conv.inner = (void*)(o & (~1));
10213 o_conv.is_owned = (o & 1) || (o == 0);
10214 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10215 // Warning: we need a move here but no clone is available for LDKScoringParameters
10216 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
10217 *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv);
10218 return (uint64_t)ret_conv;
10221 uint32_t __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_err(uint32_t e) {
10222 LDKDecodeError e_conv;
10223 e_conv.inner = (void*)(e & (~1));
10224 e_conv.is_owned = (e & 1) || (e == 0);
10225 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10226 e_conv = DecodeError_clone(&e_conv);
10227 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
10228 *ret_conv = CResult_ScoringParametersDecodeErrorZ_err(e_conv);
10229 return (uint64_t)ret_conv;
10232 jboolean __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_is_ok(uint32_t o) {
10233 LDKCResult_ScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(o & ~1);
10234 jboolean ret_val = CResult_ScoringParametersDecodeErrorZ_is_ok(o_conv);
10238 void __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_free(uint32_t _res) {
10239 if ((_res & 1) != 0) return;
10240 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10241 CHECK_ACCESS(_res_ptr);
10242 LDKCResult_ScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ScoringParametersDecodeErrorZ*)(_res_ptr);
10244 CResult_ScoringParametersDecodeErrorZ_free(_res_conv);
10247 uint32_t __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_ok(uint32_t o) {
10249 o_conv.inner = (void*)(o & (~1));
10250 o_conv.is_owned = (o & 1) || (o == 0);
10251 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10252 // Warning: we need a move here but no clone is available for LDKScorer
10253 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
10254 *ret_conv = CResult_ScorerDecodeErrorZ_ok(o_conv);
10255 return (uint64_t)ret_conv;
10258 uint32_t __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_err(uint32_t e) {
10259 LDKDecodeError e_conv;
10260 e_conv.inner = (void*)(e & (~1));
10261 e_conv.is_owned = (e & 1) || (e == 0);
10262 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10263 e_conv = DecodeError_clone(&e_conv);
10264 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
10265 *ret_conv = CResult_ScorerDecodeErrorZ_err(e_conv);
10266 return (uint64_t)ret_conv;
10269 jboolean __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_is_ok(uint32_t o) {
10270 LDKCResult_ScorerDecodeErrorZ* o_conv = (LDKCResult_ScorerDecodeErrorZ*)(o & ~1);
10271 jboolean ret_val = CResult_ScorerDecodeErrorZ_is_ok(o_conv);
10275 void __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_free(uint32_t _res) {
10276 if ((_res & 1) != 0) return;
10277 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10278 CHECK_ACCESS(_res_ptr);
10279 LDKCResult_ScorerDecodeErrorZ _res_conv = *(LDKCResult_ScorerDecodeErrorZ*)(_res_ptr);
10281 CResult_ScorerDecodeErrorZ_free(_res_conv);
10284 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
10285 LDKInitFeatures o_conv;
10286 o_conv.inner = (void*)(o & (~1));
10287 o_conv.is_owned = (o & 1) || (o == 0);
10288 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10289 o_conv = InitFeatures_clone(&o_conv);
10290 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
10291 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
10292 return (uint64_t)ret_conv;
10295 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
10296 LDKDecodeError e_conv;
10297 e_conv.inner = (void*)(e & (~1));
10298 e_conv.is_owned = (e & 1) || (e == 0);
10299 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10300 e_conv = DecodeError_clone(&e_conv);
10301 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
10302 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
10303 return (uint64_t)ret_conv;
10306 jboolean __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint32_t o) {
10307 LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1);
10308 jboolean ret_val = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
10312 void __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
10313 if ((_res & 1) != 0) return;
10314 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10315 CHECK_ACCESS(_res_ptr);
10316 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
10318 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
10321 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
10322 LDKChannelFeatures o_conv;
10323 o_conv.inner = (void*)(o & (~1));
10324 o_conv.is_owned = (o & 1) || (o == 0);
10325 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10326 o_conv = ChannelFeatures_clone(&o_conv);
10327 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
10328 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
10329 return (uint64_t)ret_conv;
10332 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
10333 LDKDecodeError e_conv;
10334 e_conv.inner = (void*)(e & (~1));
10335 e_conv.is_owned = (e & 1) || (e == 0);
10336 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10337 e_conv = DecodeError_clone(&e_conv);
10338 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
10339 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
10340 return (uint64_t)ret_conv;
10343 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint32_t o) {
10344 LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(o & ~1);
10345 jboolean ret_val = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
10349 void __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
10350 if ((_res & 1) != 0) return;
10351 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10352 CHECK_ACCESS(_res_ptr);
10353 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
10355 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
10358 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
10359 LDKNodeFeatures o_conv;
10360 o_conv.inner = (void*)(o & (~1));
10361 o_conv.is_owned = (o & 1) || (o == 0);
10362 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10363 o_conv = NodeFeatures_clone(&o_conv);
10364 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
10365 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
10366 return (uint64_t)ret_conv;
10369 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
10370 LDKDecodeError e_conv;
10371 e_conv.inner = (void*)(e & (~1));
10372 e_conv.is_owned = (e & 1) || (e == 0);
10373 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10374 e_conv = DecodeError_clone(&e_conv);
10375 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
10376 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
10377 return (uint64_t)ret_conv;
10380 jboolean __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint32_t o) {
10381 LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1);
10382 jboolean ret_val = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
10386 void __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
10387 if ((_res & 1) != 0) return;
10388 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10389 CHECK_ACCESS(_res_ptr);
10390 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
10392 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
10395 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) {
10396 LDKInvoiceFeatures o_conv;
10397 o_conv.inner = (void*)(o & (~1));
10398 o_conv.is_owned = (o & 1) || (o == 0);
10399 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10400 o_conv = InvoiceFeatures_clone(&o_conv);
10401 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
10402 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
10403 return (uint64_t)ret_conv;
10406 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) {
10407 LDKDecodeError e_conv;
10408 e_conv.inner = (void*)(e & (~1));
10409 e_conv.is_owned = (e & 1) || (e == 0);
10410 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10411 e_conv = DecodeError_clone(&e_conv);
10412 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
10413 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
10414 return (uint64_t)ret_conv;
10417 jboolean __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint32_t o) {
10418 LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1);
10419 jboolean ret_val = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
10423 void __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) {
10424 if ((_res & 1) != 0) return;
10425 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10426 CHECK_ACCESS(_res_ptr);
10427 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
10429 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
10432 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint32_t o) {
10433 LDKChannelTypeFeatures o_conv;
10434 o_conv.inner = (void*)(o & (~1));
10435 o_conv.is_owned = (o & 1) || (o == 0);
10436 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10437 o_conv = ChannelTypeFeatures_clone(&o_conv);
10438 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
10439 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
10440 return (uint64_t)ret_conv;
10443 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint32_t e) {
10444 LDKDecodeError e_conv;
10445 e_conv.inner = (void*)(e & (~1));
10446 e_conv.is_owned = (e & 1) || (e == 0);
10447 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10448 e_conv = DecodeError_clone(&e_conv);
10449 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
10450 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
10451 return (uint64_t)ret_conv;
10454 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint32_t o) {
10455 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(o & ~1);
10456 jboolean ret_val = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
10460 void __attribute__((visibility("default"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint32_t _res) {
10461 if ((_res & 1) != 0) return;
10462 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10463 CHECK_ACCESS(_res_ptr);
10464 LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
10466 CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
10469 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
10470 LDKDelayedPaymentOutputDescriptor o_conv;
10471 o_conv.inner = (void*)(o & (~1));
10472 o_conv.is_owned = (o & 1) || (o == 0);
10473 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10474 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
10475 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
10476 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
10477 return (uint64_t)ret_conv;
10480 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
10481 LDKDecodeError e_conv;
10482 e_conv.inner = (void*)(e & (~1));
10483 e_conv.is_owned = (e & 1) || (e == 0);
10484 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10485 e_conv = DecodeError_clone(&e_conv);
10486 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
10487 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
10488 return (uint64_t)ret_conv;
10491 jboolean __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
10492 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
10493 jboolean ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
10497 void __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
10498 if ((_res & 1) != 0) return;
10499 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10500 CHECK_ACCESS(_res_ptr);
10501 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
10503 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
10506 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
10507 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
10508 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
10509 return (uint64_t)ret_conv;
10511 int64_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
10512 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
10513 int64_t ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
10517 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
10518 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
10519 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
10520 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
10521 return (uint64_t)ret_conv;
10524 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
10525 LDKStaticPaymentOutputDescriptor o_conv;
10526 o_conv.inner = (void*)(o & (~1));
10527 o_conv.is_owned = (o & 1) || (o == 0);
10528 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10529 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
10530 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
10531 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
10532 return (uint64_t)ret_conv;
10535 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
10536 LDKDecodeError e_conv;
10537 e_conv.inner = (void*)(e & (~1));
10538 e_conv.is_owned = (e & 1) || (e == 0);
10539 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10540 e_conv = DecodeError_clone(&e_conv);
10541 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
10542 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
10543 return (uint64_t)ret_conv;
10546 jboolean __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
10547 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
10548 jboolean ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
10552 void __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
10553 if ((_res & 1) != 0) return;
10554 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10555 CHECK_ACCESS(_res_ptr);
10556 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
10558 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
10561 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
10562 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
10563 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
10564 return (uint64_t)ret_conv;
10566 int64_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
10567 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
10568 int64_t ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
10572 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
10573 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
10574 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
10575 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
10576 return (uint64_t)ret_conv;
10579 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
10580 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10581 CHECK_ACCESS(o_ptr);
10582 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
10583 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1));
10584 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10585 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
10586 return (uint64_t)ret_conv;
10589 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
10590 LDKDecodeError e_conv;
10591 e_conv.inner = (void*)(e & (~1));
10592 e_conv.is_owned = (e & 1) || (e == 0);
10593 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10594 e_conv = DecodeError_clone(&e_conv);
10595 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10596 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
10597 return (uint64_t)ret_conv;
10600 jboolean __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
10601 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(o & ~1);
10602 jboolean ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
10606 void __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
10607 if ((_res & 1) != 0) return;
10608 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10609 CHECK_ACCESS(_res_ptr);
10610 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
10612 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
10615 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
10616 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10617 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
10618 return (uint64_t)ret_conv;
10620 int64_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
10621 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
10622 int64_t ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
10626 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
10627 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
10628 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10629 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
10630 return (uint64_t)ret_conv;
10633 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_ok() {
10634 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10635 *ret_conv = CResult_NoneNoneZ_ok();
10636 return (uint64_t)ret_conv;
10639 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_err() {
10640 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10641 *ret_conv = CResult_NoneNoneZ_err();
10642 return (uint64_t)ret_conv;
10645 jboolean __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_is_ok(uint32_t o) {
10646 LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)(o & ~1);
10647 jboolean ret_val = CResult_NoneNoneZ_is_ok(o_conv);
10651 void __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_free(uint32_t _res) {
10652 if ((_res & 1) != 0) return;
10653 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10654 CHECK_ACCESS(_res_ptr);
10655 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
10657 CResult_NoneNoneZ_free(_res_conv);
10660 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
10661 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10662 *ret_conv = CResult_NoneNoneZ_clone(arg);
10663 return (uint64_t)ret_conv;
10665 int64_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_clone_ptr(uint32_t arg) {
10666 LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)(arg & ~1);
10667 int64_t ret_val = CResult_NoneNoneZ_clone_ptr(arg_conv);
10671 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_clone(uint32_t orig) {
10672 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
10673 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10674 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
10675 return (uint64_t)ret_conv;
10678 static inline uint64_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
10679 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
10680 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
10681 return ((uint64_t)ret_conv);
10683 int64_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(uint32_t arg) {
10684 LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(arg & ~1);
10685 int64_t ret_val = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
10689 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
10690 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
10691 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
10692 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
10693 return ((uint64_t)ret_conv);
10696 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
10697 LDKSignature a_ref;
10698 CHECK(*((uint32_t*)a) == 64);
10699 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
10700 LDKCVec_SignatureZ b_constr;
10701 b_constr.datalen = *((uint32_t*)b);
10702 if (b_constr.datalen > 0)
10703 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
10705 b_constr.data = NULL;
10706 int8_tArray* b_vals = (int8_tArray*)(b + 4);
10707 for (size_t m = 0; m < b_constr.datalen; m++) {
10708 int8_tArray b_conv_12 = b_vals[m];
10709 LDKSignature b_conv_12_ref;
10710 CHECK(*((uint32_t*)b_conv_12) == 64);
10711 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
10712 b_constr.data[m] = b_conv_12_ref;
10714 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
10715 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
10716 return ((uint64_t)ret_conv);
10719 void __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
10720 if ((_res & 1) != 0) return;
10721 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10722 CHECK_ACCESS(_res_ptr);
10723 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
10725 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
10728 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
10729 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10730 CHECK_ACCESS(o_ptr);
10731 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
10732 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1));
10733 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10734 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
10735 return (uint64_t)ret_conv;
10738 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
10739 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10740 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
10741 return (uint64_t)ret_conv;
10744 jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(uint32_t o) {
10745 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(o & ~1);
10746 jboolean ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
10750 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
10751 if ((_res & 1) != 0) return;
10752 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10753 CHECK_ACCESS(_res_ptr);
10754 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
10756 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
10759 static inline uint64_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
10760 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10761 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
10762 return (uint64_t)ret_conv;
10764 int64_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(uint32_t arg) {
10765 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
10766 int64_t ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
10770 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
10771 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
10772 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10773 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
10774 return (uint64_t)ret_conv;
10777 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
10778 LDKSignature o_ref;
10779 CHECK(*((uint32_t*)o) == 64);
10780 memcpy(o_ref.compact_form, (uint8_t*)(o + 4), 64);
10781 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10782 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
10783 return (uint64_t)ret_conv;
10786 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_err() {
10787 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10788 *ret_conv = CResult_SignatureNoneZ_err();
10789 return (uint64_t)ret_conv;
10792 jboolean __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_is_ok(uint32_t o) {
10793 LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)(o & ~1);
10794 jboolean ret_val = CResult_SignatureNoneZ_is_ok(o_conv);
10798 void __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
10799 if ((_res & 1) != 0) return;
10800 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10801 CHECK_ACCESS(_res_ptr);
10802 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
10804 CResult_SignatureNoneZ_free(_res_conv);
10807 static inline uint64_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
10808 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10809 *ret_conv = CResult_SignatureNoneZ_clone(arg);
10810 return (uint64_t)ret_conv;
10812 int64_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone_ptr(uint32_t arg) {
10813 LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)(arg & ~1);
10814 int64_t ret_val = CResult_SignatureNoneZ_clone_ptr(arg_conv);
10818 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
10819 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
10820 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10821 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
10822 return (uint64_t)ret_conv;
10825 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
10826 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10827 CHECK_ACCESS(o_ptr);
10828 LDKSign o_conv = *(LDKSign*)(o_ptr);
10829 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10830 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
10831 return (uint64_t)ret_conv;
10834 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
10835 LDKDecodeError e_conv;
10836 e_conv.inner = (void*)(e & (~1));
10837 e_conv.is_owned = (e & 1) || (e == 0);
10838 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10839 e_conv = DecodeError_clone(&e_conv);
10840 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10841 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
10842 return (uint64_t)ret_conv;
10845 jboolean __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_is_ok(uint32_t o) {
10846 LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)(o & ~1);
10847 jboolean ret_val = CResult_SignDecodeErrorZ_is_ok(o_conv);
10851 void __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
10852 if ((_res & 1) != 0) return;
10853 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10854 CHECK_ACCESS(_res_ptr);
10855 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
10857 CResult_SignDecodeErrorZ_free(_res_conv);
10860 static inline uint64_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
10861 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10862 *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
10863 return (uint64_t)ret_conv;
10865 int64_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_clone_ptr(uint32_t arg) {
10866 LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
10867 int64_t ret_val = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
10871 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
10872 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
10873 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10874 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
10875 return (uint64_t)ret_conv;
10878 void __attribute__((visibility("default"))) TS_CVec_u8Z_free(int8_tArray _res) {
10879 LDKCVec_u8Z _res_ref;
10880 _res_ref.datalen = *((uint32_t*)_res);
10881 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
10882 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
10883 CVec_u8Z_free(_res_ref);
10886 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray arg) {
10887 LDKRecoverableSignature arg_ref;
10888 CHECK(*((uint32_t*)arg) == 68);
10889 memcpy(arg_ref.serialized_form, (uint8_t*)(arg + 4), 68);
10890 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10891 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
10892 return (uint64_t)ret_conv;
10895 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_err() {
10896 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10897 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
10898 return (uint64_t)ret_conv;
10901 jboolean __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint32_t o) {
10902 LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)(o & ~1);
10903 jboolean ret_val = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
10907 void __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_free(uint32_t _res) {
10908 if ((_res & 1) != 0) return;
10909 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10910 CHECK_ACCESS(_res_ptr);
10911 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
10913 CResult_RecoverableSignatureNoneZ_free(_res_conv);
10916 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
10917 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10918 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
10919 return (uint64_t)ret_conv;
10921 int64_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint32_t arg) {
10922 LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
10923 int64_t ret_val = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
10927 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint32_t orig) {
10928 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
10929 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10930 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
10931 return (uint64_t)ret_conv;
10934 void __attribute__((visibility("default"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
10935 LDKCVec_CVec_u8ZZ _res_constr;
10936 _res_constr.datalen = *((uint32_t*)_res);
10937 if (_res_constr.datalen > 0)
10938 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
10940 _res_constr.data = NULL;
10941 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
10942 for (size_t m = 0; m < _res_constr.datalen; m++) {
10943 int8_tArray _res_conv_12 = _res_vals[m];
10944 LDKCVec_u8Z _res_conv_12_ref;
10945 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
10946 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
10947 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
10948 _res_constr.data[m] = _res_conv_12_ref;
10950 CVec_CVec_u8ZZ_free(_res_constr);
10953 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
10954 LDKCVec_CVec_u8ZZ o_constr;
10955 o_constr.datalen = *((uint32_t*)o);
10956 if (o_constr.datalen > 0)
10957 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
10959 o_constr.data = NULL;
10960 int8_tArray* o_vals = (int8_tArray*)(o + 4);
10961 for (size_t m = 0; m < o_constr.datalen; m++) {
10962 int8_tArray o_conv_12 = o_vals[m];
10963 LDKCVec_u8Z o_conv_12_ref;
10964 o_conv_12_ref.datalen = *((uint32_t*)o_conv_12);
10965 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
10966 memcpy(o_conv_12_ref.data, (uint8_t*)(o_conv_12 + 4), o_conv_12_ref.datalen);
10967 o_constr.data[m] = o_conv_12_ref;
10969 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10970 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
10971 return (uint64_t)ret_conv;
10974 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
10975 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10976 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
10977 return (uint64_t)ret_conv;
10980 jboolean __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint32_t o) {
10981 LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(o & ~1);
10982 jboolean ret_val = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
10986 void __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
10987 if ((_res & 1) != 0) return;
10988 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10989 CHECK_ACCESS(_res_ptr);
10990 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
10992 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
10995 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
10996 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10997 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
10998 return (uint64_t)ret_conv;
11000 int64_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint32_t arg) {
11001 LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
11002 int64_t ret_val = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
11006 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
11007 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
11008 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
11009 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
11010 return (uint64_t)ret_conv;
11013 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
11014 LDKInMemorySigner o_conv;
11015 o_conv.inner = (void*)(o & (~1));
11016 o_conv.is_owned = (o & 1) || (o == 0);
11017 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11018 o_conv = InMemorySigner_clone(&o_conv);
11019 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
11020 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
11021 return (uint64_t)ret_conv;
11024 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
11025 LDKDecodeError e_conv;
11026 e_conv.inner = (void*)(e & (~1));
11027 e_conv.is_owned = (e & 1) || (e == 0);
11028 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11029 e_conv = DecodeError_clone(&e_conv);
11030 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
11031 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
11032 return (uint64_t)ret_conv;
11035 jboolean __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint32_t o) {
11036 LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(o & ~1);
11037 jboolean ret_val = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
11041 void __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
11042 if ((_res & 1) != 0) return;
11043 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11044 CHECK_ACCESS(_res_ptr);
11045 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
11047 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
11050 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
11051 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
11052 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
11053 return (uint64_t)ret_conv;
11055 int64_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint32_t arg) {
11056 LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
11057 int64_t ret_val = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
11061 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
11062 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
11063 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
11064 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
11065 return (uint64_t)ret_conv;
11068 void __attribute__((visibility("default"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
11069 LDKCVec_TxOutZ _res_constr;
11070 _res_constr.datalen = *((uint32_t*)_res);
11071 if (_res_constr.datalen > 0)
11072 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
11074 _res_constr.data = NULL;
11075 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11076 for (size_t h = 0; h < _res_constr.datalen; h++) {
11077 uint32_t _res_conv_7 = _res_vals[h];
11078 void* _res_conv_7_ptr = (void*)(((uint64_t)_res_conv_7) & ~1);
11079 CHECK_ACCESS(_res_conv_7_ptr);
11080 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
11081 FREE((void*)_res_conv_7);
11082 _res_constr.data[h] = _res_conv_7_conv;
11084 CVec_TxOutZ_free(_res_constr);
11087 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
11088 LDKTransaction o_ref;
11089 o_ref.datalen = *((uint32_t*)o);
11090 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
11091 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
11092 o_ref.data_is_owned = true;
11093 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
11094 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
11095 return (uint64_t)ret_conv;
11098 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_err() {
11099 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
11100 *ret_conv = CResult_TransactionNoneZ_err();
11101 return (uint64_t)ret_conv;
11104 jboolean __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_is_ok(uint32_t o) {
11105 LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)(o & ~1);
11106 jboolean ret_val = CResult_TransactionNoneZ_is_ok(o_conv);
11110 void __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
11111 if ((_res & 1) != 0) return;
11112 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11113 CHECK_ACCESS(_res_ptr);
11114 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
11116 CResult_TransactionNoneZ_free(_res_conv);
11119 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
11120 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
11121 *ret_conv = CResult_TransactionNoneZ_clone(arg);
11122 return (uint64_t)ret_conv;
11124 int64_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_clone_ptr(uint32_t arg) {
11125 LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)(arg & ~1);
11126 int64_t ret_val = CResult_TransactionNoneZ_clone_ptr(arg_conv);
11130 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_clone(uint32_t orig) {
11131 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
11132 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
11133 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
11134 return (uint64_t)ret_conv;
11137 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
11138 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
11139 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
11140 return ((uint64_t)ret_conv);
11142 int64_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint32_t arg) {
11143 LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(arg & ~1);
11144 int64_t ret_val = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
11148 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint32_t orig) {
11149 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
11150 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
11151 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
11152 return ((uint64_t)ret_conv);
11155 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
11156 LDKThirtyTwoBytes a_ref;
11157 CHECK(*((uint32_t*)a) == 32);
11158 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
11159 LDKChannelMonitor b_conv;
11160 b_conv.inner = (void*)(b & (~1));
11161 b_conv.is_owned = (b & 1) || (b == 0);
11162 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
11163 b_conv = ChannelMonitor_clone(&b_conv);
11164 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
11165 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
11166 return ((uint64_t)ret_conv);
11169 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
11170 if ((_res & 1) != 0) return;
11171 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11172 CHECK_ACCESS(_res_ptr);
11173 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
11175 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
11178 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_BlockHashChannelMonitorZZ_free(uint32_tArray _res) {
11179 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
11180 _res_constr.datalen = *((uint32_t*)_res);
11181 if (_res_constr.datalen > 0)
11182 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
11184 _res_constr.data = NULL;
11185 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11186 for (size_t j = 0; j < _res_constr.datalen; j++) {
11187 uint32_t _res_conv_35 = _res_vals[j];
11188 void* _res_conv_35_ptr = (void*)(((uint64_t)_res_conv_35) & ~1);
11189 CHECK_ACCESS(_res_conv_35_ptr);
11190 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_conv_35_ptr);
11191 FREE((void*)_res_conv_35);
11192 _res_constr.data[j] = _res_conv_35_conv;
11194 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
11197 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(uint32_tArray o) {
11198 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
11199 o_constr.datalen = *((uint32_t*)o);
11200 if (o_constr.datalen > 0)
11201 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
11203 o_constr.data = NULL;
11204 uint32_t* o_vals = (uint32_t*)(o + 4);
11205 for (size_t j = 0; j < o_constr.datalen; j++) {
11206 uint32_t o_conv_35 = o_vals[j];
11207 void* o_conv_35_ptr = (void*)(((uint64_t)o_conv_35) & ~1);
11208 CHECK_ACCESS(o_conv_35_ptr);
11209 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_conv_35_ptr);
11210 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_35) & ~1));
11211 o_constr.data[j] = o_conv_35_conv;
11213 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
11214 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
11215 return (uint64_t)ret_conv;
11218 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(uint32_t e) {
11219 LDKIOError e_conv = LDKIOError_from_js(e);
11220 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
11221 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
11222 return (uint64_t)ret_conv;
11225 jboolean __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(uint32_t o) {
11226 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(o & ~1);
11227 jboolean ret_val = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o_conv);
11231 void __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(uint32_t _res) {
11232 if ((_res & 1) != 0) return;
11233 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11234 CHECK_ACCESS(_res_ptr);
11235 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(_res_ptr);
11237 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
11240 static inline uint64_t CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR arg) {
11241 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
11242 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(arg);
11243 return (uint64_t)ret_conv;
11245 int64_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(uint32_t arg) {
11246 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
11247 int64_t ret_val = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(arg_conv);
11251 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(uint32_t orig) {
11252 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(orig & ~1);
11253 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
11254 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
11255 return (uint64_t)ret_conv;
11258 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_some(int16_t o) {
11259 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
11260 *ret_copy = COption_u16Z_some(o);
11261 uint64_t ret_ref = (uint64_t)ret_copy;
11265 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_none() {
11266 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
11267 *ret_copy = COption_u16Z_none();
11268 uint64_t ret_ref = (uint64_t)ret_copy;
11272 void __attribute__((visibility("default"))) TS_COption_u16Z_free(uint32_t _res) {
11273 if ((_res & 1) != 0) return;
11274 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11275 CHECK_ACCESS(_res_ptr);
11276 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
11278 COption_u16Z_free(_res_conv);
11281 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
11282 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
11283 *ret_copy = COption_u16Z_clone(arg);
11284 uint64_t ret_ref = (uint64_t)ret_copy;
11287 int64_t __attribute__((visibility("default"))) TS_COption_u16Z_clone_ptr(uint32_t arg) {
11288 LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)arg;
11289 int64_t ret_val = COption_u16Z_clone_ptr(arg_conv);
11293 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_clone(uint32_t orig) {
11294 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
11295 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
11296 *ret_copy = COption_u16Z_clone(orig_conv);
11297 uint64_t ret_ref = (uint64_t)ret_copy;
11301 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_ok() {
11302 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11303 *ret_conv = CResult_NoneAPIErrorZ_ok();
11304 return (uint64_t)ret_conv;
11307 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
11308 void* e_ptr = (void*)(((uint64_t)e) & ~1);
11309 CHECK_ACCESS(e_ptr);
11310 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
11311 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
11312 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11313 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
11314 return (uint64_t)ret_conv;
11317 jboolean __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_is_ok(uint32_t o) {
11318 LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)(o & ~1);
11319 jboolean ret_val = CResult_NoneAPIErrorZ_is_ok(o_conv);
11323 void __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
11324 if ((_res & 1) != 0) return;
11325 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11326 CHECK_ACCESS(_res_ptr);
11327 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
11329 CResult_NoneAPIErrorZ_free(_res_conv);
11332 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
11333 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11334 *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
11335 return (uint64_t)ret_conv;
11337 int64_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint32_t arg) {
11338 LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
11339 int64_t ret_val = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
11343 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
11344 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
11345 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11346 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
11347 return (uint64_t)ret_conv;
11350 void __attribute__((visibility("default"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
11351 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
11352 _res_constr.datalen = *((uint32_t*)_res);
11353 if (_res_constr.datalen > 0)
11354 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
11356 _res_constr.data = NULL;
11357 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11358 for (size_t w = 0; w < _res_constr.datalen; w++) {
11359 uint32_t _res_conv_22 = _res_vals[w];
11360 void* _res_conv_22_ptr = (void*)(((uint64_t)_res_conv_22) & ~1);
11361 CHECK_ACCESS(_res_conv_22_ptr);
11362 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
11363 FREE((void*)_res_conv_22);
11364 _res_constr.data[w] = _res_conv_22_conv;
11366 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
11369 void __attribute__((visibility("default"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
11370 LDKCVec_APIErrorZ _res_constr;
11371 _res_constr.datalen = *((uint32_t*)_res);
11372 if (_res_constr.datalen > 0)
11373 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
11375 _res_constr.data = NULL;
11376 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11377 for (size_t k = 0; k < _res_constr.datalen; k++) {
11378 uint32_t _res_conv_10 = _res_vals[k];
11379 void* _res_conv_10_ptr = (void*)(((uint64_t)_res_conv_10) & ~1);
11380 CHECK_ACCESS(_res_conv_10_ptr);
11381 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
11382 FREE((void*)_res_conv_10);
11383 _res_constr.data[k] = _res_conv_10_conv;
11385 CVec_APIErrorZ_free(_res_constr);
11388 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
11389 LDKThirtyTwoBytes o_ref;
11390 CHECK(*((uint32_t*)o) == 32);
11391 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
11392 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
11393 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
11394 return (uint64_t)ret_conv;
11397 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_err(uint32_t e) {
11398 void* e_ptr = (void*)(((uint64_t)e) & ~1);
11399 CHECK_ACCESS(e_ptr);
11400 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
11401 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
11402 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
11403 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
11404 return (uint64_t)ret_conv;
11407 jboolean __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_is_ok(uint32_t o) {
11408 LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)(o & ~1);
11409 jboolean ret_val = CResult__u832APIErrorZ_is_ok(o_conv);
11413 void __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_free(uint32_t _res) {
11414 if ((_res & 1) != 0) return;
11415 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11416 CHECK_ACCESS(_res_ptr);
11417 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
11419 CResult__u832APIErrorZ_free(_res_conv);
11422 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
11423 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
11424 *ret_conv = CResult__u832APIErrorZ_clone(arg);
11425 return (uint64_t)ret_conv;
11427 int64_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_clone_ptr(uint32_t arg) {
11428 LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)(arg & ~1);
11429 int64_t ret_val = CResult__u832APIErrorZ_clone_ptr(arg_conv);
11433 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_clone(uint32_t orig) {
11434 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
11435 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
11436 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
11437 return (uint64_t)ret_conv;
11440 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_ok(int8_tArray o) {
11441 LDKThirtyTwoBytes o_ref;
11442 CHECK(*((uint32_t*)o) == 32);
11443 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
11444 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
11445 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
11446 return (uint64_t)ret_conv;
11449 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_err(uint32_t e) {
11450 void* e_ptr = (void*)(((uint64_t)e) & ~1);
11451 CHECK_ACCESS(e_ptr);
11452 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
11453 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
11454 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
11455 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
11456 return (uint64_t)ret_conv;
11459 jboolean __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_is_ok(uint32_t o) {
11460 LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(o & ~1);
11461 jboolean ret_val = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
11465 void __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_free(uint32_t _res) {
11466 if ((_res & 1) != 0) return;
11467 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11468 CHECK_ACCESS(_res_ptr);
11469 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
11471 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
11474 static inline uint64_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
11475 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
11476 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
11477 return (uint64_t)ret_conv;
11479 int64_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr(uint32_t arg) {
11480 LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
11481 int64_t ret_val = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
11485 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone(uint32_t orig) {
11486 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
11487 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
11488 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
11489 return (uint64_t)ret_conv;
11492 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_ok() {
11493 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11494 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
11495 return (uint64_t)ret_conv;
11498 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
11499 void* e_ptr = (void*)(((uint64_t)e) & ~1);
11500 CHECK_ACCESS(e_ptr);
11501 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
11502 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
11503 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11504 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
11505 return (uint64_t)ret_conv;
11508 jboolean __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint32_t o) {
11509 LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)(o & ~1);
11510 jboolean ret_val = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
11514 void __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
11515 if ((_res & 1) != 0) return;
11516 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11517 CHECK_ACCESS(_res_ptr);
11518 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
11520 CResult_NonePaymentSendFailureZ_free(_res_conv);
11523 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
11524 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11525 *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
11526 return (uint64_t)ret_conv;
11528 int64_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint32_t arg) {
11529 LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
11530 int64_t ret_val = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
11534 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
11535 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
11536 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11537 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
11538 return (uint64_t)ret_conv;
11541 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
11542 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
11543 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
11544 return ((uint64_t)ret_conv);
11546 int64_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint32_t arg) {
11547 LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(arg & ~1);
11548 int64_t ret_val = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
11552 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint32_t orig) {
11553 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
11554 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
11555 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
11556 return ((uint64_t)ret_conv);
11559 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
11560 LDKThirtyTwoBytes a_ref;
11561 CHECK(*((uint32_t*)a) == 32);
11562 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
11563 LDKThirtyTwoBytes b_ref;
11564 CHECK(*((uint32_t*)b) == 32);
11565 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
11566 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
11567 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
11568 return ((uint64_t)ret_conv);
11571 void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint32_t _res) {
11572 if ((_res & 1) != 0) return;
11573 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11574 CHECK_ACCESS(_res_ptr);
11575 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
11577 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
11580 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint32_t o) {
11581 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11582 CHECK_ACCESS(o_ptr);
11583 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
11584 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)o) & ~1));
11585 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
11586 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
11587 return (uint64_t)ret_conv;
11590 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint32_t e) {
11591 void* e_ptr = (void*)(((uint64_t)e) & ~1);
11592 CHECK_ACCESS(e_ptr);
11593 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
11594 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
11595 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
11596 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
11597 return (uint64_t)ret_conv;
11600 jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint32_t o) {
11601 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(o & ~1);
11602 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
11606 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint32_t _res) {
11607 if ((_res & 1) != 0) return;
11608 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11609 CHECK_ACCESS(_res_ptr);
11610 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
11612 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
11615 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
11616 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
11617 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
11618 return (uint64_t)ret_conv;
11620 int64_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint32_t arg) {
11621 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
11622 int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
11626 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint32_t orig) {
11627 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
11628 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
11629 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
11630 return (uint64_t)ret_conv;
11633 void __attribute__((visibility("default"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
11634 LDKCVec_NetAddressZ _res_constr;
11635 _res_constr.datalen = *((uint32_t*)_res);
11636 if (_res_constr.datalen > 0)
11637 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
11639 _res_constr.data = NULL;
11640 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11641 for (size_t m = 0; m < _res_constr.datalen; m++) {
11642 uint32_t _res_conv_12 = _res_vals[m];
11643 void* _res_conv_12_ptr = (void*)(((uint64_t)_res_conv_12) & ~1);
11644 CHECK_ACCESS(_res_conv_12_ptr);
11645 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
11646 FREE((void*)_res_conv_12);
11647 _res_constr.data[m] = _res_conv_12_conv;
11649 CVec_NetAddressZ_free(_res_constr);
11652 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
11653 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
11654 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
11655 return ((uint64_t)ret_conv);
11657 int64_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint32_t arg) {
11658 LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(arg & ~1);
11659 int64_t ret_val = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
11663 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint32_t orig) {
11664 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
11665 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
11666 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
11667 return ((uint64_t)ret_conv);
11670 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
11671 LDKThirtyTwoBytes a_ref;
11672 CHECK(*((uint32_t*)a) == 32);
11673 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
11674 LDKThirtyTwoBytes b_ref;
11675 CHECK(*((uint32_t*)b) == 32);
11676 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
11677 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
11678 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
11679 return ((uint64_t)ret_conv);
11682 void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint32_t _res) {
11683 if ((_res & 1) != 0) return;
11684 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11685 CHECK_ACCESS(_res_ptr);
11686 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
11688 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
11691 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint32_t o) {
11692 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11693 CHECK_ACCESS(o_ptr);
11694 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
11695 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)o) & ~1));
11696 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
11697 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
11698 return (uint64_t)ret_conv;
11701 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() {
11702 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
11703 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
11704 return (uint64_t)ret_conv;
11707 jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint32_t o) {
11708 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(o & ~1);
11709 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
11713 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint32_t _res) {
11714 if ((_res & 1) != 0) return;
11715 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11716 CHECK_ACCESS(_res_ptr);
11717 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
11719 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
11722 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
11723 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
11724 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
11725 return (uint64_t)ret_conv;
11727 int64_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint32_t arg) {
11728 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1);
11729 int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
11733 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint32_t orig) {
11734 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(orig & ~1);
11735 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
11736 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
11737 return (uint64_t)ret_conv;
11740 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(uint32_t o) {
11741 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11742 CHECK_ACCESS(o_ptr);
11743 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
11744 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)o) & ~1));
11745 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
11746 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
11747 return (uint64_t)ret_conv;
11750 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(uint32_t e) {
11751 void* e_ptr = (void*)(((uint64_t)e) & ~1);
11752 CHECK_ACCESS(e_ptr);
11753 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
11754 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
11755 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
11756 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
11757 return (uint64_t)ret_conv;
11760 jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(uint32_t o) {
11761 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(o & ~1);
11762 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
11766 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(uint32_t _res) {
11767 if ((_res & 1) != 0) return;
11768 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11769 CHECK_ACCESS(_res_ptr);
11770 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
11772 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
11775 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
11776 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
11777 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
11778 return (uint64_t)ret_conv;
11780 int64_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(uint32_t arg) {
11781 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1);
11782 int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
11786 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(uint32_t orig) {
11787 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(orig & ~1);
11788 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
11789 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
11790 return (uint64_t)ret_conv;
11793 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) {
11794 LDKThirtyTwoBytes o_ref;
11795 CHECK(*((uint32_t*)o) == 32);
11796 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
11797 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
11798 *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
11799 return (uint64_t)ret_conv;
11802 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_err() {
11803 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
11804 *ret_conv = CResult_PaymentSecretNoneZ_err();
11805 return (uint64_t)ret_conv;
11808 jboolean __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint32_t o) {
11809 LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)(o & ~1);
11810 jboolean ret_val = CResult_PaymentSecretNoneZ_is_ok(o_conv);
11814 void __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_free(uint32_t _res) {
11815 if ((_res & 1) != 0) return;
11816 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11817 CHECK_ACCESS(_res_ptr);
11818 LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
11820 CResult_PaymentSecretNoneZ_free(_res_conv);
11823 static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
11824 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
11825 *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
11826 return (uint64_t)ret_conv;
11828 int64_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint32_t arg) {
11829 LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1);
11830 int64_t ret_val = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
11834 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_clone(uint32_t orig) {
11835 LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)(orig & ~1);
11836 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
11837 *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
11838 return (uint64_t)ret_conv;
11841 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
11842 LDKThirtyTwoBytes o_ref;
11843 CHECK(*((uint32_t*)o) == 32);
11844 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
11845 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
11846 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
11847 return (uint64_t)ret_conv;
11850 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint32_t e) {
11851 void* e_ptr = (void*)(((uint64_t)e) & ~1);
11852 CHECK_ACCESS(e_ptr);
11853 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
11854 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
11855 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
11856 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
11857 return (uint64_t)ret_conv;
11860 jboolean __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_is_ok(uint32_t o) {
11861 LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(o & ~1);
11862 jboolean ret_val = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
11866 void __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint32_t _res) {
11867 if ((_res & 1) != 0) return;
11868 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11869 CHECK_ACCESS(_res_ptr);
11870 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
11872 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
11875 static inline uint64_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
11876 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
11877 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
11878 return (uint64_t)ret_conv;
11880 int64_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_clone_ptr(uint32_t arg) {
11881 LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
11882 int64_t ret_val = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
11886 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint32_t orig) {
11887 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
11888 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
11889 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
11890 return (uint64_t)ret_conv;
11893 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) {
11894 LDKThirtyTwoBytes o_ref;
11895 CHECK(*((uint32_t*)o) == 32);
11896 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
11897 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
11898 *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
11899 return (uint64_t)ret_conv;
11902 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint32_t e) {
11903 void* e_ptr = (void*)(((uint64_t)e) & ~1);
11904 CHECK_ACCESS(e_ptr);
11905 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
11906 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
11907 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
11908 *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
11909 return (uint64_t)ret_conv;
11912 jboolean __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint32_t o) {
11913 LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(o & ~1);
11914 jboolean ret_val = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
11918 void __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint32_t _res) {
11919 if ((_res & 1) != 0) return;
11920 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11921 CHECK_ACCESS(_res_ptr);
11922 LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
11924 CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
11927 static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
11928 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
11929 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
11930 return (uint64_t)ret_conv;
11932 int64_t __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint32_t arg) {
11933 LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1);
11934 int64_t ret_val = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
11938 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint32_t orig) {
11939 LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(orig & ~1);
11940 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
11941 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
11942 return (uint64_t)ret_conv;
11945 void __attribute__((visibility("default"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
11946 LDKCVec_ChannelMonitorZ _res_constr;
11947 _res_constr.datalen = *((uint32_t*)_res);
11948 if (_res_constr.datalen > 0)
11949 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
11951 _res_constr.data = NULL;
11952 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11953 for (size_t q = 0; q < _res_constr.datalen; q++) {
11954 uint32_t _res_conv_16 = _res_vals[q];
11955 LDKChannelMonitor _res_conv_16_conv;
11956 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
11957 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
11958 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
11959 _res_constr.data[q] = _res_conv_16_conv;
11961 CVec_ChannelMonitorZ_free(_res_constr);
11964 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
11965 LDKThirtyTwoBytes a_ref;
11966 CHECK(*((uint32_t*)a) == 32);
11967 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
11968 LDKChannelManager b_conv;
11969 b_conv.inner = (void*)(b & (~1));
11970 b_conv.is_owned = (b & 1) || (b == 0);
11971 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
11972 // Warning: we need a move here but no clone is available for LDKChannelManager
11973 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
11974 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
11975 return ((uint64_t)ret_conv);
11978 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
11979 if ((_res & 1) != 0) return;
11980 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11981 CHECK_ACCESS(_res_ptr);
11982 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
11984 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
11987 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
11988 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11989 CHECK_ACCESS(o_ptr);
11990 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
11991 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
11992 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
11993 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
11994 return (uint64_t)ret_conv;
11997 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
11998 LDKDecodeError e_conv;
11999 e_conv.inner = (void*)(e & (~1));
12000 e_conv.is_owned = (e & 1) || (e == 0);
12001 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12002 e_conv = DecodeError_clone(&e_conv);
12003 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
12004 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
12005 return (uint64_t)ret_conv;
12008 jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint32_t o) {
12009 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(o & ~1);
12010 jboolean ret_val = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
12014 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
12015 if ((_res & 1) != 0) return;
12016 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12017 CHECK_ACCESS(_res_ptr);
12018 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
12020 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
12023 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
12024 LDKChannelConfig o_conv;
12025 o_conv.inner = (void*)(o & (~1));
12026 o_conv.is_owned = (o & 1) || (o == 0);
12027 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12028 o_conv = ChannelConfig_clone(&o_conv);
12029 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
12030 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
12031 return (uint64_t)ret_conv;
12034 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
12035 LDKDecodeError e_conv;
12036 e_conv.inner = (void*)(e & (~1));
12037 e_conv.is_owned = (e & 1) || (e == 0);
12038 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12039 e_conv = DecodeError_clone(&e_conv);
12040 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
12041 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
12042 return (uint64_t)ret_conv;
12045 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint32_t o) {
12046 LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(o & ~1);
12047 jboolean ret_val = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
12051 void __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
12052 if ((_res & 1) != 0) return;
12053 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12054 CHECK_ACCESS(_res_ptr);
12055 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
12057 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
12060 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
12061 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
12062 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
12063 return (uint64_t)ret_conv;
12065 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint32_t arg) {
12066 LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
12067 int64_t ret_val = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
12071 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
12072 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
12073 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
12074 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
12075 return (uint64_t)ret_conv;
12078 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
12079 LDKOutPoint o_conv;
12080 o_conv.inner = (void*)(o & (~1));
12081 o_conv.is_owned = (o & 1) || (o == 0);
12082 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12083 o_conv = OutPoint_clone(&o_conv);
12084 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
12085 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
12086 return (uint64_t)ret_conv;
12089 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
12090 LDKDecodeError e_conv;
12091 e_conv.inner = (void*)(e & (~1));
12092 e_conv.is_owned = (e & 1) || (e == 0);
12093 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12094 e_conv = DecodeError_clone(&e_conv);
12095 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
12096 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
12097 return (uint64_t)ret_conv;
12100 jboolean __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint32_t o) {
12101 LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)(o & ~1);
12102 jboolean ret_val = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
12106 void __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
12107 if ((_res & 1) != 0) return;
12108 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12109 CHECK_ACCESS(_res_ptr);
12110 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
12112 CResult_OutPointDecodeErrorZ_free(_res_conv);
12115 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
12116 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
12117 *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
12118 return (uint64_t)ret_conv;
12120 int64_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint32_t arg) {
12121 LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
12122 int64_t ret_val = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
12126 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
12127 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
12128 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
12129 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
12130 return (uint64_t)ret_conv;
12133 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_some(uint32_t o) {
12134 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12135 CHECK_ACCESS(o_ptr);
12136 LDKType o_conv = *(LDKType*)(o_ptr);
12137 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
12138 *ret_copy = COption_TypeZ_some(o_conv);
12139 uint64_t ret_ref = (uint64_t)ret_copy;
12143 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_none() {
12144 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
12145 *ret_copy = COption_TypeZ_none();
12146 uint64_t ret_ref = (uint64_t)ret_copy;
12150 void __attribute__((visibility("default"))) TS_COption_TypeZ_free(uint32_t _res) {
12151 if ((_res & 1) != 0) return;
12152 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12153 CHECK_ACCESS(_res_ptr);
12154 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
12156 COption_TypeZ_free(_res_conv);
12159 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
12160 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
12161 *ret_copy = COption_TypeZ_clone(arg);
12162 uint64_t ret_ref = (uint64_t)ret_copy;
12165 int64_t __attribute__((visibility("default"))) TS_COption_TypeZ_clone_ptr(uint32_t arg) {
12166 LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)arg;
12167 int64_t ret_val = COption_TypeZ_clone_ptr(arg_conv);
12171 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_clone(uint32_t orig) {
12172 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
12173 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
12174 *ret_copy = COption_TypeZ_clone(orig_conv);
12175 uint64_t ret_ref = (uint64_t)ret_copy;
12179 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint32_t o) {
12180 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12181 CHECK_ACCESS(o_ptr);
12182 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
12183 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uint64_t)o) & ~1));
12184 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
12185 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
12186 return (uint64_t)ret_conv;
12189 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint32_t e) {
12190 LDKDecodeError e_conv;
12191 e_conv.inner = (void*)(e & (~1));
12192 e_conv.is_owned = (e & 1) || (e == 0);
12193 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12194 e_conv = DecodeError_clone(&e_conv);
12195 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
12196 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
12197 return (uint64_t)ret_conv;
12200 jboolean __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint32_t o) {
12201 LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(o & ~1);
12202 jboolean ret_val = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
12206 void __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint32_t _res) {
12207 if ((_res & 1) != 0) return;
12208 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12209 CHECK_ACCESS(_res_ptr);
12210 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
12212 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
12215 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
12216 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
12217 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
12218 return (uint64_t)ret_conv;
12220 int64_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint32_t arg) {
12221 LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
12222 int64_t ret_val = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
12226 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint32_t orig) {
12227 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
12228 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
12229 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
12230 return (uint64_t)ret_conv;
12233 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentErrorZ_ok(int8_tArray o) {
12234 LDKThirtyTwoBytes o_ref;
12235 CHECK(*((uint32_t*)o) == 32);
12236 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
12237 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
12238 *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
12239 return (uint64_t)ret_conv;
12242 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentErrorZ_err(uint32_t e) {
12243 void* e_ptr = (void*)(((uint64_t)e) & ~1);
12244 CHECK_ACCESS(e_ptr);
12245 LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
12246 e_conv = PaymentError_clone((LDKPaymentError*)(((uint64_t)e) & ~1));
12247 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
12248 *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
12249 return (uint64_t)ret_conv;
12252 jboolean __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentErrorZ_is_ok(uint32_t o) {
12253 LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(o & ~1);
12254 jboolean ret_val = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
12258 void __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentErrorZ_free(uint32_t _res) {
12259 if ((_res & 1) != 0) return;
12260 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12261 CHECK_ACCESS(_res_ptr);
12262 LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
12264 CResult_PaymentIdPaymentErrorZ_free(_res_conv);
12267 static inline uint64_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
12268 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
12269 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
12270 return (uint64_t)ret_conv;
12272 int64_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentErrorZ_clone_ptr(uint32_t arg) {
12273 LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
12274 int64_t ret_val = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
12278 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentErrorZ_clone(uint32_t orig) {
12279 LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(orig & ~1);
12280 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
12281 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
12282 return (uint64_t)ret_conv;
12285 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_ok(uint32_t o) {
12286 LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
12287 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
12288 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
12289 return (uint64_t)ret_conv;
12292 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_err() {
12293 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
12294 *ret_conv = CResult_SiPrefixNoneZ_err();
12295 return (uint64_t)ret_conv;
12298 jboolean __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_is_ok(uint32_t o) {
12299 LDKCResult_SiPrefixNoneZ* o_conv = (LDKCResult_SiPrefixNoneZ*)(o & ~1);
12300 jboolean ret_val = CResult_SiPrefixNoneZ_is_ok(o_conv);
12304 void __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_free(uint32_t _res) {
12305 if ((_res & 1) != 0) return;
12306 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12307 CHECK_ACCESS(_res_ptr);
12308 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(_res_ptr);
12310 CResult_SiPrefixNoneZ_free(_res_conv);
12313 static inline uint64_t CResult_SiPrefixNoneZ_clone_ptr(LDKCResult_SiPrefixNoneZ *NONNULL_PTR arg) {
12314 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
12315 *ret_conv = CResult_SiPrefixNoneZ_clone(arg);
12316 return (uint64_t)ret_conv;
12318 int64_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_clone_ptr(uint32_t arg) {
12319 LDKCResult_SiPrefixNoneZ* arg_conv = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
12320 int64_t ret_val = CResult_SiPrefixNoneZ_clone_ptr(arg_conv);
12324 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_clone(uint32_t orig) {
12325 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
12326 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
12327 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
12328 return (uint64_t)ret_conv;
12331 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_ok(uint32_t o) {
12333 o_conv.inner = (void*)(o & (~1));
12334 o_conv.is_owned = (o & 1) || (o == 0);
12335 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12336 o_conv = Invoice_clone(&o_conv);
12337 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
12338 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
12339 return (uint64_t)ret_conv;
12342 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_err() {
12343 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
12344 *ret_conv = CResult_InvoiceNoneZ_err();
12345 return (uint64_t)ret_conv;
12348 jboolean __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_is_ok(uint32_t o) {
12349 LDKCResult_InvoiceNoneZ* o_conv = (LDKCResult_InvoiceNoneZ*)(o & ~1);
12350 jboolean ret_val = CResult_InvoiceNoneZ_is_ok(o_conv);
12354 void __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_free(uint32_t _res) {
12355 if ((_res & 1) != 0) return;
12356 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12357 CHECK_ACCESS(_res_ptr);
12358 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(_res_ptr);
12360 CResult_InvoiceNoneZ_free(_res_conv);
12363 static inline uint64_t CResult_InvoiceNoneZ_clone_ptr(LDKCResult_InvoiceNoneZ *NONNULL_PTR arg) {
12364 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
12365 *ret_conv = CResult_InvoiceNoneZ_clone(arg);
12366 return (uint64_t)ret_conv;
12368 int64_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_clone_ptr(uint32_t arg) {
12369 LDKCResult_InvoiceNoneZ* arg_conv = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
12370 int64_t ret_val = CResult_InvoiceNoneZ_clone_ptr(arg_conv);
12374 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_clone(uint32_t orig) {
12375 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
12376 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
12377 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
12378 return (uint64_t)ret_conv;
12381 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_ok(uint32_t o) {
12382 LDKSignedRawInvoice o_conv;
12383 o_conv.inner = (void*)(o & (~1));
12384 o_conv.is_owned = (o & 1) || (o == 0);
12385 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12386 o_conv = SignedRawInvoice_clone(&o_conv);
12387 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
12388 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
12389 return (uint64_t)ret_conv;
12392 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_err() {
12393 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
12394 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
12395 return (uint64_t)ret_conv;
12398 jboolean __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_is_ok(uint32_t o) {
12399 LDKCResult_SignedRawInvoiceNoneZ* o_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(o & ~1);
12400 jboolean ret_val = CResult_SignedRawInvoiceNoneZ_is_ok(o_conv);
12404 void __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_free(uint32_t _res) {
12405 if ((_res & 1) != 0) return;
12406 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12407 CHECK_ACCESS(_res_ptr);
12408 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(_res_ptr);
12410 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
12413 static inline uint64_t CResult_SignedRawInvoiceNoneZ_clone_ptr(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR arg) {
12414 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
12415 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(arg);
12416 return (uint64_t)ret_conv;
12418 int64_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_clone_ptr(uint32_t arg) {
12419 LDKCResult_SignedRawInvoiceNoneZ* arg_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
12420 int64_t ret_val = CResult_SignedRawInvoiceNoneZ_clone_ptr(arg_conv);
12424 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_clone(uint32_t orig) {
12425 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
12426 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
12427 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
12428 return (uint64_t)ret_conv;
12431 static inline uint64_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
12432 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
12433 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
12434 return ((uint64_t)ret_conv);
12436 int64_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(uint32_t arg) {
12437 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(arg & ~1);
12438 int64_t ret_val = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
12442 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint32_t orig) {
12443 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
12444 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
12445 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
12446 return ((uint64_t)ret_conv);
12449 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint32_t a, int8_tArray b, uint32_t c) {
12450 LDKRawInvoice a_conv;
12451 a_conv.inner = (void*)(a & (~1));
12452 a_conv.is_owned = (a & 1) || (a == 0);
12453 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
12454 a_conv = RawInvoice_clone(&a_conv);
12455 LDKThirtyTwoBytes b_ref;
12456 CHECK(*((uint32_t*)b) == 32);
12457 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
12458 LDKInvoiceSignature c_conv;
12459 c_conv.inner = (void*)(c & (~1));
12460 c_conv.is_owned = (c & 1) || (c == 0);
12461 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
12462 c_conv = InvoiceSignature_clone(&c_conv);
12463 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
12464 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
12465 return ((uint64_t)ret_conv);
12468 void __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint32_t _res) {
12469 if ((_res & 1) != 0) return;
12470 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12471 CHECK_ACCESS(_res_ptr);
12472 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
12474 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
12477 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_ok(uint32_t o) {
12478 LDKPayeePubKey o_conv;
12479 o_conv.inner = (void*)(o & (~1));
12480 o_conv.is_owned = (o & 1) || (o == 0);
12481 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12482 o_conv = PayeePubKey_clone(&o_conv);
12483 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
12484 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
12485 return (uint64_t)ret_conv;
12488 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
12489 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
12490 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
12491 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
12492 return (uint64_t)ret_conv;
12495 jboolean __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_is_ok(uint32_t o) {
12496 LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)(o & ~1);
12497 jboolean ret_val = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
12501 void __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_free(uint32_t _res) {
12502 if ((_res & 1) != 0) return;
12503 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12504 CHECK_ACCESS(_res_ptr);
12505 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
12507 CResult_PayeePubKeyErrorZ_free(_res_conv);
12510 static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
12511 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
12512 *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
12513 return (uint64_t)ret_conv;
12515 int64_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_clone_ptr(uint32_t arg) {
12516 LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
12517 int64_t ret_val = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
12521 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_clone(uint32_t orig) {
12522 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
12523 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
12524 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
12525 return (uint64_t)ret_conv;
12528 void __attribute__((visibility("default"))) TS_CVec_PrivateRouteZ_free(uint32_tArray _res) {
12529 LDKCVec_PrivateRouteZ _res_constr;
12530 _res_constr.datalen = *((uint32_t*)_res);
12531 if (_res_constr.datalen > 0)
12532 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
12534 _res_constr.data = NULL;
12535 uint32_t* _res_vals = (uint32_t*)(_res + 4);
12536 for (size_t o = 0; o < _res_constr.datalen; o++) {
12537 uint32_t _res_conv_14 = _res_vals[o];
12538 LDKPrivateRoute _res_conv_14_conv;
12539 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
12540 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
12541 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
12542 _res_constr.data[o] = _res_conv_14_conv;
12544 CVec_PrivateRouteZ_free(_res_constr);
12547 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint32_t o) {
12548 LDKPositiveTimestamp o_conv;
12549 o_conv.inner = (void*)(o & (~1));
12550 o_conv.is_owned = (o & 1) || (o == 0);
12551 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12552 o_conv = PositiveTimestamp_clone(&o_conv);
12553 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
12554 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
12555 return (uint64_t)ret_conv;
12558 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
12559 LDKCreationError e_conv = LDKCreationError_from_js(e);
12560 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
12561 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
12562 return (uint64_t)ret_conv;
12565 jboolean __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint32_t o) {
12566 LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(o & ~1);
12567 jboolean ret_val = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
12571 void __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint32_t _res) {
12572 if ((_res & 1) != 0) return;
12573 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12574 CHECK_ACCESS(_res_ptr);
12575 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
12577 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
12580 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
12581 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
12582 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
12583 return (uint64_t)ret_conv;
12585 int64_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint32_t arg) {
12586 LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
12587 int64_t ret_val = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
12591 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint32_t orig) {
12592 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
12593 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
12594 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
12595 return (uint64_t)ret_conv;
12598 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_ok() {
12599 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
12600 *ret_conv = CResult_NoneSemanticErrorZ_ok();
12601 return (uint64_t)ret_conv;
12604 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
12605 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
12606 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
12607 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
12608 return (uint64_t)ret_conv;
12611 jboolean __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_is_ok(uint32_t o) {
12612 LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)(o & ~1);
12613 jboolean ret_val = CResult_NoneSemanticErrorZ_is_ok(o_conv);
12617 void __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_free(uint32_t _res) {
12618 if ((_res & 1) != 0) return;
12619 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12620 CHECK_ACCESS(_res_ptr);
12621 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
12623 CResult_NoneSemanticErrorZ_free(_res_conv);
12626 static inline uint64_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
12627 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
12628 *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
12629 return (uint64_t)ret_conv;
12631 int64_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_clone_ptr(uint32_t arg) {
12632 LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
12633 int64_t ret_val = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
12637 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_clone(uint32_t orig) {
12638 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
12639 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
12640 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
12641 return (uint64_t)ret_conv;
12644 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint32_t o) {
12646 o_conv.inner = (void*)(o & (~1));
12647 o_conv.is_owned = (o & 1) || (o == 0);
12648 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12649 o_conv = Invoice_clone(&o_conv);
12650 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
12651 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
12652 return (uint64_t)ret_conv;
12655 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
12656 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
12657 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
12658 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
12659 return (uint64_t)ret_conv;
12662 jboolean __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_is_ok(uint32_t o) {
12663 LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)(o & ~1);
12664 jboolean ret_val = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
12668 void __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_free(uint32_t _res) {
12669 if ((_res & 1) != 0) return;
12670 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12671 CHECK_ACCESS(_res_ptr);
12672 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
12674 CResult_InvoiceSemanticErrorZ_free(_res_conv);
12677 static inline uint64_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
12678 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
12679 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
12680 return (uint64_t)ret_conv;
12682 int64_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_clone_ptr(uint32_t arg) {
12683 LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
12684 int64_t ret_val = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
12688 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint32_t orig) {
12689 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
12690 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
12691 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
12692 return (uint64_t)ret_conv;
12695 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_ok(uint32_t o) {
12696 LDKDescription o_conv;
12697 o_conv.inner = (void*)(o & (~1));
12698 o_conv.is_owned = (o & 1) || (o == 0);
12699 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12700 o_conv = Description_clone(&o_conv);
12701 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
12702 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
12703 return (uint64_t)ret_conv;
12706 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
12707 LDKCreationError e_conv = LDKCreationError_from_js(e);
12708 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
12709 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
12710 return (uint64_t)ret_conv;
12713 jboolean __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint32_t o) {
12714 LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)(o & ~1);
12715 jboolean ret_val = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
12719 void __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_free(uint32_t _res) {
12720 if ((_res & 1) != 0) return;
12721 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12722 CHECK_ACCESS(_res_ptr);
12723 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
12725 CResult_DescriptionCreationErrorZ_free(_res_conv);
12728 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
12729 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
12730 *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
12731 return (uint64_t)ret_conv;
12733 int64_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint32_t arg) {
12734 LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
12735 int64_t ret_val = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
12739 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_clone(uint32_t orig) {
12740 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
12741 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
12742 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
12743 return (uint64_t)ret_conv;
12746 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_ok(uint32_t o) {
12747 LDKExpiryTime o_conv;
12748 o_conv.inner = (void*)(o & (~1));
12749 o_conv.is_owned = (o & 1) || (o == 0);
12750 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12751 o_conv = ExpiryTime_clone(&o_conv);
12752 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
12753 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
12754 return (uint64_t)ret_conv;
12757 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_err(uint32_t e) {
12758 LDKCreationError e_conv = LDKCreationError_from_js(e);
12759 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
12760 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
12761 return (uint64_t)ret_conv;
12764 jboolean __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_is_ok(uint32_t o) {
12765 LDKCResult_ExpiryTimeCreationErrorZ* o_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(o & ~1);
12766 jboolean ret_val = CResult_ExpiryTimeCreationErrorZ_is_ok(o_conv);
12770 void __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_free(uint32_t _res) {
12771 if ((_res & 1) != 0) return;
12772 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12773 CHECK_ACCESS(_res_ptr);
12774 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(_res_ptr);
12776 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
12779 static inline uint64_t CResult_ExpiryTimeCreationErrorZ_clone_ptr(LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR arg) {
12780 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
12781 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(arg);
12782 return (uint64_t)ret_conv;
12784 int64_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_clone_ptr(uint32_t arg) {
12785 LDKCResult_ExpiryTimeCreationErrorZ* arg_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
12786 int64_t ret_val = CResult_ExpiryTimeCreationErrorZ_clone_ptr(arg_conv);
12790 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_clone(uint32_t orig) {
12791 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
12792 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
12793 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
12794 return (uint64_t)ret_conv;
12797 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint32_t o) {
12798 LDKPrivateRoute o_conv;
12799 o_conv.inner = (void*)(o & (~1));
12800 o_conv.is_owned = (o & 1) || (o == 0);
12801 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12802 o_conv = PrivateRoute_clone(&o_conv);
12803 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
12804 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
12805 return (uint64_t)ret_conv;
12808 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
12809 LDKCreationError e_conv = LDKCreationError_from_js(e);
12810 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
12811 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
12812 return (uint64_t)ret_conv;
12815 jboolean __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint32_t o) {
12816 LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(o & ~1);
12817 jboolean ret_val = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
12821 void __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint32_t _res) {
12822 if ((_res & 1) != 0) return;
12823 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12824 CHECK_ACCESS(_res_ptr);
12825 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
12827 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
12830 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
12831 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
12832 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
12833 return (uint64_t)ret_conv;
12835 int64_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint32_t arg) {
12836 LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
12837 int64_t ret_val = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
12841 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint32_t orig) {
12842 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
12843 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
12844 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
12845 return (uint64_t)ret_conv;
12848 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_ok(jstring o) {
12849 LDKStr o_conv = str_ref_to_owned_c(o);
12850 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
12851 *ret_conv = CResult_StringErrorZ_ok(o_conv);
12852 return (uint64_t)ret_conv;
12855 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_err(uint32_t e) {
12856 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
12857 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
12858 *ret_conv = CResult_StringErrorZ_err(e_conv);
12859 return (uint64_t)ret_conv;
12862 jboolean __attribute__((visibility("default"))) TS_CResult_StringErrorZ_is_ok(uint32_t o) {
12863 LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)(o & ~1);
12864 jboolean ret_val = CResult_StringErrorZ_is_ok(o_conv);
12868 void __attribute__((visibility("default"))) TS_CResult_StringErrorZ_free(uint32_t _res) {
12869 if ((_res & 1) != 0) return;
12870 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12871 CHECK_ACCESS(_res_ptr);
12872 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
12874 CResult_StringErrorZ_free(_res_conv);
12877 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
12878 LDKChannelMonitorUpdate o_conv;
12879 o_conv.inner = (void*)(o & (~1));
12880 o_conv.is_owned = (o & 1) || (o == 0);
12881 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12882 o_conv = ChannelMonitorUpdate_clone(&o_conv);
12883 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
12884 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
12885 return (uint64_t)ret_conv;
12888 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
12889 LDKDecodeError e_conv;
12890 e_conv.inner = (void*)(e & (~1));
12891 e_conv.is_owned = (e & 1) || (e == 0);
12892 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12893 e_conv = DecodeError_clone(&e_conv);
12894 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
12895 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
12896 return (uint64_t)ret_conv;
12899 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint32_t o) {
12900 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(o & ~1);
12901 jboolean ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
12905 void __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
12906 if ((_res & 1) != 0) return;
12907 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12908 CHECK_ACCESS(_res_ptr);
12909 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
12911 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
12914 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
12915 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
12916 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
12917 return (uint64_t)ret_conv;
12919 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
12920 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
12921 int64_t ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
12925 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
12926 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
12927 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
12928 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
12929 return (uint64_t)ret_conv;
12932 uint32_t __attribute__((visibility("default"))) TS_COption_MonitorEventZ_some(uint32_t o) {
12933 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12934 CHECK_ACCESS(o_ptr);
12935 LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
12936 o_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)o) & ~1));
12937 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
12938 *ret_copy = COption_MonitorEventZ_some(o_conv);
12939 uint64_t ret_ref = (uint64_t)ret_copy;
12943 uint32_t __attribute__((visibility("default"))) TS_COption_MonitorEventZ_none() {
12944 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
12945 *ret_copy = COption_MonitorEventZ_none();
12946 uint64_t ret_ref = (uint64_t)ret_copy;
12950 void __attribute__((visibility("default"))) TS_COption_MonitorEventZ_free(uint32_t _res) {
12951 if ((_res & 1) != 0) return;
12952 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12953 CHECK_ACCESS(_res_ptr);
12954 LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
12956 COption_MonitorEventZ_free(_res_conv);
12959 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
12960 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
12961 *ret_copy = COption_MonitorEventZ_clone(arg);
12962 uint64_t ret_ref = (uint64_t)ret_copy;
12965 int64_t __attribute__((visibility("default"))) TS_COption_MonitorEventZ_clone_ptr(uint32_t arg) {
12966 LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)arg;
12967 int64_t ret_val = COption_MonitorEventZ_clone_ptr(arg_conv);
12971 uint32_t __attribute__((visibility("default"))) TS_COption_MonitorEventZ_clone(uint32_t orig) {
12972 LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)orig;
12973 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
12974 *ret_copy = COption_MonitorEventZ_clone(orig_conv);
12975 uint64_t ret_ref = (uint64_t)ret_copy;
12979 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint32_t o) {
12980 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12981 CHECK_ACCESS(o_ptr);
12982 LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
12983 o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)(((uint64_t)o) & ~1));
12984 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
12985 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
12986 return (uint64_t)ret_conv;
12989 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint32_t e) {
12990 LDKDecodeError e_conv;
12991 e_conv.inner = (void*)(e & (~1));
12992 e_conv.is_owned = (e & 1) || (e == 0);
12993 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12994 e_conv = DecodeError_clone(&e_conv);
12995 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
12996 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
12997 return (uint64_t)ret_conv;
13000 jboolean __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint32_t o) {
13001 LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(o & ~1);
13002 jboolean ret_val = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
13006 void __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint32_t _res) {
13007 if ((_res & 1) != 0) return;
13008 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13009 CHECK_ACCESS(_res_ptr);
13010 LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
13012 CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
13015 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
13016 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
13017 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
13018 return (uint64_t)ret_conv;
13020 int64_t __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint32_t arg) {
13021 LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
13022 int64_t ret_val = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
13026 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint32_t orig) {
13027 LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(orig & ~1);
13028 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
13029 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
13030 return (uint64_t)ret_conv;
13033 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
13034 LDKHTLCUpdate o_conv;
13035 o_conv.inner = (void*)(o & (~1));
13036 o_conv.is_owned = (o & 1) || (o == 0);
13037 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13038 o_conv = HTLCUpdate_clone(&o_conv);
13039 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
13040 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
13041 return (uint64_t)ret_conv;
13044 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
13045 LDKDecodeError e_conv;
13046 e_conv.inner = (void*)(e & (~1));
13047 e_conv.is_owned = (e & 1) || (e == 0);
13048 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13049 e_conv = DecodeError_clone(&e_conv);
13050 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
13051 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
13052 return (uint64_t)ret_conv;
13055 jboolean __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint32_t o) {
13056 LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(o & ~1);
13057 jboolean ret_val = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
13061 void __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
13062 if ((_res & 1) != 0) return;
13063 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13064 CHECK_ACCESS(_res_ptr);
13065 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
13067 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
13070 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
13071 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
13072 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
13073 return (uint64_t)ret_conv;
13075 int64_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
13076 LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
13077 int64_t ret_val = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
13081 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
13082 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
13083 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
13084 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
13085 return (uint64_t)ret_conv;
13088 static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
13089 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
13090 *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
13091 return ((uint64_t)ret_conv);
13093 int64_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_clone_ptr(uint32_t arg) {
13094 LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)(arg & ~1);
13095 int64_t ret_val = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
13099 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_clone(uint32_t orig) {
13100 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
13101 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
13102 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
13103 return ((uint64_t)ret_conv);
13106 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
13107 LDKOutPoint a_conv;
13108 a_conv.inner = (void*)(a & (~1));
13109 a_conv.is_owned = (a & 1) || (a == 0);
13110 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
13111 a_conv = OutPoint_clone(&a_conv);
13113 b_ref.datalen = *((uint32_t*)b);
13114 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
13115 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
13116 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
13117 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
13118 return ((uint64_t)ret_conv);
13121 void __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
13122 if ((_res & 1) != 0) return;
13123 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13124 CHECK_ACCESS(_res_ptr);
13125 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
13127 C2Tuple_OutPointScriptZ_free(_res_conv);
13130 static inline uint64_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
13131 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
13132 *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
13133 return ((uint64_t)ret_conv);
13135 int64_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_clone_ptr(uint32_t arg) {
13136 LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)(arg & ~1);
13137 int64_t ret_val = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
13141 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_clone(uint32_t orig) {
13142 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
13143 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
13144 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
13145 return ((uint64_t)ret_conv);
13148 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
13150 b_ref.datalen = *((uint32_t*)b);
13151 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
13152 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
13153 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
13154 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
13155 return ((uint64_t)ret_conv);
13158 void __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_free(uint32_t _res) {
13159 if ((_res & 1) != 0) return;
13160 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13161 CHECK_ACCESS(_res_ptr);
13162 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
13164 C2Tuple_u32ScriptZ_free(_res_conv);
13167 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint32_tArray _res) {
13168 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
13169 _res_constr.datalen = *((uint32_t*)_res);
13170 if (_res_constr.datalen > 0)
13171 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
13173 _res_constr.data = NULL;
13174 uint32_t* _res_vals = (uint32_t*)(_res + 4);
13175 for (size_t v = 0; v < _res_constr.datalen; v++) {
13176 uint32_t _res_conv_21 = _res_vals[v];
13177 void* _res_conv_21_ptr = (void*)(((uint64_t)_res_conv_21) & ~1);
13178 CHECK_ACCESS(_res_conv_21_ptr);
13179 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
13180 FREE((void*)_res_conv_21);
13181 _res_constr.data[v] = _res_conv_21_conv;
13183 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
13186 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
13187 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
13188 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
13189 return ((uint64_t)ret_conv);
13191 int64_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(uint32_t arg) {
13192 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(arg & ~1);
13193 int64_t ret_val = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
13197 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint32_t orig) {
13198 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
13199 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
13200 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
13201 return ((uint64_t)ret_conv);
13204 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
13205 LDKThirtyTwoBytes a_ref;
13206 CHECK(*((uint32_t*)a) == 32);
13207 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
13208 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
13209 b_constr.datalen = *((uint32_t*)b);
13210 if (b_constr.datalen > 0)
13211 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
13213 b_constr.data = NULL;
13214 uint32_t* b_vals = (uint32_t*)(b + 4);
13215 for (size_t v = 0; v < b_constr.datalen; v++) {
13216 uint32_t b_conv_21 = b_vals[v];
13217 void* b_conv_21_ptr = (void*)(((uint64_t)b_conv_21) & ~1);
13218 CHECK_ACCESS(b_conv_21_ptr);
13219 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
13220 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_21) & ~1));
13221 b_constr.data[v] = b_conv_21_conv;
13223 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
13224 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
13225 return ((uint64_t)ret_conv);
13228 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint32_t _res) {
13229 if ((_res & 1) != 0) return;
13230 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13231 CHECK_ACCESS(_res_ptr);
13232 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
13234 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
13237 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint32_tArray _res) {
13238 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
13239 _res_constr.datalen = *((uint32_t*)_res);
13240 if (_res_constr.datalen > 0)
13241 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
13243 _res_constr.data = NULL;
13244 uint32_t* _res_vals = (uint32_t*)(_res + 4);
13245 for (size_t o = 0; o < _res_constr.datalen; o++) {
13246 uint32_t _res_conv_40 = _res_vals[o];
13247 void* _res_conv_40_ptr = (void*)(((uint64_t)_res_conv_40) & ~1);
13248 CHECK_ACCESS(_res_conv_40_ptr);
13249 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
13250 FREE((void*)_res_conv_40);
13251 _res_constr.data[o] = _res_conv_40_conv;
13253 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
13256 void __attribute__((visibility("default"))) TS_CVec_EventZ_free(uint32_tArray _res) {
13257 LDKCVec_EventZ _res_constr;
13258 _res_constr.datalen = *((uint32_t*)_res);
13259 if (_res_constr.datalen > 0)
13260 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
13262 _res_constr.data = NULL;
13263 uint32_t* _res_vals = (uint32_t*)(_res + 4);
13264 for (size_t h = 0; h < _res_constr.datalen; h++) {
13265 uint32_t _res_conv_7 = _res_vals[h];
13266 void* _res_conv_7_ptr = (void*)(((uint64_t)_res_conv_7) & ~1);
13267 CHECK_ACCESS(_res_conv_7_ptr);
13268 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
13269 FREE((void*)_res_conv_7);
13270 _res_constr.data[h] = _res_conv_7_conv;
13272 CVec_EventZ_free(_res_constr);
13275 void __attribute__((visibility("default"))) TS_CVec_TransactionZ_free(ptrArray _res) {
13276 LDKCVec_TransactionZ _res_constr;
13277 _res_constr.datalen = *((uint32_t*)_res);
13278 if (_res_constr.datalen > 0)
13279 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
13281 _res_constr.data = NULL;
13282 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
13283 for (size_t m = 0; m < _res_constr.datalen; m++) {
13284 int8_tArray _res_conv_12 = _res_vals[m];
13285 LDKTransaction _res_conv_12_ref;
13286 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
13287 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
13288 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
13289 _res_conv_12_ref.data_is_owned = true;
13290 _res_constr.data[m] = _res_conv_12_ref;
13292 CVec_TransactionZ_free(_res_constr);
13295 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
13296 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
13297 *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
13298 return ((uint64_t)ret_conv);
13300 int64_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint32_t arg) {
13301 LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)(arg & ~1);
13302 int64_t ret_val = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
13306 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
13307 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
13308 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
13309 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
13310 return ((uint64_t)ret_conv);
13313 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
13314 void* b_ptr = (void*)(((uint64_t)b) & ~1);
13315 CHECK_ACCESS(b_ptr);
13316 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
13317 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
13318 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
13319 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
13320 return ((uint64_t)ret_conv);
13323 void __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
13324 if ((_res & 1) != 0) return;
13325 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13326 CHECK_ACCESS(_res_ptr);
13327 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
13329 C2Tuple_u32TxOutZ_free(_res_conv);
13332 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
13333 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
13334 _res_constr.datalen = *((uint32_t*)_res);
13335 if (_res_constr.datalen > 0)
13336 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
13338 _res_constr.data = NULL;
13339 uint32_t* _res_vals = (uint32_t*)(_res + 4);
13340 for (size_t u = 0; u < _res_constr.datalen; u++) {
13341 uint32_t _res_conv_20 = _res_vals[u];
13342 void* _res_conv_20_ptr = (void*)(((uint64_t)_res_conv_20) & ~1);
13343 CHECK_ACCESS(_res_conv_20_ptr);
13344 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
13345 FREE((void*)_res_conv_20);
13346 _res_constr.data[u] = _res_conv_20_conv;
13348 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
13351 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
13352 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
13353 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
13354 return ((uint64_t)ret_conv);
13356 int64_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint32_t arg) {
13357 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arg & ~1);
13358 int64_t ret_val = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
13362 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint32_t orig) {
13363 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
13364 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
13365 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
13366 return ((uint64_t)ret_conv);
13369 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
13370 LDKThirtyTwoBytes a_ref;
13371 CHECK(*((uint32_t*)a) == 32);
13372 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
13373 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
13374 b_constr.datalen = *((uint32_t*)b);
13375 if (b_constr.datalen > 0)
13376 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
13378 b_constr.data = NULL;
13379 uint32_t* b_vals = (uint32_t*)(b + 4);
13380 for (size_t u = 0; u < b_constr.datalen; u++) {
13381 uint32_t b_conv_20 = b_vals[u];
13382 void* b_conv_20_ptr = (void*)(((uint64_t)b_conv_20) & ~1);
13383 CHECK_ACCESS(b_conv_20_ptr);
13384 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
13385 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1));
13386 b_constr.data[u] = b_conv_20_conv;
13388 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
13389 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
13390 return ((uint64_t)ret_conv);
13393 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
13394 if ((_res & 1) != 0) return;
13395 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13396 CHECK_ACCESS(_res_ptr);
13397 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
13399 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
13402 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
13403 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
13404 _res_constr.datalen = *((uint32_t*)_res);
13405 if (_res_constr.datalen > 0)
13406 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
13408 _res_constr.data = NULL;
13409 uint32_t* _res_vals = (uint32_t*)(_res + 4);
13410 for (size_t n = 0; n < _res_constr.datalen; n++) {
13411 uint32_t _res_conv_39 = _res_vals[n];
13412 void* _res_conv_39_ptr = (void*)(((uint64_t)_res_conv_39) & ~1);
13413 CHECK_ACCESS(_res_conv_39_ptr);
13414 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
13415 FREE((void*)_res_conv_39);
13416 _res_constr.data[n] = _res_conv_39_conv;
13418 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
13421 void __attribute__((visibility("default"))) TS_CVec_BalanceZ_free(uint32_tArray _res) {
13422 LDKCVec_BalanceZ _res_constr;
13423 _res_constr.datalen = *((uint32_t*)_res);
13424 if (_res_constr.datalen > 0)
13425 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
13427 _res_constr.data = NULL;
13428 uint32_t* _res_vals = (uint32_t*)(_res + 4);
13429 for (size_t j = 0; j < _res_constr.datalen; j++) {
13430 uint32_t _res_conv_9 = _res_vals[j];
13431 void* _res_conv_9_ptr = (void*)(((uint64_t)_res_conv_9) & ~1);
13432 CHECK_ACCESS(_res_conv_9_ptr);
13433 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
13434 FREE((void*)_res_conv_9);
13435 _res_constr.data[j] = _res_conv_9_conv;
13437 CVec_BalanceZ_free(_res_constr);
13440 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
13441 void* o_ptr = (void*)(((uint64_t)o) & ~1);
13442 CHECK_ACCESS(o_ptr);
13443 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
13444 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1));
13445 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
13446 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
13447 return (uint64_t)ret_conv;
13450 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
13451 LDKDecodeError e_conv;
13452 e_conv.inner = (void*)(e & (~1));
13453 e_conv.is_owned = (e & 1) || (e == 0);
13454 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13455 e_conv = DecodeError_clone(&e_conv);
13456 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
13457 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
13458 return (uint64_t)ret_conv;
13461 jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint32_t o) {
13462 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(o & ~1);
13463 jboolean ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
13467 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
13468 if ((_res & 1) != 0) return;
13469 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13470 CHECK_ACCESS(_res_ptr);
13471 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
13473 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
13476 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
13477 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
13478 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
13479 return (uint64_t)ret_conv;
13481 int64_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint32_t arg) {
13482 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
13483 int64_t ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
13487 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint32_t orig) {
13488 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
13489 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
13490 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
13491 return (uint64_t)ret_conv;
13494 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_ok() {
13495 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13496 *ret_conv = CResult_NoneLightningErrorZ_ok();
13497 return (uint64_t)ret_conv;
13500 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
13501 LDKLightningError e_conv;
13502 e_conv.inner = (void*)(e & (~1));
13503 e_conv.is_owned = (e & 1) || (e == 0);
13504 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13505 e_conv = LightningError_clone(&e_conv);
13506 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13507 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
13508 return (uint64_t)ret_conv;
13511 jboolean __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_is_ok(uint32_t o) {
13512 LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)(o & ~1);
13513 jboolean ret_val = CResult_NoneLightningErrorZ_is_ok(o_conv);
13517 void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
13518 if ((_res & 1) != 0) return;
13519 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13520 CHECK_ACCESS(_res_ptr);
13521 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
13523 CResult_NoneLightningErrorZ_free(_res_conv);
13526 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
13527 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13528 *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
13529 return (uint64_t)ret_conv;
13531 int64_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint32_t arg) {
13532 LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
13533 int64_t ret_val = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
13537 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
13538 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
13539 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13540 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
13541 return (uint64_t)ret_conv;
13544 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
13545 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
13546 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
13547 return ((uint64_t)ret_conv);
13549 int64_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint32_t arg) {
13550 LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)(arg & ~1);
13551 int64_t ret_val = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
13555 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint32_t orig) {
13556 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
13557 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
13558 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
13559 return ((uint64_t)ret_conv);
13562 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
13563 LDKPublicKey a_ref;
13564 CHECK(*((uint32_t*)a) == 33);
13565 memcpy(a_ref.compressed_form, (uint8_t*)(a + 4), 33);
13566 void* b_ptr = (void*)(((uint64_t)b) & ~1);
13567 CHECK_ACCESS(b_ptr);
13568 LDKType b_conv = *(LDKType*)(b_ptr);
13569 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
13570 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
13571 return ((uint64_t)ret_conv);
13574 void __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_free(uint32_t _res) {
13575 if ((_res & 1) != 0) return;
13576 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13577 CHECK_ACCESS(_res_ptr);
13578 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
13580 C2Tuple_PublicKeyTypeZ_free(_res_conv);
13583 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint32_tArray _res) {
13584 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
13585 _res_constr.datalen = *((uint32_t*)_res);
13586 if (_res_constr.datalen > 0)
13587 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
13589 _res_constr.data = NULL;
13590 uint32_t* _res_vals = (uint32_t*)(_res + 4);
13591 for (size_t z = 0; z < _res_constr.datalen; z++) {
13592 uint32_t _res_conv_25 = _res_vals[z];
13593 void* _res_conv_25_ptr = (void*)(((uint64_t)_res_conv_25) & ~1);
13594 CHECK_ACCESS(_res_conv_25_ptr);
13595 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
13596 FREE((void*)_res_conv_25);
13597 _res_constr.data[z] = _res_conv_25_conv;
13599 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
13602 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
13603 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13604 *ret_conv = CResult_boolLightningErrorZ_ok(o);
13605 return (uint64_t)ret_conv;
13608 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
13609 LDKLightningError e_conv;
13610 e_conv.inner = (void*)(e & (~1));
13611 e_conv.is_owned = (e & 1) || (e == 0);
13612 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13613 e_conv = LightningError_clone(&e_conv);
13614 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13615 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
13616 return (uint64_t)ret_conv;
13619 jboolean __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_is_ok(uint32_t o) {
13620 LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)(o & ~1);
13621 jboolean ret_val = CResult_boolLightningErrorZ_is_ok(o_conv);
13625 void __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
13626 if ((_res & 1) != 0) return;
13627 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13628 CHECK_ACCESS(_res_ptr);
13629 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
13631 CResult_boolLightningErrorZ_free(_res_conv);
13634 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
13635 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13636 *ret_conv = CResult_boolLightningErrorZ_clone(arg);
13637 return (uint64_t)ret_conv;
13639 int64_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint32_t arg) {
13640 LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
13641 int64_t ret_val = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
13645 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
13646 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
13647 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13648 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
13649 return (uint64_t)ret_conv;
13652 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
13653 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13654 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
13655 return ((uint64_t)ret_conv);
13657 int64_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint32_t arg) {
13658 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arg & ~1);
13659 int64_t ret_val = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
13663 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
13664 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
13665 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13666 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
13667 return ((uint64_t)ret_conv);
13670 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
13671 LDKChannelAnnouncement a_conv;
13672 a_conv.inner = (void*)(a & (~1));
13673 a_conv.is_owned = (a & 1) || (a == 0);
13674 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
13675 a_conv = ChannelAnnouncement_clone(&a_conv);
13676 LDKChannelUpdate b_conv;
13677 b_conv.inner = (void*)(b & (~1));
13678 b_conv.is_owned = (b & 1) || (b == 0);
13679 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
13680 b_conv = ChannelUpdate_clone(&b_conv);
13681 LDKChannelUpdate c_conv;
13682 c_conv.inner = (void*)(c & (~1));
13683 c_conv.is_owned = (c & 1) || (c == 0);
13684 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
13685 c_conv = ChannelUpdate_clone(&c_conv);
13686 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13687 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
13688 return ((uint64_t)ret_conv);
13691 void __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
13692 if ((_res & 1) != 0) return;
13693 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13694 CHECK_ACCESS(_res_ptr);
13695 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
13697 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
13700 void __attribute__((visibility("default"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
13701 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
13702 _res_constr.datalen = *((uint32_t*)_res);
13703 if (_res_constr.datalen > 0)
13704 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
13706 _res_constr.data = NULL;
13707 uint32_t* _res_vals = (uint32_t*)(_res + 4);
13708 for (size_t h = 0; h < _res_constr.datalen; h++) {
13709 uint32_t _res_conv_59 = _res_vals[h];
13710 void* _res_conv_59_ptr = (void*)(((uint64_t)_res_conv_59) & ~1);
13711 CHECK_ACCESS(_res_conv_59_ptr);
13712 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
13713 FREE((void*)_res_conv_59);
13714 _res_constr.data[h] = _res_conv_59_conv;
13716 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
13719 void __attribute__((visibility("default"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
13720 LDKCVec_NodeAnnouncementZ _res_constr;
13721 _res_constr.datalen = *((uint32_t*)_res);
13722 if (_res_constr.datalen > 0)
13723 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
13725 _res_constr.data = NULL;
13726 uint32_t* _res_vals = (uint32_t*)(_res + 4);
13727 for (size_t s = 0; s < _res_constr.datalen; s++) {
13728 uint32_t _res_conv_18 = _res_vals[s];
13729 LDKNodeAnnouncement _res_conv_18_conv;
13730 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
13731 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
13732 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
13733 _res_constr.data[s] = _res_conv_18_conv;
13735 CVec_NodeAnnouncementZ_free(_res_constr);
13738 void __attribute__((visibility("default"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
13739 LDKCVec_PublicKeyZ _res_constr;
13740 _res_constr.datalen = *((uint32_t*)_res);
13741 if (_res_constr.datalen > 0)
13742 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
13744 _res_constr.data = NULL;
13745 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
13746 for (size_t m = 0; m < _res_constr.datalen; m++) {
13747 int8_tArray _res_conv_12 = _res_vals[m];
13748 LDKPublicKey _res_conv_12_ref;
13749 CHECK(*((uint32_t*)_res_conv_12) == 33);
13750 memcpy(_res_conv_12_ref.compressed_form, (uint8_t*)(_res_conv_12 + 4), 33);
13751 _res_constr.data[m] = _res_conv_12_ref;
13753 CVec_PublicKeyZ_free(_res_constr);
13756 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
13758 o_ref.datalen = *((uint32_t*)o);
13759 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
13760 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
13761 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
13762 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
13763 return (uint64_t)ret_conv;
13766 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
13767 LDKPeerHandleError e_conv;
13768 e_conv.inner = (void*)(e & (~1));
13769 e_conv.is_owned = (e & 1) || (e == 0);
13770 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13771 e_conv = PeerHandleError_clone(&e_conv);
13772 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
13773 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
13774 return (uint64_t)ret_conv;
13777 jboolean __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint32_t o) {
13778 LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(o & ~1);
13779 jboolean ret_val = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
13783 void __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
13784 if ((_res & 1) != 0) return;
13785 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13786 CHECK_ACCESS(_res_ptr);
13787 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
13789 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
13792 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
13793 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
13794 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
13795 return (uint64_t)ret_conv;
13797 int64_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint32_t arg) {
13798 LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
13799 int64_t ret_val = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
13803 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
13804 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
13805 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
13806 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
13807 return (uint64_t)ret_conv;
13810 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_ok() {
13811 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
13812 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
13813 return (uint64_t)ret_conv;
13816 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
13817 LDKPeerHandleError e_conv;
13818 e_conv.inner = (void*)(e & (~1));
13819 e_conv.is_owned = (e & 1) || (e == 0);
13820 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13821 e_conv = PeerHandleError_clone(&e_conv);
13822 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
13823 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
13824 return (uint64_t)ret_conv;
13827 jboolean __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint32_t o) {
13828 LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)(o & ~1);
13829 jboolean ret_val = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
13833 void __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
13834 if ((_res & 1) != 0) return;
13835 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13836 CHECK_ACCESS(_res_ptr);
13837 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
13839 CResult_NonePeerHandleErrorZ_free(_res_conv);
13842 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
13843 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
13844 *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
13845 return (uint64_t)ret_conv;
13847 int64_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint32_t arg) {
13848 LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
13849 int64_t ret_val = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
13853 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
13854 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
13855 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
13856 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
13857 return (uint64_t)ret_conv;
13860 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
13861 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
13862 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
13863 return (uint64_t)ret_conv;
13866 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
13867 LDKPeerHandleError e_conv;
13868 e_conv.inner = (void*)(e & (~1));
13869 e_conv.is_owned = (e & 1) || (e == 0);
13870 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13871 e_conv = PeerHandleError_clone(&e_conv);
13872 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
13873 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
13874 return (uint64_t)ret_conv;
13877 jboolean __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint32_t o) {
13878 LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)(o & ~1);
13879 jboolean ret_val = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
13883 void __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
13884 if ((_res & 1) != 0) return;
13885 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13886 CHECK_ACCESS(_res_ptr);
13887 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
13889 CResult_boolPeerHandleErrorZ_free(_res_conv);
13892 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
13893 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
13894 *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
13895 return (uint64_t)ret_conv;
13897 int64_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint32_t arg) {
13898 LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
13899 int64_t ret_val = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
13903 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
13904 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
13905 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
13906 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
13907 return (uint64_t)ret_conv;
13910 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint32_t o) {
13912 o_conv.inner = (void*)(o & (~1));
13913 o_conv.is_owned = (o & 1) || (o == 0);
13914 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13915 o_conv = NodeId_clone(&o_conv);
13916 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13917 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
13918 return (uint64_t)ret_conv;
13921 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_err(uint32_t e) {
13922 LDKDecodeError e_conv;
13923 e_conv.inner = (void*)(e & (~1));
13924 e_conv.is_owned = (e & 1) || (e == 0);
13925 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13926 e_conv = DecodeError_clone(&e_conv);
13927 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13928 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
13929 return (uint64_t)ret_conv;
13932 jboolean __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint32_t o) {
13933 LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)(o & ~1);
13934 jboolean ret_val = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
13938 void __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_free(uint32_t _res) {
13939 if ((_res & 1) != 0) return;
13940 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13941 CHECK_ACCESS(_res_ptr);
13942 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
13944 CResult_NodeIdDecodeErrorZ_free(_res_conv);
13947 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
13948 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13949 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
13950 return (uint64_t)ret_conv;
13952 int64_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint32_t arg) {
13953 LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
13954 int64_t ret_val = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
13958 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint32_t orig) {
13959 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
13960 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13961 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
13962 return (uint64_t)ret_conv;
13965 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint32_t o) {
13966 void* o_ptr = (void*)(((uint64_t)o) & ~1);
13967 CHECK_ACCESS(o_ptr);
13968 LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
13969 o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)o) & ~1));
13970 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
13971 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
13972 return (uint64_t)ret_conv;
13975 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint32_t e) {
13976 LDKDecodeError e_conv;
13977 e_conv.inner = (void*)(e & (~1));
13978 e_conv.is_owned = (e & 1) || (e == 0);
13979 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13980 e_conv = DecodeError_clone(&e_conv);
13981 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
13982 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
13983 return (uint64_t)ret_conv;
13986 jboolean __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint32_t o) {
13987 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(o & ~1);
13988 jboolean ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
13992 void __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint32_t _res) {
13993 if ((_res & 1) != 0) return;
13994 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13995 CHECK_ACCESS(_res_ptr);
13996 LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
13998 CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
14001 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
14002 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14003 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
14004 return (uint64_t)ret_conv;
14006 int64_t __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint32_t arg) {
14007 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
14008 int64_t ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
14012 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint32_t orig) {
14013 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(orig & ~1);
14014 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14015 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
14016 return (uint64_t)ret_conv;
14019 uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_some(uint32_t o) {
14020 void* o_ptr = (void*)(((uint64_t)o) & ~1);
14021 CHECK_ACCESS(o_ptr);
14022 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
14023 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
14024 *ret_copy = COption_AccessZ_some(o_conv);
14025 uint64_t ret_ref = (uint64_t)ret_copy;
14029 uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_none() {
14030 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
14031 *ret_copy = COption_AccessZ_none();
14032 uint64_t ret_ref = (uint64_t)ret_copy;
14036 void __attribute__((visibility("default"))) TS_COption_AccessZ_free(uint32_t _res) {
14037 if ((_res & 1) != 0) return;
14038 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14039 CHECK_ACCESS(_res_ptr);
14040 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
14042 COption_AccessZ_free(_res_conv);
14045 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok(uint32_t o) {
14046 LDKDirectionalChannelInfo o_conv;
14047 o_conv.inner = (void*)(o & (~1));
14048 o_conv.is_owned = (o & 1) || (o == 0);
14049 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14050 o_conv = DirectionalChannelInfo_clone(&o_conv);
14051 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
14052 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
14053 return (uint64_t)ret_conv;
14056 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_err(uint32_t e) {
14057 LDKDecodeError e_conv;
14058 e_conv.inner = (void*)(e & (~1));
14059 e_conv.is_owned = (e & 1) || (e == 0);
14060 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14061 e_conv = DecodeError_clone(&e_conv);
14062 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
14063 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
14064 return (uint64_t)ret_conv;
14067 jboolean __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(uint32_t o) {
14068 LDKCResult_DirectionalChannelInfoDecodeErrorZ* o_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(o & ~1);
14069 jboolean ret_val = CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(o_conv);
14073 void __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_free(uint32_t _res) {
14074 if ((_res & 1) != 0) return;
14075 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14076 CHECK_ACCESS(_res_ptr);
14077 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(_res_ptr);
14079 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
14082 static inline uint64_t CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
14083 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
14084 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(arg);
14085 return (uint64_t)ret_conv;
14087 int64_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
14088 LDKCResult_DirectionalChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
14089 int64_t ret_val = CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
14093 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone(uint32_t orig) {
14094 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
14095 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
14096 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
14097 return (uint64_t)ret_conv;
14100 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
14101 LDKChannelInfo o_conv;
14102 o_conv.inner = (void*)(o & (~1));
14103 o_conv.is_owned = (o & 1) || (o == 0);
14104 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14105 o_conv = ChannelInfo_clone(&o_conv);
14106 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14107 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
14108 return (uint64_t)ret_conv;
14111 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
14112 LDKDecodeError e_conv;
14113 e_conv.inner = (void*)(e & (~1));
14114 e_conv.is_owned = (e & 1) || (e == 0);
14115 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14116 e_conv = DecodeError_clone(&e_conv);
14117 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14118 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
14119 return (uint64_t)ret_conv;
14122 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint32_t o) {
14123 LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(o & ~1);
14124 jboolean ret_val = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
14128 void __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
14129 if ((_res & 1) != 0) return;
14130 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14131 CHECK_ACCESS(_res_ptr);
14132 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
14134 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
14137 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
14138 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14139 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
14140 return (uint64_t)ret_conv;
14142 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
14143 LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
14144 int64_t ret_val = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
14148 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
14149 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
14150 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14151 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
14152 return (uint64_t)ret_conv;
14155 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
14156 LDKRoutingFees o_conv;
14157 o_conv.inner = (void*)(o & (~1));
14158 o_conv.is_owned = (o & 1) || (o == 0);
14159 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14160 o_conv = RoutingFees_clone(&o_conv);
14161 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14162 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
14163 return (uint64_t)ret_conv;
14166 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
14167 LDKDecodeError e_conv;
14168 e_conv.inner = (void*)(e & (~1));
14169 e_conv.is_owned = (e & 1) || (e == 0);
14170 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14171 e_conv = DecodeError_clone(&e_conv);
14172 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14173 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
14174 return (uint64_t)ret_conv;
14177 jboolean __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint32_t o) {
14178 LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(o & ~1);
14179 jboolean ret_val = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
14183 void __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
14184 if ((_res & 1) != 0) return;
14185 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14186 CHECK_ACCESS(_res_ptr);
14187 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
14189 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
14192 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
14193 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14194 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
14195 return (uint64_t)ret_conv;
14197 int64_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint32_t arg) {
14198 LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
14199 int64_t ret_val = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
14203 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
14204 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
14205 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14206 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
14207 return (uint64_t)ret_conv;
14210 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
14211 LDKNodeAnnouncementInfo o_conv;
14212 o_conv.inner = (void*)(o & (~1));
14213 o_conv.is_owned = (o & 1) || (o == 0);
14214 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14215 o_conv = NodeAnnouncementInfo_clone(&o_conv);
14216 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14217 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
14218 return (uint64_t)ret_conv;
14221 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
14222 LDKDecodeError e_conv;
14223 e_conv.inner = (void*)(e & (~1));
14224 e_conv.is_owned = (e & 1) || (e == 0);
14225 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14226 e_conv = DecodeError_clone(&e_conv);
14227 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14228 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
14229 return (uint64_t)ret_conv;
14232 jboolean __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint32_t o) {
14233 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(o & ~1);
14234 jboolean ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
14238 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
14239 if ((_res & 1) != 0) return;
14240 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14241 CHECK_ACCESS(_res_ptr);
14242 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
14244 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
14247 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
14248 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14249 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
14250 return (uint64_t)ret_conv;
14252 int64_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
14253 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
14254 int64_t ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
14258 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
14259 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
14260 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14261 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
14262 return (uint64_t)ret_conv;
14265 void __attribute__((visibility("default"))) TS_CVec_u64Z_free(int64_tArray _res) {
14266 LDKCVec_u64Z _res_constr;
14267 _res_constr.datalen = *((uint32_t*)_res);
14268 if (_res_constr.datalen > 0)
14269 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14271 _res_constr.data = NULL;
14272 int64_t* _res_vals = (int64_t*)(_res + 4);
14273 for (size_t i = 0; i < _res_constr.datalen; i++) {
14274 int64_t _res_conv_8 = _res_vals[i];
14275 _res_constr.data[i] = _res_conv_8;
14277 CVec_u64Z_free(_res_constr);
14280 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
14281 LDKNodeInfo o_conv;
14282 o_conv.inner = (void*)(o & (~1));
14283 o_conv.is_owned = (o & 1) || (o == 0);
14284 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14285 o_conv = NodeInfo_clone(&o_conv);
14286 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14287 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
14288 return (uint64_t)ret_conv;
14291 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
14292 LDKDecodeError e_conv;
14293 e_conv.inner = (void*)(e & (~1));
14294 e_conv.is_owned = (e & 1) || (e == 0);
14295 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14296 e_conv = DecodeError_clone(&e_conv);
14297 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14298 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
14299 return (uint64_t)ret_conv;
14302 jboolean __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint32_t o) {
14303 LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(o & ~1);
14304 jboolean ret_val = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
14308 void __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
14309 if ((_res & 1) != 0) return;
14310 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14311 CHECK_ACCESS(_res_ptr);
14312 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
14314 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
14317 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
14318 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14319 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
14320 return (uint64_t)ret_conv;
14322 int64_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
14323 LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
14324 int64_t ret_val = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
14328 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
14329 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
14330 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14331 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
14332 return (uint64_t)ret_conv;
14335 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
14336 LDKNetworkGraph o_conv;
14337 o_conv.inner = (void*)(o & (~1));
14338 o_conv.is_owned = (o & 1) || (o == 0);
14339 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14340 o_conv = NetworkGraph_clone(&o_conv);
14341 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
14342 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
14343 return (uint64_t)ret_conv;
14346 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
14347 LDKDecodeError e_conv;
14348 e_conv.inner = (void*)(e & (~1));
14349 e_conv.is_owned = (e & 1) || (e == 0);
14350 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14351 e_conv = DecodeError_clone(&e_conv);
14352 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
14353 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
14354 return (uint64_t)ret_conv;
14357 jboolean __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint32_t o) {
14358 LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(o & ~1);
14359 jboolean ret_val = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
14363 void __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
14364 if ((_res & 1) != 0) return;
14365 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14366 CHECK_ACCESS(_res_ptr);
14367 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
14369 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
14372 static inline uint64_t CResult_NetworkGraphDecodeErrorZ_clone_ptr(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR arg) {
14373 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
14374 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(arg);
14375 return (uint64_t)ret_conv;
14377 int64_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_clone_ptr(uint32_t arg) {
14378 LDKCResult_NetworkGraphDecodeErrorZ* arg_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
14379 int64_t ret_val = CResult_NetworkGraphDecodeErrorZ_clone_ptr(arg_conv);
14383 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_clone(uint32_t orig) {
14384 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
14385 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
14386 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
14387 return (uint64_t)ret_conv;
14390 uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_some(uint32_tArray o) {
14391 LDKCVec_NetAddressZ o_constr;
14392 o_constr.datalen = *((uint32_t*)o);
14393 if (o_constr.datalen > 0)
14394 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14396 o_constr.data = NULL;
14397 uint32_t* o_vals = (uint32_t*)(o + 4);
14398 for (size_t m = 0; m < o_constr.datalen; m++) {
14399 uint32_t o_conv_12 = o_vals[m];
14400 void* o_conv_12_ptr = (void*)(((uint64_t)o_conv_12) & ~1);
14401 CHECK_ACCESS(o_conv_12_ptr);
14402 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
14403 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o_conv_12) & ~1));
14404 o_constr.data[m] = o_conv_12_conv;
14406 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14407 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
14408 uint64_t ret_ref = (uint64_t)ret_copy;
14412 uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_none() {
14413 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14414 *ret_copy = COption_CVec_NetAddressZZ_none();
14415 uint64_t ret_ref = (uint64_t)ret_copy;
14419 void __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_free(uint32_t _res) {
14420 if ((_res & 1) != 0) return;
14421 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14422 CHECK_ACCESS(_res_ptr);
14423 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
14425 COption_CVec_NetAddressZZ_free(_res_conv);
14428 static inline uint64_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
14429 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14430 *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
14431 uint64_t ret_ref = (uint64_t)ret_copy;
14434 int64_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_clone_ptr(uint32_t arg) {
14435 LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)arg;
14436 int64_t ret_val = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
14440 uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_clone(uint32_t orig) {
14441 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
14442 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14443 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
14444 uint64_t ret_ref = (uint64_t)ret_copy;
14448 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint32_t o) {
14449 void* o_ptr = (void*)(((uint64_t)o) & ~1);
14450 CHECK_ACCESS(o_ptr);
14451 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
14452 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
14453 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
14454 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
14455 return (uint64_t)ret_conv;
14458 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_err(uint32_t e) {
14459 LDKDecodeError e_conv;
14460 e_conv.inner = (void*)(e & (~1));
14461 e_conv.is_owned = (e & 1) || (e == 0);
14462 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14463 e_conv = DecodeError_clone(&e_conv);
14464 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
14465 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
14466 return (uint64_t)ret_conv;
14469 jboolean __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint32_t o) {
14470 LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)(o & ~1);
14471 jboolean ret_val = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
14475 void __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_free(uint32_t _res) {
14476 if ((_res & 1) != 0) return;
14477 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14478 CHECK_ACCESS(_res_ptr);
14479 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
14481 CResult_NetAddressDecodeErrorZ_free(_res_conv);
14484 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
14485 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
14486 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
14487 return (uint64_t)ret_conv;
14489 int64_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint32_t arg) {
14490 LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
14491 int64_t ret_val = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
14495 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint32_t orig) {
14496 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
14497 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
14498 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
14499 return (uint64_t)ret_conv;
14502 void __attribute__((visibility("default"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
14503 LDKCVec_UpdateAddHTLCZ _res_constr;
14504 _res_constr.datalen = *((uint32_t*)_res);
14505 if (_res_constr.datalen > 0)
14506 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
14508 _res_constr.data = NULL;
14509 uint32_t* _res_vals = (uint32_t*)(_res + 4);
14510 for (size_t p = 0; p < _res_constr.datalen; p++) {
14511 uint32_t _res_conv_15 = _res_vals[p];
14512 LDKUpdateAddHTLC _res_conv_15_conv;
14513 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
14514 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
14515 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
14516 _res_constr.data[p] = _res_conv_15_conv;
14518 CVec_UpdateAddHTLCZ_free(_res_constr);
14521 void __attribute__((visibility("default"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
14522 LDKCVec_UpdateFulfillHTLCZ _res_constr;
14523 _res_constr.datalen = *((uint32_t*)_res);
14524 if (_res_constr.datalen > 0)
14525 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
14527 _res_constr.data = NULL;
14528 uint32_t* _res_vals = (uint32_t*)(_res + 4);
14529 for (size_t t = 0; t < _res_constr.datalen; t++) {
14530 uint32_t _res_conv_19 = _res_vals[t];
14531 LDKUpdateFulfillHTLC _res_conv_19_conv;
14532 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
14533 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
14534 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
14535 _res_constr.data[t] = _res_conv_19_conv;
14537 CVec_UpdateFulfillHTLCZ_free(_res_constr);
14540 void __attribute__((visibility("default"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
14541 LDKCVec_UpdateFailHTLCZ _res_constr;
14542 _res_constr.datalen = *((uint32_t*)_res);
14543 if (_res_constr.datalen > 0)
14544 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
14546 _res_constr.data = NULL;
14547 uint32_t* _res_vals = (uint32_t*)(_res + 4);
14548 for (size_t q = 0; q < _res_constr.datalen; q++) {
14549 uint32_t _res_conv_16 = _res_vals[q];
14550 LDKUpdateFailHTLC _res_conv_16_conv;
14551 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
14552 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
14553 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
14554 _res_constr.data[q] = _res_conv_16_conv;
14556 CVec_UpdateFailHTLCZ_free(_res_constr);
14559 void __attribute__((visibility("default"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
14560 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
14561 _res_constr.datalen = *((uint32_t*)_res);
14562 if (_res_constr.datalen > 0)
14563 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
14565 _res_constr.data = NULL;
14566 uint32_t* _res_vals = (uint32_t*)(_res + 4);
14567 for (size_t z = 0; z < _res_constr.datalen; z++) {
14568 uint32_t _res_conv_25 = _res_vals[z];
14569 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
14570 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
14571 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
14572 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
14573 _res_constr.data[z] = _res_conv_25_conv;
14575 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
14578 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
14579 LDKAcceptChannel o_conv;
14580 o_conv.inner = (void*)(o & (~1));
14581 o_conv.is_owned = (o & 1) || (o == 0);
14582 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14583 o_conv = AcceptChannel_clone(&o_conv);
14584 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
14585 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
14586 return (uint64_t)ret_conv;
14589 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
14590 LDKDecodeError e_conv;
14591 e_conv.inner = (void*)(e & (~1));
14592 e_conv.is_owned = (e & 1) || (e == 0);
14593 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14594 e_conv = DecodeError_clone(&e_conv);
14595 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
14596 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
14597 return (uint64_t)ret_conv;
14600 jboolean __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint32_t o) {
14601 LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(o & ~1);
14602 jboolean ret_val = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
14606 void __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
14607 if ((_res & 1) != 0) return;
14608 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14609 CHECK_ACCESS(_res_ptr);
14610 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
14612 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
14615 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
14616 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
14617 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
14618 return (uint64_t)ret_conv;
14620 int64_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint32_t arg) {
14621 LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
14622 int64_t ret_val = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
14626 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
14627 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
14628 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
14629 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
14630 return (uint64_t)ret_conv;
14633 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
14634 LDKAnnouncementSignatures o_conv;
14635 o_conv.inner = (void*)(o & (~1));
14636 o_conv.is_owned = (o & 1) || (o == 0);
14637 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14638 o_conv = AnnouncementSignatures_clone(&o_conv);
14639 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
14640 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
14641 return (uint64_t)ret_conv;
14644 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
14645 LDKDecodeError e_conv;
14646 e_conv.inner = (void*)(e & (~1));
14647 e_conv.is_owned = (e & 1) || (e == 0);
14648 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14649 e_conv = DecodeError_clone(&e_conv);
14650 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
14651 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
14652 return (uint64_t)ret_conv;
14655 jboolean __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint32_t o) {
14656 LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(o & ~1);
14657 jboolean ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
14661 void __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
14662 if ((_res & 1) != 0) return;
14663 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14664 CHECK_ACCESS(_res_ptr);
14665 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
14667 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
14670 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
14671 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
14672 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
14673 return (uint64_t)ret_conv;
14675 int64_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
14676 LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
14677 int64_t ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
14681 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
14682 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
14683 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
14684 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
14685 return (uint64_t)ret_conv;
14688 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
14689 LDKChannelReestablish o_conv;
14690 o_conv.inner = (void*)(o & (~1));
14691 o_conv.is_owned = (o & 1) || (o == 0);
14692 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14693 o_conv = ChannelReestablish_clone(&o_conv);
14694 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
14695 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
14696 return (uint64_t)ret_conv;
14699 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
14700 LDKDecodeError e_conv;
14701 e_conv.inner = (void*)(e & (~1));
14702 e_conv.is_owned = (e & 1) || (e == 0);
14703 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14704 e_conv = DecodeError_clone(&e_conv);
14705 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
14706 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
14707 return (uint64_t)ret_conv;
14710 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint32_t o) {
14711 LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(o & ~1);
14712 jboolean ret_val = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
14716 void __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
14717 if ((_res & 1) != 0) return;
14718 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14719 CHECK_ACCESS(_res_ptr);
14720 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
14722 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
14725 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
14726 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
14727 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
14728 return (uint64_t)ret_conv;
14730 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint32_t arg) {
14731 LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
14732 int64_t ret_val = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
14736 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
14737 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
14738 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
14739 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
14740 return (uint64_t)ret_conv;
14743 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
14744 LDKClosingSigned o_conv;
14745 o_conv.inner = (void*)(o & (~1));
14746 o_conv.is_owned = (o & 1) || (o == 0);
14747 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14748 o_conv = ClosingSigned_clone(&o_conv);
14749 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
14750 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
14751 return (uint64_t)ret_conv;
14754 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
14755 LDKDecodeError e_conv;
14756 e_conv.inner = (void*)(e & (~1));
14757 e_conv.is_owned = (e & 1) || (e == 0);
14758 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14759 e_conv = DecodeError_clone(&e_conv);
14760 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
14761 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
14762 return (uint64_t)ret_conv;
14765 jboolean __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint32_t o) {
14766 LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(o & ~1);
14767 jboolean ret_val = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
14771 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
14772 if ((_res & 1) != 0) return;
14773 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14774 CHECK_ACCESS(_res_ptr);
14775 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
14777 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
14780 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
14781 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
14782 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
14783 return (uint64_t)ret_conv;
14785 int64_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
14786 LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
14787 int64_t ret_val = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
14791 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
14792 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
14793 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
14794 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
14795 return (uint64_t)ret_conv;
14798 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint32_t o) {
14799 LDKClosingSignedFeeRange o_conv;
14800 o_conv.inner = (void*)(o & (~1));
14801 o_conv.is_owned = (o & 1) || (o == 0);
14802 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14803 o_conv = ClosingSignedFeeRange_clone(&o_conv);
14804 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
14805 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
14806 return (uint64_t)ret_conv;
14809 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint32_t e) {
14810 LDKDecodeError e_conv;
14811 e_conv.inner = (void*)(e & (~1));
14812 e_conv.is_owned = (e & 1) || (e == 0);
14813 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14814 e_conv = DecodeError_clone(&e_conv);
14815 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
14816 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
14817 return (uint64_t)ret_conv;
14820 jboolean __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint32_t o) {
14821 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(o & ~1);
14822 jboolean ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
14826 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint32_t _res) {
14827 if ((_res & 1) != 0) return;
14828 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14829 CHECK_ACCESS(_res_ptr);
14830 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
14832 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
14835 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
14836 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
14837 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
14838 return (uint64_t)ret_conv;
14840 int64_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
14841 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
14842 int64_t ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
14846 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint32_t orig) {
14847 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
14848 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
14849 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
14850 return (uint64_t)ret_conv;
14853 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
14854 LDKCommitmentSigned o_conv;
14855 o_conv.inner = (void*)(o & (~1));
14856 o_conv.is_owned = (o & 1) || (o == 0);
14857 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14858 o_conv = CommitmentSigned_clone(&o_conv);
14859 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
14860 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
14861 return (uint64_t)ret_conv;
14864 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
14865 LDKDecodeError e_conv;
14866 e_conv.inner = (void*)(e & (~1));
14867 e_conv.is_owned = (e & 1) || (e == 0);
14868 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14869 e_conv = DecodeError_clone(&e_conv);
14870 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
14871 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
14872 return (uint64_t)ret_conv;
14875 jboolean __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint32_t o) {
14876 LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(o & ~1);
14877 jboolean ret_val = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
14881 void __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
14882 if ((_res & 1) != 0) return;
14883 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14884 CHECK_ACCESS(_res_ptr);
14885 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
14887 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
14890 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
14891 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
14892 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
14893 return (uint64_t)ret_conv;
14895 int64_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
14896 LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
14897 int64_t ret_val = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
14901 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
14902 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
14903 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
14904 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
14905 return (uint64_t)ret_conv;
14908 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
14909 LDKFundingCreated o_conv;
14910 o_conv.inner = (void*)(o & (~1));
14911 o_conv.is_owned = (o & 1) || (o == 0);
14912 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14913 o_conv = FundingCreated_clone(&o_conv);
14914 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
14915 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
14916 return (uint64_t)ret_conv;
14919 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
14920 LDKDecodeError e_conv;
14921 e_conv.inner = (void*)(e & (~1));
14922 e_conv.is_owned = (e & 1) || (e == 0);
14923 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14924 e_conv = DecodeError_clone(&e_conv);
14925 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
14926 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
14927 return (uint64_t)ret_conv;
14930 jboolean __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint32_t o) {
14931 LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(o & ~1);
14932 jboolean ret_val = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
14936 void __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
14937 if ((_res & 1) != 0) return;
14938 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14939 CHECK_ACCESS(_res_ptr);
14940 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
14942 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
14945 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
14946 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
14947 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
14948 return (uint64_t)ret_conv;
14950 int64_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint32_t arg) {
14951 LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
14952 int64_t ret_val = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
14956 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
14957 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
14958 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
14959 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
14960 return (uint64_t)ret_conv;
14963 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
14964 LDKFundingSigned o_conv;
14965 o_conv.inner = (void*)(o & (~1));
14966 o_conv.is_owned = (o & 1) || (o == 0);
14967 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14968 o_conv = FundingSigned_clone(&o_conv);
14969 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
14970 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
14971 return (uint64_t)ret_conv;
14974 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
14975 LDKDecodeError e_conv;
14976 e_conv.inner = (void*)(e & (~1));
14977 e_conv.is_owned = (e & 1) || (e == 0);
14978 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14979 e_conv = DecodeError_clone(&e_conv);
14980 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
14981 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
14982 return (uint64_t)ret_conv;
14985 jboolean __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint32_t o) {
14986 LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(o & ~1);
14987 jboolean ret_val = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
14991 void __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
14992 if ((_res & 1) != 0) return;
14993 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14994 CHECK_ACCESS(_res_ptr);
14995 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
14997 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
15000 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
15001 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
15002 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
15003 return (uint64_t)ret_conv;
15005 int64_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
15006 LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
15007 int64_t ret_val = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
15011 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
15012 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
15013 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
15014 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
15015 return (uint64_t)ret_conv;
15018 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_ok(uint32_t o) {
15019 LDKFundingLocked o_conv;
15020 o_conv.inner = (void*)(o & (~1));
15021 o_conv.is_owned = (o & 1) || (o == 0);
15022 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15023 o_conv = FundingLocked_clone(&o_conv);
15024 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
15025 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
15026 return (uint64_t)ret_conv;
15029 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_err(uint32_t e) {
15030 LDKDecodeError e_conv;
15031 e_conv.inner = (void*)(e & (~1));
15032 e_conv.is_owned = (e & 1) || (e == 0);
15033 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15034 e_conv = DecodeError_clone(&e_conv);
15035 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
15036 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
15037 return (uint64_t)ret_conv;
15040 jboolean __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_is_ok(uint32_t o) {
15041 LDKCResult_FundingLockedDecodeErrorZ* o_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(o & ~1);
15042 jboolean ret_val = CResult_FundingLockedDecodeErrorZ_is_ok(o_conv);
15046 void __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_free(uint32_t _res) {
15047 if ((_res & 1) != 0) return;
15048 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15049 CHECK_ACCESS(_res_ptr);
15050 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(_res_ptr);
15052 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
15055 static inline uint64_t CResult_FundingLockedDecodeErrorZ_clone_ptr(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR arg) {
15056 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
15057 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(arg);
15058 return (uint64_t)ret_conv;
15060 int64_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_clone_ptr(uint32_t arg) {
15061 LDKCResult_FundingLockedDecodeErrorZ* arg_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
15062 int64_t ret_val = CResult_FundingLockedDecodeErrorZ_clone_ptr(arg_conv);
15066 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_clone(uint32_t orig) {
15067 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
15068 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
15069 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
15070 return (uint64_t)ret_conv;
15073 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
15075 o_conv.inner = (void*)(o & (~1));
15076 o_conv.is_owned = (o & 1) || (o == 0);
15077 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15078 o_conv = Init_clone(&o_conv);
15079 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
15080 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
15081 return (uint64_t)ret_conv;
15084 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
15085 LDKDecodeError e_conv;
15086 e_conv.inner = (void*)(e & (~1));
15087 e_conv.is_owned = (e & 1) || (e == 0);
15088 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15089 e_conv = DecodeError_clone(&e_conv);
15090 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
15091 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
15092 return (uint64_t)ret_conv;
15095 jboolean __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_is_ok(uint32_t o) {
15096 LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)(o & ~1);
15097 jboolean ret_val = CResult_InitDecodeErrorZ_is_ok(o_conv);
15101 void __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
15102 if ((_res & 1) != 0) return;
15103 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15104 CHECK_ACCESS(_res_ptr);
15105 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
15107 CResult_InitDecodeErrorZ_free(_res_conv);
15110 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
15111 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
15112 *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
15113 return (uint64_t)ret_conv;
15115 int64_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint32_t arg) {
15116 LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
15117 int64_t ret_val = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
15121 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
15122 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
15123 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
15124 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
15125 return (uint64_t)ret_conv;
15128 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
15129 LDKOpenChannel o_conv;
15130 o_conv.inner = (void*)(o & (~1));
15131 o_conv.is_owned = (o & 1) || (o == 0);
15132 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15133 o_conv = OpenChannel_clone(&o_conv);
15134 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
15135 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
15136 return (uint64_t)ret_conv;
15139 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
15140 LDKDecodeError e_conv;
15141 e_conv.inner = (void*)(e & (~1));
15142 e_conv.is_owned = (e & 1) || (e == 0);
15143 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15144 e_conv = DecodeError_clone(&e_conv);
15145 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
15146 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
15147 return (uint64_t)ret_conv;
15150 jboolean __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint32_t o) {
15151 LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(o & ~1);
15152 jboolean ret_val = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
15156 void __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
15157 if ((_res & 1) != 0) return;
15158 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15159 CHECK_ACCESS(_res_ptr);
15160 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
15162 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
15165 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
15166 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
15167 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
15168 return (uint64_t)ret_conv;
15170 int64_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint32_t arg) {
15171 LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
15172 int64_t ret_val = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
15176 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
15177 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
15178 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
15179 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
15180 return (uint64_t)ret_conv;
15183 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
15184 LDKRevokeAndACK o_conv;
15185 o_conv.inner = (void*)(o & (~1));
15186 o_conv.is_owned = (o & 1) || (o == 0);
15187 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15188 o_conv = RevokeAndACK_clone(&o_conv);
15189 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
15190 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
15191 return (uint64_t)ret_conv;
15194 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
15195 LDKDecodeError e_conv;
15196 e_conv.inner = (void*)(e & (~1));
15197 e_conv.is_owned = (e & 1) || (e == 0);
15198 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15199 e_conv = DecodeError_clone(&e_conv);
15200 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
15201 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
15202 return (uint64_t)ret_conv;
15205 jboolean __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint32_t o) {
15206 LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(o & ~1);
15207 jboolean ret_val = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
15211 void __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
15212 if ((_res & 1) != 0) return;
15213 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15214 CHECK_ACCESS(_res_ptr);
15215 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
15217 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
15220 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
15221 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
15222 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
15223 return (uint64_t)ret_conv;
15225 int64_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint32_t arg) {
15226 LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
15227 int64_t ret_val = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
15231 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
15232 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
15233 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
15234 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
15235 return (uint64_t)ret_conv;
15238 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
15239 LDKShutdown o_conv;
15240 o_conv.inner = (void*)(o & (~1));
15241 o_conv.is_owned = (o & 1) || (o == 0);
15242 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15243 o_conv = Shutdown_clone(&o_conv);
15244 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
15245 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
15246 return (uint64_t)ret_conv;
15249 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
15250 LDKDecodeError e_conv;
15251 e_conv.inner = (void*)(e & (~1));
15252 e_conv.is_owned = (e & 1) || (e == 0);
15253 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15254 e_conv = DecodeError_clone(&e_conv);
15255 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
15256 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
15257 return (uint64_t)ret_conv;
15260 jboolean __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint32_t o) {
15261 LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)(o & ~1);
15262 jboolean ret_val = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
15266 void __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
15267 if ((_res & 1) != 0) return;
15268 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15269 CHECK_ACCESS(_res_ptr);
15270 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
15272 CResult_ShutdownDecodeErrorZ_free(_res_conv);
15275 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
15276 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
15277 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
15278 return (uint64_t)ret_conv;
15280 int64_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint32_t arg) {
15281 LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
15282 int64_t ret_val = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
15286 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
15287 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
15288 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
15289 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
15290 return (uint64_t)ret_conv;
15293 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
15294 LDKUpdateFailHTLC o_conv;
15295 o_conv.inner = (void*)(o & (~1));
15296 o_conv.is_owned = (o & 1) || (o == 0);
15297 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15298 o_conv = UpdateFailHTLC_clone(&o_conv);
15299 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
15300 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
15301 return (uint64_t)ret_conv;
15304 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
15305 LDKDecodeError e_conv;
15306 e_conv.inner = (void*)(e & (~1));
15307 e_conv.is_owned = (e & 1) || (e == 0);
15308 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15309 e_conv = DecodeError_clone(&e_conv);
15310 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
15311 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
15312 return (uint64_t)ret_conv;
15315 jboolean __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint32_t o) {
15316 LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(o & ~1);
15317 jboolean ret_val = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
15321 void __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
15322 if ((_res & 1) != 0) return;
15323 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15324 CHECK_ACCESS(_res_ptr);
15325 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
15327 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
15330 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
15331 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
15332 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
15333 return (uint64_t)ret_conv;
15335 int64_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
15336 LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
15337 int64_t ret_val = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
15341 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
15342 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
15343 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
15344 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
15345 return (uint64_t)ret_conv;
15348 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
15349 LDKUpdateFailMalformedHTLC o_conv;
15350 o_conv.inner = (void*)(o & (~1));
15351 o_conv.is_owned = (o & 1) || (o == 0);
15352 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15353 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
15354 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
15355 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
15356 return (uint64_t)ret_conv;
15359 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
15360 LDKDecodeError e_conv;
15361 e_conv.inner = (void*)(e & (~1));
15362 e_conv.is_owned = (e & 1) || (e == 0);
15363 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15364 e_conv = DecodeError_clone(&e_conv);
15365 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
15366 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
15367 return (uint64_t)ret_conv;
15370 jboolean __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint32_t o) {
15371 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(o & ~1);
15372 jboolean ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
15376 void __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
15377 if ((_res & 1) != 0) return;
15378 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15379 CHECK_ACCESS(_res_ptr);
15380 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
15382 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
15385 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
15386 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
15387 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
15388 return (uint64_t)ret_conv;
15390 int64_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
15391 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
15392 int64_t ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
15396 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
15397 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
15398 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
15399 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
15400 return (uint64_t)ret_conv;
15403 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
15404 LDKUpdateFee o_conv;
15405 o_conv.inner = (void*)(o & (~1));
15406 o_conv.is_owned = (o & 1) || (o == 0);
15407 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15408 o_conv = UpdateFee_clone(&o_conv);
15409 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
15410 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
15411 return (uint64_t)ret_conv;
15414 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
15415 LDKDecodeError e_conv;
15416 e_conv.inner = (void*)(e & (~1));
15417 e_conv.is_owned = (e & 1) || (e == 0);
15418 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15419 e_conv = DecodeError_clone(&e_conv);
15420 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
15421 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
15422 return (uint64_t)ret_conv;
15425 jboolean __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint32_t o) {
15426 LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(o & ~1);
15427 jboolean ret_val = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
15431 void __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
15432 if ((_res & 1) != 0) return;
15433 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15434 CHECK_ACCESS(_res_ptr);
15435 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
15437 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
15440 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
15441 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
15442 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
15443 return (uint64_t)ret_conv;
15445 int64_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint32_t arg) {
15446 LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
15447 int64_t ret_val = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
15451 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
15452 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
15453 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
15454 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
15455 return (uint64_t)ret_conv;
15458 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
15459 LDKUpdateFulfillHTLC o_conv;
15460 o_conv.inner = (void*)(o & (~1));
15461 o_conv.is_owned = (o & 1) || (o == 0);
15462 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15463 o_conv = UpdateFulfillHTLC_clone(&o_conv);
15464 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
15465 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
15466 return (uint64_t)ret_conv;
15469 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
15470 LDKDecodeError e_conv;
15471 e_conv.inner = (void*)(e & (~1));
15472 e_conv.is_owned = (e & 1) || (e == 0);
15473 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15474 e_conv = DecodeError_clone(&e_conv);
15475 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
15476 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
15477 return (uint64_t)ret_conv;
15480 jboolean __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint32_t o) {
15481 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(o & ~1);
15482 jboolean ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
15486 void __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
15487 if ((_res & 1) != 0) return;
15488 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15489 CHECK_ACCESS(_res_ptr);
15490 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
15492 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
15495 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
15496 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
15497 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
15498 return (uint64_t)ret_conv;
15500 int64_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
15501 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
15502 int64_t ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
15506 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
15507 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
15508 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
15509 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
15510 return (uint64_t)ret_conv;
15513 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
15514 LDKUpdateAddHTLC o_conv;
15515 o_conv.inner = (void*)(o & (~1));
15516 o_conv.is_owned = (o & 1) || (o == 0);
15517 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15518 o_conv = UpdateAddHTLC_clone(&o_conv);
15519 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
15520 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
15521 return (uint64_t)ret_conv;
15524 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
15525 LDKDecodeError e_conv;
15526 e_conv.inner = (void*)(e & (~1));
15527 e_conv.is_owned = (e & 1) || (e == 0);
15528 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15529 e_conv = DecodeError_clone(&e_conv);
15530 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
15531 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
15532 return (uint64_t)ret_conv;
15535 jboolean __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint32_t o) {
15536 LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(o & ~1);
15537 jboolean ret_val = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
15541 void __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
15542 if ((_res & 1) != 0) return;
15543 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15544 CHECK_ACCESS(_res_ptr);
15545 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
15547 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
15550 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
15551 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
15552 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
15553 return (uint64_t)ret_conv;
15555 int64_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
15556 LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
15557 int64_t ret_val = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
15561 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
15562 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
15563 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
15564 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
15565 return (uint64_t)ret_conv;
15568 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
15570 o_conv.inner = (void*)(o & (~1));
15571 o_conv.is_owned = (o & 1) || (o == 0);
15572 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15573 o_conv = Ping_clone(&o_conv);
15574 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
15575 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
15576 return (uint64_t)ret_conv;
15579 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
15580 LDKDecodeError e_conv;
15581 e_conv.inner = (void*)(e & (~1));
15582 e_conv.is_owned = (e & 1) || (e == 0);
15583 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15584 e_conv = DecodeError_clone(&e_conv);
15585 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
15586 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
15587 return (uint64_t)ret_conv;
15590 jboolean __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_is_ok(uint32_t o) {
15591 LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)(o & ~1);
15592 jboolean ret_val = CResult_PingDecodeErrorZ_is_ok(o_conv);
15596 void __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
15597 if ((_res & 1) != 0) return;
15598 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15599 CHECK_ACCESS(_res_ptr);
15600 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
15602 CResult_PingDecodeErrorZ_free(_res_conv);
15605 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
15606 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
15607 *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
15608 return (uint64_t)ret_conv;
15610 int64_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint32_t arg) {
15611 LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
15612 int64_t ret_val = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
15616 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
15617 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
15618 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
15619 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
15620 return (uint64_t)ret_conv;
15623 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
15625 o_conv.inner = (void*)(o & (~1));
15626 o_conv.is_owned = (o & 1) || (o == 0);
15627 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15628 o_conv = Pong_clone(&o_conv);
15629 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
15630 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
15631 return (uint64_t)ret_conv;
15634 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
15635 LDKDecodeError e_conv;
15636 e_conv.inner = (void*)(e & (~1));
15637 e_conv.is_owned = (e & 1) || (e == 0);
15638 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15639 e_conv = DecodeError_clone(&e_conv);
15640 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
15641 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
15642 return (uint64_t)ret_conv;
15645 jboolean __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_is_ok(uint32_t o) {
15646 LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)(o & ~1);
15647 jboolean ret_val = CResult_PongDecodeErrorZ_is_ok(o_conv);
15651 void __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
15652 if ((_res & 1) != 0) return;
15653 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15654 CHECK_ACCESS(_res_ptr);
15655 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
15657 CResult_PongDecodeErrorZ_free(_res_conv);
15660 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
15661 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
15662 *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
15663 return (uint64_t)ret_conv;
15665 int64_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint32_t arg) {
15666 LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
15667 int64_t ret_val = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
15671 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
15672 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
15673 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
15674 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
15675 return (uint64_t)ret_conv;
15678 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
15679 LDKUnsignedChannelAnnouncement o_conv;
15680 o_conv.inner = (void*)(o & (~1));
15681 o_conv.is_owned = (o & 1) || (o == 0);
15682 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15683 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
15684 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
15685 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
15686 return (uint64_t)ret_conv;
15689 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
15690 LDKDecodeError e_conv;
15691 e_conv.inner = (void*)(e & (~1));
15692 e_conv.is_owned = (e & 1) || (e == 0);
15693 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15694 e_conv = DecodeError_clone(&e_conv);
15695 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
15696 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
15697 return (uint64_t)ret_conv;
15700 jboolean __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
15701 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(o & ~1);
15702 jboolean ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
15706 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
15707 if ((_res & 1) != 0) return;
15708 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15709 CHECK_ACCESS(_res_ptr);
15710 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
15712 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
15715 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
15716 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
15717 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
15718 return (uint64_t)ret_conv;
15720 int64_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
15721 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
15722 int64_t ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
15726 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
15727 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
15728 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
15729 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
15730 return (uint64_t)ret_conv;
15733 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
15734 LDKChannelAnnouncement o_conv;
15735 o_conv.inner = (void*)(o & (~1));
15736 o_conv.is_owned = (o & 1) || (o == 0);
15737 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15738 o_conv = ChannelAnnouncement_clone(&o_conv);
15739 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
15740 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
15741 return (uint64_t)ret_conv;
15744 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
15745 LDKDecodeError e_conv;
15746 e_conv.inner = (void*)(e & (~1));
15747 e_conv.is_owned = (e & 1) || (e == 0);
15748 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15749 e_conv = DecodeError_clone(&e_conv);
15750 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
15751 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
15752 return (uint64_t)ret_conv;
15755 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
15756 LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(o & ~1);
15757 jboolean ret_val = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
15761 void __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
15762 if ((_res & 1) != 0) return;
15763 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15764 CHECK_ACCESS(_res_ptr);
15765 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
15767 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
15770 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
15771 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
15772 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
15773 return (uint64_t)ret_conv;
15775 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
15776 LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
15777 int64_t ret_val = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
15781 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
15782 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
15783 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
15784 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
15785 return (uint64_t)ret_conv;
15788 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
15789 LDKUnsignedChannelUpdate o_conv;
15790 o_conv.inner = (void*)(o & (~1));
15791 o_conv.is_owned = (o & 1) || (o == 0);
15792 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15793 o_conv = UnsignedChannelUpdate_clone(&o_conv);
15794 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
15795 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
15796 return (uint64_t)ret_conv;
15799 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
15800 LDKDecodeError e_conv;
15801 e_conv.inner = (void*)(e & (~1));
15802 e_conv.is_owned = (e & 1) || (e == 0);
15803 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15804 e_conv = DecodeError_clone(&e_conv);
15805 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
15806 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
15807 return (uint64_t)ret_conv;
15810 jboolean __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint32_t o) {
15811 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(o & ~1);
15812 jboolean ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
15816 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
15817 if ((_res & 1) != 0) return;
15818 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15819 CHECK_ACCESS(_res_ptr);
15820 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
15822 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
15825 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
15826 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
15827 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
15828 return (uint64_t)ret_conv;
15830 int64_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
15831 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
15832 int64_t ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
15836 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
15837 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
15838 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
15839 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
15840 return (uint64_t)ret_conv;
15843 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
15844 LDKChannelUpdate o_conv;
15845 o_conv.inner = (void*)(o & (~1));
15846 o_conv.is_owned = (o & 1) || (o == 0);
15847 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15848 o_conv = ChannelUpdate_clone(&o_conv);
15849 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
15850 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
15851 return (uint64_t)ret_conv;
15854 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
15855 LDKDecodeError e_conv;
15856 e_conv.inner = (void*)(e & (~1));
15857 e_conv.is_owned = (e & 1) || (e == 0);
15858 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15859 e_conv = DecodeError_clone(&e_conv);
15860 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
15861 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
15862 return (uint64_t)ret_conv;
15865 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint32_t o) {
15866 LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(o & ~1);
15867 jboolean ret_val = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
15871 void __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
15872 if ((_res & 1) != 0) return;
15873 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15874 CHECK_ACCESS(_res_ptr);
15875 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
15877 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
15880 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
15881 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
15882 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
15883 return (uint64_t)ret_conv;
15885 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
15886 LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
15887 int64_t ret_val = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
15891 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
15892 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
15893 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
15894 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
15895 return (uint64_t)ret_conv;
15898 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
15899 LDKErrorMessage o_conv;
15900 o_conv.inner = (void*)(o & (~1));
15901 o_conv.is_owned = (o & 1) || (o == 0);
15902 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15903 o_conv = ErrorMessage_clone(&o_conv);
15904 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
15905 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
15906 return (uint64_t)ret_conv;
15909 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
15910 LDKDecodeError e_conv;
15911 e_conv.inner = (void*)(e & (~1));
15912 e_conv.is_owned = (e & 1) || (e == 0);
15913 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15914 e_conv = DecodeError_clone(&e_conv);
15915 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
15916 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
15917 return (uint64_t)ret_conv;
15920 jboolean __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint32_t o) {
15921 LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(o & ~1);
15922 jboolean ret_val = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
15926 void __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
15927 if ((_res & 1) != 0) return;
15928 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15929 CHECK_ACCESS(_res_ptr);
15930 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
15932 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
15935 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
15936 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
15937 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
15938 return (uint64_t)ret_conv;
15940 int64_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint32_t arg) {
15941 LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
15942 int64_t ret_val = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
15946 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
15947 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
15948 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
15949 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
15950 return (uint64_t)ret_conv;
15953 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
15954 LDKUnsignedNodeAnnouncement o_conv;
15955 o_conv.inner = (void*)(o & (~1));
15956 o_conv.is_owned = (o & 1) || (o == 0);
15957 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15958 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
15959 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
15960 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
15961 return (uint64_t)ret_conv;
15964 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
15965 LDKDecodeError e_conv;
15966 e_conv.inner = (void*)(e & (~1));
15967 e_conv.is_owned = (e & 1) || (e == 0);
15968 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15969 e_conv = DecodeError_clone(&e_conv);
15970 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
15971 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
15972 return (uint64_t)ret_conv;
15975 jboolean __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
15976 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(o & ~1);
15977 jboolean ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
15981 void __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
15982 if ((_res & 1) != 0) return;
15983 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15984 CHECK_ACCESS(_res_ptr);
15985 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
15987 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
15990 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
15991 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
15992 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
15993 return (uint64_t)ret_conv;
15995 int64_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
15996 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
15997 int64_t ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
16001 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
16002 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
16003 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
16004 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
16005 return (uint64_t)ret_conv;
16008 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
16009 LDKNodeAnnouncement o_conv;
16010 o_conv.inner = (void*)(o & (~1));
16011 o_conv.is_owned = (o & 1) || (o == 0);
16012 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16013 o_conv = NodeAnnouncement_clone(&o_conv);
16014 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
16015 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
16016 return (uint64_t)ret_conv;
16019 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
16020 LDKDecodeError e_conv;
16021 e_conv.inner = (void*)(e & (~1));
16022 e_conv.is_owned = (e & 1) || (e == 0);
16023 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16024 e_conv = DecodeError_clone(&e_conv);
16025 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
16026 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
16027 return (uint64_t)ret_conv;
16030 jboolean __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
16031 LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(o & ~1);
16032 jboolean ret_val = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
16036 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
16037 if ((_res & 1) != 0) return;
16038 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16039 CHECK_ACCESS(_res_ptr);
16040 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
16042 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
16045 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
16046 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
16047 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
16048 return (uint64_t)ret_conv;
16050 int64_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
16051 LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
16052 int64_t ret_val = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
16056 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
16057 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
16058 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
16059 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
16060 return (uint64_t)ret_conv;
16063 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
16064 LDKQueryShortChannelIds o_conv;
16065 o_conv.inner = (void*)(o & (~1));
16066 o_conv.is_owned = (o & 1) || (o == 0);
16067 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16068 o_conv = QueryShortChannelIds_clone(&o_conv);
16069 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
16070 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
16071 return (uint64_t)ret_conv;
16074 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
16075 LDKDecodeError e_conv;
16076 e_conv.inner = (void*)(e & (~1));
16077 e_conv.is_owned = (e & 1) || (e == 0);
16078 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16079 e_conv = DecodeError_clone(&e_conv);
16080 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
16081 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
16082 return (uint64_t)ret_conv;
16085 jboolean __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint32_t o) {
16086 LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(o & ~1);
16087 jboolean ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
16091 void __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
16092 if ((_res & 1) != 0) return;
16093 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16094 CHECK_ACCESS(_res_ptr);
16095 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
16097 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
16100 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
16101 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
16102 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
16103 return (uint64_t)ret_conv;
16105 int64_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint32_t arg) {
16106 LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
16107 int64_t ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
16111 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
16112 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
16113 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
16114 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
16115 return (uint64_t)ret_conv;
16118 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
16119 LDKReplyShortChannelIdsEnd o_conv;
16120 o_conv.inner = (void*)(o & (~1));
16121 o_conv.is_owned = (o & 1) || (o == 0);
16122 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16123 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
16124 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
16125 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
16126 return (uint64_t)ret_conv;
16129 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
16130 LDKDecodeError e_conv;
16131 e_conv.inner = (void*)(e & (~1));
16132 e_conv.is_owned = (e & 1) || (e == 0);
16133 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16134 e_conv = DecodeError_clone(&e_conv);
16135 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
16136 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
16137 return (uint64_t)ret_conv;
16140 jboolean __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint32_t o) {
16141 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(o & ~1);
16142 jboolean ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
16146 void __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
16147 if ((_res & 1) != 0) return;
16148 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16149 CHECK_ACCESS(_res_ptr);
16150 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
16152 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
16155 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
16156 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
16157 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
16158 return (uint64_t)ret_conv;
16160 int64_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint32_t arg) {
16161 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
16162 int64_t ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
16166 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
16167 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
16168 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
16169 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
16170 return (uint64_t)ret_conv;
16173 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
16174 LDKQueryChannelRange o_conv;
16175 o_conv.inner = (void*)(o & (~1));
16176 o_conv.is_owned = (o & 1) || (o == 0);
16177 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16178 o_conv = QueryChannelRange_clone(&o_conv);
16179 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
16180 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
16181 return (uint64_t)ret_conv;
16184 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
16185 LDKDecodeError e_conv;
16186 e_conv.inner = (void*)(e & (~1));
16187 e_conv.is_owned = (e & 1) || (e == 0);
16188 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16189 e_conv = DecodeError_clone(&e_conv);
16190 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
16191 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
16192 return (uint64_t)ret_conv;
16195 jboolean __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint32_t o) {
16196 LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(o & ~1);
16197 jboolean ret_val = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
16201 void __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
16202 if ((_res & 1) != 0) return;
16203 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16204 CHECK_ACCESS(_res_ptr);
16205 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
16207 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
16210 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
16211 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
16212 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
16213 return (uint64_t)ret_conv;
16215 int64_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
16216 LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
16217 int64_t ret_val = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
16221 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
16222 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
16223 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
16224 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
16225 return (uint64_t)ret_conv;
16228 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
16229 LDKReplyChannelRange o_conv;
16230 o_conv.inner = (void*)(o & (~1));
16231 o_conv.is_owned = (o & 1) || (o == 0);
16232 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16233 o_conv = ReplyChannelRange_clone(&o_conv);
16234 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
16235 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
16236 return (uint64_t)ret_conv;
16239 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
16240 LDKDecodeError e_conv;
16241 e_conv.inner = (void*)(e & (~1));
16242 e_conv.is_owned = (e & 1) || (e == 0);
16243 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16244 e_conv = DecodeError_clone(&e_conv);
16245 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
16246 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
16247 return (uint64_t)ret_conv;
16250 jboolean __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint32_t o) {
16251 LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(o & ~1);
16252 jboolean ret_val = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
16256 void __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
16257 if ((_res & 1) != 0) return;
16258 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16259 CHECK_ACCESS(_res_ptr);
16260 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
16262 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
16265 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
16266 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
16267 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
16268 return (uint64_t)ret_conv;
16270 int64_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
16271 LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
16272 int64_t ret_val = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
16276 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
16277 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
16278 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
16279 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
16280 return (uint64_t)ret_conv;
16283 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
16284 LDKGossipTimestampFilter o_conv;
16285 o_conv.inner = (void*)(o & (~1));
16286 o_conv.is_owned = (o & 1) || (o == 0);
16287 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16288 o_conv = GossipTimestampFilter_clone(&o_conv);
16289 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
16290 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
16291 return (uint64_t)ret_conv;
16294 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
16295 LDKDecodeError e_conv;
16296 e_conv.inner = (void*)(e & (~1));
16297 e_conv.is_owned = (e & 1) || (e == 0);
16298 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16299 e_conv = DecodeError_clone(&e_conv);
16300 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
16301 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
16302 return (uint64_t)ret_conv;
16305 jboolean __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint32_t o) {
16306 LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(o & ~1);
16307 jboolean ret_val = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
16311 void __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
16312 if ((_res & 1) != 0) return;
16313 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16314 CHECK_ACCESS(_res_ptr);
16315 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
16317 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
16320 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
16321 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
16322 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
16323 return (uint64_t)ret_conv;
16325 int64_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint32_t arg) {
16326 LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
16327 int64_t ret_val = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
16331 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
16332 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
16333 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
16334 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
16335 return (uint64_t)ret_conv;
16338 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint32_t o) {
16340 o_conv.inner = (void*)(o & (~1));
16341 o_conv.is_owned = (o & 1) || (o == 0);
16342 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16343 o_conv = Invoice_clone(&o_conv);
16344 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
16345 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
16346 return (uint64_t)ret_conv;
16349 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint32_t e) {
16350 void* e_ptr = (void*)(((uint64_t)e) & ~1);
16351 CHECK_ACCESS(e_ptr);
16352 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
16353 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uint64_t)e) & ~1));
16354 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
16355 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
16356 return (uint64_t)ret_conv;
16359 jboolean __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_is_ok(uint32_t o) {
16360 LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(o & ~1);
16361 jboolean ret_val = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
16365 void __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint32_t _res) {
16366 if ((_res & 1) != 0) return;
16367 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16368 CHECK_ACCESS(_res_ptr);
16369 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
16371 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
16374 static inline uint64_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
16375 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
16376 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
16377 return (uint64_t)ret_conv;
16379 int64_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr(uint32_t arg) {
16380 LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
16381 int64_t ret_val = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
16385 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint32_t orig) {
16386 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
16387 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
16388 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
16389 return (uint64_t)ret_conv;
16392 uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_some(uint32_t o) {
16393 void* o_ptr = (void*)(((uint64_t)o) & ~1);
16394 CHECK_ACCESS(o_ptr);
16395 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
16396 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
16397 *ret_copy = COption_FilterZ_some(o_conv);
16398 uint64_t ret_ref = (uint64_t)ret_copy;
16402 uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_none() {
16403 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
16404 *ret_copy = COption_FilterZ_none();
16405 uint64_t ret_ref = (uint64_t)ret_copy;
16409 void __attribute__((visibility("default"))) TS_COption_FilterZ_free(uint32_t _res) {
16410 if ((_res & 1) != 0) return;
16411 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16412 CHECK_ACCESS(_res_ptr);
16413 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
16415 COption_FilterZ_free(_res_conv);
16418 uint32_t __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint32_t o) {
16419 LDKLockedChannelMonitor o_conv;
16420 o_conv.inner = (void*)(o & (~1));
16421 o_conv.is_owned = (o & 1) || (o == 0);
16422 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16423 // Warning: we need a move here but no clone is available for LDKLockedChannelMonitor
16424 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
16425 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
16426 return (uint64_t)ret_conv;
16429 uint32_t __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
16430 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
16431 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
16432 return (uint64_t)ret_conv;
16435 jboolean __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint32_t o) {
16436 LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(o & ~1);
16437 jboolean ret_val = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
16441 void __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint32_t _res) {
16442 if ((_res & 1) != 0) return;
16443 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16444 CHECK_ACCESS(_res_ptr);
16445 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
16447 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
16450 void __attribute__((visibility("default"))) TS_CVec_OutPointZ_free(uint32_tArray _res) {
16451 LDKCVec_OutPointZ _res_constr;
16452 _res_constr.datalen = *((uint32_t*)_res);
16453 if (_res_constr.datalen > 0)
16454 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
16456 _res_constr.data = NULL;
16457 uint32_t* _res_vals = (uint32_t*)(_res + 4);
16458 for (size_t k = 0; k < _res_constr.datalen; k++) {
16459 uint32_t _res_conv_10 = _res_vals[k];
16460 LDKOutPoint _res_conv_10_conv;
16461 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
16462 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
16463 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
16464 _res_constr.data[k] = _res_conv_10_conv;
16466 CVec_OutPointZ_free(_res_constr);
16469 void __attribute__((visibility("default"))) TS_PaymentPurpose_free(uint32_t this_ptr) {
16470 if ((this_ptr & 1) != 0) return;
16471 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16472 CHECK_ACCESS(this_ptr_ptr);
16473 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
16474 FREE((void*)this_ptr);
16475 PaymentPurpose_free(this_ptr_conv);
16478 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
16479 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
16480 *ret_copy = PaymentPurpose_clone(arg);
16481 uint64_t ret_ref = (uint64_t)ret_copy;
16484 int64_t __attribute__((visibility("default"))) TS_PaymentPurpose_clone_ptr(uint32_t arg) {
16485 LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)arg;
16486 int64_t ret_val = PaymentPurpose_clone_ptr(arg_conv);
16490 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_clone(uint32_t orig) {
16491 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
16492 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
16493 *ret_copy = PaymentPurpose_clone(orig_conv);
16494 uint64_t ret_ref = (uint64_t)ret_copy;
16498 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) {
16499 LDKThirtyTwoBytes payment_preimage_ref;
16500 CHECK(*((uint32_t*)payment_preimage) == 32);
16501 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
16502 LDKThirtyTwoBytes payment_secret_ref;
16503 CHECK(*((uint32_t*)payment_secret) == 32);
16504 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
16505 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
16506 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
16507 uint64_t ret_ref = (uint64_t)ret_copy;
16511 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
16512 LDKThirtyTwoBytes a_ref;
16513 CHECK(*((uint32_t*)a) == 32);
16514 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
16515 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
16516 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
16517 uint64_t ret_ref = (uint64_t)ret_copy;
16521 void __attribute__((visibility("default"))) TS_ClosureReason_free(uint32_t this_ptr) {
16522 if ((this_ptr & 1) != 0) return;
16523 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16524 CHECK_ACCESS(this_ptr_ptr);
16525 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
16526 FREE((void*)this_ptr);
16527 ClosureReason_free(this_ptr_conv);
16530 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
16531 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16532 *ret_copy = ClosureReason_clone(arg);
16533 uint64_t ret_ref = (uint64_t)ret_copy;
16536 int64_t __attribute__((visibility("default"))) TS_ClosureReason_clone_ptr(uint32_t arg) {
16537 LDKClosureReason* arg_conv = (LDKClosureReason*)arg;
16538 int64_t ret_val = ClosureReason_clone_ptr(arg_conv);
16542 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_clone(uint32_t orig) {
16543 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
16544 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16545 *ret_copy = ClosureReason_clone(orig_conv);
16546 uint64_t ret_ref = (uint64_t)ret_copy;
16550 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
16551 LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
16552 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16553 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
16554 uint64_t ret_ref = (uint64_t)ret_copy;
16558 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_holder_force_closed() {
16559 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16560 *ret_copy = ClosureReason_holder_force_closed();
16561 uint64_t ret_ref = (uint64_t)ret_copy;
16565 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_cooperative_closure() {
16566 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16567 *ret_copy = ClosureReason_cooperative_closure();
16568 uint64_t ret_ref = (uint64_t)ret_copy;
16572 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_commitment_tx_confirmed() {
16573 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16574 *ret_copy = ClosureReason_commitment_tx_confirmed();
16575 uint64_t ret_ref = (uint64_t)ret_copy;
16579 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_funding_timed_out() {
16580 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16581 *ret_copy = ClosureReason_funding_timed_out();
16582 uint64_t ret_ref = (uint64_t)ret_copy;
16586 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_processing_error(jstring err) {
16587 LDKStr err_conv = str_ref_to_owned_c(err);
16588 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16589 *ret_copy = ClosureReason_processing_error(err_conv);
16590 uint64_t ret_ref = (uint64_t)ret_copy;
16594 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_disconnected_peer() {
16595 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16596 *ret_copy = ClosureReason_disconnected_peer();
16597 uint64_t ret_ref = (uint64_t)ret_copy;
16601 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_outdated_channel_manager() {
16602 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16603 *ret_copy = ClosureReason_outdated_channel_manager();
16604 uint64_t ret_ref = (uint64_t)ret_copy;
16608 int8_tArray __attribute__((visibility("default"))) TS_ClosureReason_write(uint32_t obj) {
16609 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
16610 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
16611 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16612 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16613 CVec_u8Z_free(ret_var);
16617 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_read(int8_tArray ser) {
16618 LDKu8slice ser_ref;
16619 ser_ref.datalen = *((uint32_t*)ser);
16620 ser_ref.data = (int8_t*)(ser + 4);
16621 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16622 *ret_conv = ClosureReason_read(ser_ref);
16623 return (uint64_t)ret_conv;
16626 void __attribute__((visibility("default"))) TS_Event_free(uint32_t this_ptr) {
16627 if ((this_ptr & 1) != 0) return;
16628 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16629 CHECK_ACCESS(this_ptr_ptr);
16630 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
16631 FREE((void*)this_ptr);
16632 Event_free(this_ptr_conv);
16635 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
16636 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16637 *ret_copy = Event_clone(arg);
16638 uint64_t ret_ref = (uint64_t)ret_copy;
16641 int64_t __attribute__((visibility("default"))) TS_Event_clone_ptr(uint32_t arg) {
16642 LDKEvent* arg_conv = (LDKEvent*)arg;
16643 int64_t ret_val = Event_clone_ptr(arg_conv);
16647 uint32_t __attribute__((visibility("default"))) TS_Event_clone(uint32_t orig) {
16648 LDKEvent* orig_conv = (LDKEvent*)orig;
16649 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16650 *ret_copy = Event_clone(orig_conv);
16651 uint64_t ret_ref = (uint64_t)ret_copy;
16655 uint32_t __attribute__((visibility("default"))) TS_Event_funding_generation_ready(int8_tArray temporary_channel_id, int64_t channel_value_satoshis, int8_tArray output_script, int64_t user_channel_id) {
16656 LDKThirtyTwoBytes temporary_channel_id_ref;
16657 CHECK(*((uint32_t*)temporary_channel_id) == 32);
16658 memcpy(temporary_channel_id_ref.data, (uint8_t*)(temporary_channel_id + 4), 32);
16659 LDKCVec_u8Z output_script_ref;
16660 output_script_ref.datalen = *((uint32_t*)output_script);
16661 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
16662 memcpy(output_script_ref.data, (uint8_t*)(output_script + 4), output_script_ref.datalen);
16663 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16664 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
16665 uint64_t ret_ref = (uint64_t)ret_copy;
16669 uint32_t __attribute__((visibility("default"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amt, uint32_t purpose) {
16670 LDKThirtyTwoBytes payment_hash_ref;
16671 CHECK(*((uint32_t*)payment_hash) == 32);
16672 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
16673 void* purpose_ptr = (void*)(((uint64_t)purpose) & ~1);
16674 CHECK_ACCESS(purpose_ptr);
16675 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
16676 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uint64_t)purpose) & ~1));
16677 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16678 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
16679 uint64_t ret_ref = (uint64_t)ret_copy;
16683 uint32_t __attribute__((visibility("default"))) TS_Event_payment_sent(int8_tArray payment_id, int8_tArray payment_preimage, int8_tArray payment_hash, uint32_t fee_paid_msat) {
16684 LDKThirtyTwoBytes payment_id_ref;
16685 CHECK(*((uint32_t*)payment_id) == 32);
16686 memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32);
16687 LDKThirtyTwoBytes payment_preimage_ref;
16688 CHECK(*((uint32_t*)payment_preimage) == 32);
16689 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
16690 LDKThirtyTwoBytes payment_hash_ref;
16691 CHECK(*((uint32_t*)payment_hash) == 32);
16692 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
16693 void* fee_paid_msat_ptr = (void*)(((uint64_t)fee_paid_msat) & ~1);
16694 CHECK_ACCESS(fee_paid_msat_ptr);
16695 LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
16696 fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_paid_msat) & ~1));
16697 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16698 *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
16699 uint64_t ret_ref = (uint64_t)ret_copy;
16703 uint32_t __attribute__((visibility("default"))) 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) {
16704 LDKThirtyTwoBytes payment_id_ref;
16705 CHECK(*((uint32_t*)payment_id) == 32);
16706 memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32);
16707 LDKThirtyTwoBytes payment_hash_ref;
16708 CHECK(*((uint32_t*)payment_hash) == 32);
16709 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
16710 void* network_update_ptr = (void*)(((uint64_t)network_update) & ~1);
16711 CHECK_ACCESS(network_update_ptr);
16712 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
16713 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1));
16714 LDKCVec_RouteHopZ path_constr;
16715 path_constr.datalen = *((uint32_t*)path);
16716 if (path_constr.datalen > 0)
16717 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
16719 path_constr.data = NULL;
16720 uint32_t* path_vals = (uint32_t*)(path + 4);
16721 for (size_t k = 0; k < path_constr.datalen; k++) {
16722 uint32_t path_conv_10 = path_vals[k];
16723 LDKRouteHop path_conv_10_conv;
16724 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
16725 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
16726 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
16727 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
16728 path_constr.data[k] = path_conv_10_conv;
16730 void* short_channel_id_ptr = (void*)(((uint64_t)short_channel_id) & ~1);
16731 CHECK_ACCESS(short_channel_id_ptr);
16732 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
16733 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id) & ~1));
16734 LDKRouteParameters retry_conv;
16735 retry_conv.inner = (void*)(retry & (~1));
16736 retry_conv.is_owned = (retry & 1) || (retry == 0);
16737 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
16738 retry_conv = RouteParameters_clone(&retry_conv);
16739 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16740 *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);
16741 uint64_t ret_ref = (uint64_t)ret_copy;
16745 uint32_t __attribute__((visibility("default"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash) {
16746 LDKThirtyTwoBytes payment_id_ref;
16747 CHECK(*((uint32_t*)payment_id) == 32);
16748 memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32);
16749 LDKThirtyTwoBytes payment_hash_ref;
16750 CHECK(*((uint32_t*)payment_hash) == 32);
16751 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
16752 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16753 *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
16754 uint64_t ret_ref = (uint64_t)ret_copy;
16758 uint32_t __attribute__((visibility("default"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
16759 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16760 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
16761 uint64_t ret_ref = (uint64_t)ret_copy;
16765 uint32_t __attribute__((visibility("default"))) TS_Event_spendable_outputs(uint32_tArray outputs) {
16766 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
16767 outputs_constr.datalen = *((uint32_t*)outputs);
16768 if (outputs_constr.datalen > 0)
16769 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
16771 outputs_constr.data = NULL;
16772 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
16773 for (size_t b = 0; b < outputs_constr.datalen; b++) {
16774 uint32_t outputs_conv_27 = outputs_vals[b];
16775 void* outputs_conv_27_ptr = (void*)(((uint64_t)outputs_conv_27) & ~1);
16776 CHECK_ACCESS(outputs_conv_27_ptr);
16777 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
16778 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1));
16779 outputs_constr.data[b] = outputs_conv_27_conv;
16781 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16782 *ret_copy = Event_spendable_outputs(outputs_constr);
16783 uint64_t ret_ref = (uint64_t)ret_copy;
16787 uint32_t __attribute__((visibility("default"))) TS_Event_payment_forwarded(uint32_t fee_earned_msat, jboolean claim_from_onchain_tx) {
16788 void* fee_earned_msat_ptr = (void*)(((uint64_t)fee_earned_msat) & ~1);
16789 CHECK_ACCESS(fee_earned_msat_ptr);
16790 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
16791 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1));
16792 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16793 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
16794 uint64_t ret_ref = (uint64_t)ret_copy;
16798 uint32_t __attribute__((visibility("default"))) TS_Event_channel_closed(int8_tArray channel_id, int64_t user_channel_id, uint32_t reason) {
16799 LDKThirtyTwoBytes channel_id_ref;
16800 CHECK(*((uint32_t*)channel_id) == 32);
16801 memcpy(channel_id_ref.data, (uint8_t*)(channel_id + 4), 32);
16802 void* reason_ptr = (void*)(((uint64_t)reason) & ~1);
16803 CHECK_ACCESS(reason_ptr);
16804 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
16805 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1));
16806 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16807 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
16808 uint64_t ret_ref = (uint64_t)ret_copy;
16812 uint32_t __attribute__((visibility("default"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
16813 LDKThirtyTwoBytes channel_id_ref;
16814 CHECK(*((uint32_t*)channel_id) == 32);
16815 memcpy(channel_id_ref.data, (uint8_t*)(channel_id + 4), 32);
16816 LDKTransaction transaction_ref;
16817 transaction_ref.datalen = *((uint32_t*)transaction);
16818 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
16819 memcpy(transaction_ref.data, (uint8_t*)(transaction + 4), transaction_ref.datalen);
16820 transaction_ref.data_is_owned = true;
16821 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16822 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
16823 uint64_t ret_ref = (uint64_t)ret_copy;
16827 uint32_t __attribute__((visibility("default"))) TS_Event_payment_path_successful(int8_tArray payment_id, int8_tArray payment_hash, uint32_tArray path) {
16828 LDKThirtyTwoBytes payment_id_ref;
16829 CHECK(*((uint32_t*)payment_id) == 32);
16830 memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32);
16831 LDKThirtyTwoBytes payment_hash_ref;
16832 CHECK(*((uint32_t*)payment_hash) == 32);
16833 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
16834 LDKCVec_RouteHopZ path_constr;
16835 path_constr.datalen = *((uint32_t*)path);
16836 if (path_constr.datalen > 0)
16837 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
16839 path_constr.data = NULL;
16840 uint32_t* path_vals = (uint32_t*)(path + 4);
16841 for (size_t k = 0; k < path_constr.datalen; k++) {
16842 uint32_t path_conv_10 = path_vals[k];
16843 LDKRouteHop path_conv_10_conv;
16844 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
16845 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
16846 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
16847 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
16848 path_constr.data[k] = path_conv_10_conv;
16850 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16851 *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
16852 uint64_t ret_ref = (uint64_t)ret_copy;
16856 int8_tArray __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) {
16857 LDKEvent* obj_conv = (LDKEvent*)obj;
16858 LDKCVec_u8Z ret_var = Event_write(obj_conv);
16859 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16860 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16861 CVec_u8Z_free(ret_var);
16865 uint32_t __attribute__((visibility("default"))) TS_Event_read(int8_tArray ser) {
16866 LDKu8slice ser_ref;
16867 ser_ref.datalen = *((uint32_t*)ser);
16868 ser_ref.data = (int8_t*)(ser + 4);
16869 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16870 *ret_conv = Event_read(ser_ref);
16871 return (uint64_t)ret_conv;
16874 void __attribute__((visibility("default"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
16875 if ((this_ptr & 1) != 0) return;
16876 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16877 CHECK_ACCESS(this_ptr_ptr);
16878 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
16879 FREE((void*)this_ptr);
16880 MessageSendEvent_free(this_ptr_conv);
16883 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
16884 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16885 *ret_copy = MessageSendEvent_clone(arg);
16886 uint64_t ret_ref = (uint64_t)ret_copy;
16889 int64_t __attribute__((visibility("default"))) TS_MessageSendEvent_clone_ptr(uint32_t arg) {
16890 LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)arg;
16891 int64_t ret_val = MessageSendEvent_clone_ptr(arg_conv);
16895 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_clone(uint32_t orig) {
16896 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
16897 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16898 *ret_copy = MessageSendEvent_clone(orig_conv);
16899 uint64_t ret_ref = (uint64_t)ret_copy;
16903 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint32_t msg) {
16904 LDKPublicKey node_id_ref;
16905 CHECK(*((uint32_t*)node_id) == 33);
16906 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16907 LDKAcceptChannel msg_conv;
16908 msg_conv.inner = (void*)(msg & (~1));
16909 msg_conv.is_owned = (msg & 1) || (msg == 0);
16910 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16911 msg_conv = AcceptChannel_clone(&msg_conv);
16912 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16913 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
16914 uint64_t ret_ref = (uint64_t)ret_copy;
16918 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint32_t msg) {
16919 LDKPublicKey node_id_ref;
16920 CHECK(*((uint32_t*)node_id) == 33);
16921 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16922 LDKOpenChannel msg_conv;
16923 msg_conv.inner = (void*)(msg & (~1));
16924 msg_conv.is_owned = (msg & 1) || (msg == 0);
16925 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16926 msg_conv = OpenChannel_clone(&msg_conv);
16927 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16928 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
16929 uint64_t ret_ref = (uint64_t)ret_copy;
16933 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint32_t msg) {
16934 LDKPublicKey node_id_ref;
16935 CHECK(*((uint32_t*)node_id) == 33);
16936 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16937 LDKFundingCreated msg_conv;
16938 msg_conv.inner = (void*)(msg & (~1));
16939 msg_conv.is_owned = (msg & 1) || (msg == 0);
16940 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16941 msg_conv = FundingCreated_clone(&msg_conv);
16942 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16943 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
16944 uint64_t ret_ref = (uint64_t)ret_copy;
16948 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint32_t msg) {
16949 LDKPublicKey node_id_ref;
16950 CHECK(*((uint32_t*)node_id) == 33);
16951 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16952 LDKFundingSigned msg_conv;
16953 msg_conv.inner = (void*)(msg & (~1));
16954 msg_conv.is_owned = (msg & 1) || (msg == 0);
16955 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16956 msg_conv = FundingSigned_clone(&msg_conv);
16957 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16958 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
16959 uint64_t ret_ref = (uint64_t)ret_copy;
16963 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_locked(int8_tArray node_id, uint32_t msg) {
16964 LDKPublicKey node_id_ref;
16965 CHECK(*((uint32_t*)node_id) == 33);
16966 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16967 LDKFundingLocked msg_conv;
16968 msg_conv.inner = (void*)(msg & (~1));
16969 msg_conv.is_owned = (msg & 1) || (msg == 0);
16970 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16971 msg_conv = FundingLocked_clone(&msg_conv);
16972 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16973 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
16974 uint64_t ret_ref = (uint64_t)ret_copy;
16978 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint32_t msg) {
16979 LDKPublicKey node_id_ref;
16980 CHECK(*((uint32_t*)node_id) == 33);
16981 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16982 LDKAnnouncementSignatures msg_conv;
16983 msg_conv.inner = (void*)(msg & (~1));
16984 msg_conv.is_owned = (msg & 1) || (msg == 0);
16985 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16986 msg_conv = AnnouncementSignatures_clone(&msg_conv);
16987 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16988 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
16989 uint64_t ret_ref = (uint64_t)ret_copy;
16993 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint32_t updates) {
16994 LDKPublicKey node_id_ref;
16995 CHECK(*((uint32_t*)node_id) == 33);
16996 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16997 LDKCommitmentUpdate updates_conv;
16998 updates_conv.inner = (void*)(updates & (~1));
16999 updates_conv.is_owned = (updates & 1) || (updates == 0);
17000 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
17001 updates_conv = CommitmentUpdate_clone(&updates_conv);
17002 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17003 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
17004 uint64_t ret_ref = (uint64_t)ret_copy;
17008 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint32_t msg) {
17009 LDKPublicKey node_id_ref;
17010 CHECK(*((uint32_t*)node_id) == 33);
17011 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
17012 LDKRevokeAndACK msg_conv;
17013 msg_conv.inner = (void*)(msg & (~1));
17014 msg_conv.is_owned = (msg & 1) || (msg == 0);
17015 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17016 msg_conv = RevokeAndACK_clone(&msg_conv);
17017 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17018 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
17019 uint64_t ret_ref = (uint64_t)ret_copy;
17023 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint32_t msg) {
17024 LDKPublicKey node_id_ref;
17025 CHECK(*((uint32_t*)node_id) == 33);
17026 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
17027 LDKClosingSigned msg_conv;
17028 msg_conv.inner = (void*)(msg & (~1));
17029 msg_conv.is_owned = (msg & 1) || (msg == 0);
17030 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17031 msg_conv = ClosingSigned_clone(&msg_conv);
17032 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17033 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
17034 uint64_t ret_ref = (uint64_t)ret_copy;
17038 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint32_t msg) {
17039 LDKPublicKey node_id_ref;
17040 CHECK(*((uint32_t*)node_id) == 33);
17041 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
17042 LDKShutdown msg_conv;
17043 msg_conv.inner = (void*)(msg & (~1));
17044 msg_conv.is_owned = (msg & 1) || (msg == 0);
17045 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17046 msg_conv = Shutdown_clone(&msg_conv);
17047 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17048 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
17049 uint64_t ret_ref = (uint64_t)ret_copy;
17053 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint32_t msg) {
17054 LDKPublicKey node_id_ref;
17055 CHECK(*((uint32_t*)node_id) == 33);
17056 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
17057 LDKChannelReestablish msg_conv;
17058 msg_conv.inner = (void*)(msg & (~1));
17059 msg_conv.is_owned = (msg & 1) || (msg == 0);
17060 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17061 msg_conv = ChannelReestablish_clone(&msg_conv);
17062 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17063 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
17064 uint64_t ret_ref = (uint64_t)ret_copy;
17068 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_announcement(uint32_t msg, uint32_t update_msg) {
17069 LDKChannelAnnouncement msg_conv;
17070 msg_conv.inner = (void*)(msg & (~1));
17071 msg_conv.is_owned = (msg & 1) || (msg == 0);
17072 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17073 msg_conv = ChannelAnnouncement_clone(&msg_conv);
17074 LDKChannelUpdate update_msg_conv;
17075 update_msg_conv.inner = (void*)(update_msg & (~1));
17076 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
17077 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
17078 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
17079 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17080 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
17081 uint64_t ret_ref = (uint64_t)ret_copy;
17085 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_node_announcement(uint32_t msg) {
17086 LDKNodeAnnouncement msg_conv;
17087 msg_conv.inner = (void*)(msg & (~1));
17088 msg_conv.is_owned = (msg & 1) || (msg == 0);
17089 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17090 msg_conv = NodeAnnouncement_clone(&msg_conv);
17091 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17092 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
17093 uint64_t ret_ref = (uint64_t)ret_copy;
17097 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_update(uint32_t msg) {
17098 LDKChannelUpdate msg_conv;
17099 msg_conv.inner = (void*)(msg & (~1));
17100 msg_conv.is_owned = (msg & 1) || (msg == 0);
17101 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17102 msg_conv = ChannelUpdate_clone(&msg_conv);
17103 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17104 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
17105 uint64_t ret_ref = (uint64_t)ret_copy;
17109 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint32_t msg) {
17110 LDKPublicKey node_id_ref;
17111 CHECK(*((uint32_t*)node_id) == 33);
17112 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
17113 LDKChannelUpdate msg_conv;
17114 msg_conv.inner = (void*)(msg & (~1));
17115 msg_conv.is_owned = (msg & 1) || (msg == 0);
17116 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17117 msg_conv = ChannelUpdate_clone(&msg_conv);
17118 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17119 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
17120 uint64_t ret_ref = (uint64_t)ret_copy;
17124 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint32_t action) {
17125 LDKPublicKey node_id_ref;
17126 CHECK(*((uint32_t*)node_id) == 33);
17127 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
17128 void* action_ptr = (void*)(((uint64_t)action) & ~1);
17129 CHECK_ACCESS(action_ptr);
17130 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
17131 action_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action) & ~1));
17132 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17133 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
17134 uint64_t ret_ref = (uint64_t)ret_copy;
17138 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint32_t msg) {
17139 LDKPublicKey node_id_ref;
17140 CHECK(*((uint32_t*)node_id) == 33);
17141 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
17142 LDKQueryChannelRange msg_conv;
17143 msg_conv.inner = (void*)(msg & (~1));
17144 msg_conv.is_owned = (msg & 1) || (msg == 0);
17145 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17146 msg_conv = QueryChannelRange_clone(&msg_conv);
17147 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17148 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
17149 uint64_t ret_ref = (uint64_t)ret_copy;
17153 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint32_t msg) {
17154 LDKPublicKey node_id_ref;
17155 CHECK(*((uint32_t*)node_id) == 33);
17156 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
17157 LDKQueryShortChannelIds msg_conv;
17158 msg_conv.inner = (void*)(msg & (~1));
17159 msg_conv.is_owned = (msg & 1) || (msg == 0);
17160 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17161 msg_conv = QueryShortChannelIds_clone(&msg_conv);
17162 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17163 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
17164 uint64_t ret_ref = (uint64_t)ret_copy;
17168 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint32_t msg) {
17169 LDKPublicKey node_id_ref;
17170 CHECK(*((uint32_t*)node_id) == 33);
17171 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
17172 LDKReplyChannelRange msg_conv;
17173 msg_conv.inner = (void*)(msg & (~1));
17174 msg_conv.is_owned = (msg & 1) || (msg == 0);
17175 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17176 msg_conv = ReplyChannelRange_clone(&msg_conv);
17177 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17178 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
17179 uint64_t ret_ref = (uint64_t)ret_copy;
17183 void __attribute__((visibility("default"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
17184 if ((this_ptr & 1) != 0) return;
17185 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17186 CHECK_ACCESS(this_ptr_ptr);
17187 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
17188 FREE((void*)this_ptr);
17189 MessageSendEventsProvider_free(this_ptr_conv);
17192 void __attribute__((visibility("default"))) TS_EventsProvider_free(uint32_t this_ptr) {
17193 if ((this_ptr & 1) != 0) return;
17194 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17195 CHECK_ACCESS(this_ptr_ptr);
17196 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
17197 FREE((void*)this_ptr);
17198 EventsProvider_free(this_ptr_conv);
17201 void __attribute__((visibility("default"))) TS_EventHandler_free(uint32_t this_ptr) {
17202 if ((this_ptr & 1) != 0) return;
17203 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17204 CHECK_ACCESS(this_ptr_ptr);
17205 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
17206 FREE((void*)this_ptr);
17207 EventHandler_free(this_ptr_conv);
17210 void __attribute__((visibility("default"))) TS_APIError_free(uint32_t this_ptr) {
17211 if ((this_ptr & 1) != 0) return;
17212 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17213 CHECK_ACCESS(this_ptr_ptr);
17214 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
17215 FREE((void*)this_ptr);
17216 APIError_free(this_ptr_conv);
17219 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
17220 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17221 *ret_copy = APIError_clone(arg);
17222 uint64_t ret_ref = (uint64_t)ret_copy;
17225 int64_t __attribute__((visibility("default"))) TS_APIError_clone_ptr(uint32_t arg) {
17226 LDKAPIError* arg_conv = (LDKAPIError*)arg;
17227 int64_t ret_val = APIError_clone_ptr(arg_conv);
17231 uint32_t __attribute__((visibility("default"))) TS_APIError_clone(uint32_t orig) {
17232 LDKAPIError* orig_conv = (LDKAPIError*)orig;
17233 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17234 *ret_copy = APIError_clone(orig_conv);
17235 uint64_t ret_ref = (uint64_t)ret_copy;
17239 uint32_t __attribute__((visibility("default"))) TS_APIError_apimisuse_error(jstring err) {
17240 LDKStr err_conv = str_ref_to_owned_c(err);
17241 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17242 *ret_copy = APIError_apimisuse_error(err_conv);
17243 uint64_t ret_ref = (uint64_t)ret_copy;
17247 uint32_t __attribute__((visibility("default"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
17248 LDKStr err_conv = str_ref_to_owned_c(err);
17249 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17250 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
17251 uint64_t ret_ref = (uint64_t)ret_copy;
17255 uint32_t __attribute__((visibility("default"))) TS_APIError_route_error(jstring err) {
17256 LDKStr err_conv = str_ref_to_owned_c(err);
17257 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17258 *ret_copy = APIError_route_error(err_conv);
17259 uint64_t ret_ref = (uint64_t)ret_copy;
17263 uint32_t __attribute__((visibility("default"))) TS_APIError_channel_unavailable(jstring err) {
17264 LDKStr err_conv = str_ref_to_owned_c(err);
17265 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17266 *ret_copy = APIError_channel_unavailable(err_conv);
17267 uint64_t ret_ref = (uint64_t)ret_copy;
17271 uint32_t __attribute__((visibility("default"))) TS_APIError_monitor_update_failed() {
17272 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17273 *ret_copy = APIError_monitor_update_failed();
17274 uint64_t ret_ref = (uint64_t)ret_copy;
17278 uint32_t __attribute__((visibility("default"))) TS_APIError_incompatible_shutdown_script(uint32_t script) {
17279 LDKShutdownScript script_conv;
17280 script_conv.inner = (void*)(script & (~1));
17281 script_conv.is_owned = (script & 1) || (script == 0);
17282 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
17283 script_conv = ShutdownScript_clone(&script_conv);
17284 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17285 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
17286 uint64_t ret_ref = (uint64_t)ret_copy;
17290 uint32_t __attribute__((visibility("default"))) TS_sign(int8_tArray msg, int8_tArray sk) {
17291 LDKu8slice msg_ref;
17292 msg_ref.datalen = *((uint32_t*)msg);
17293 msg_ref.data = (int8_t*)(msg + 4);
17294 unsigned char sk_arr[32];
17295 CHECK(*((uint32_t*)sk) == 32);
17296 memcpy(sk_arr, (uint8_t*)(sk + 4), 32);
17297 unsigned char (*sk_ref)[32] = &sk_arr;
17298 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17299 *ret_conv = sign(msg_ref, sk_ref);
17300 return (uint64_t)ret_conv;
17303 uint32_t __attribute__((visibility("default"))) TS_recover_pk(int8_tArray msg, jstring sig) {
17304 LDKu8slice msg_ref;
17305 msg_ref.datalen = *((uint32_t*)msg);
17306 msg_ref.data = (int8_t*)(msg + 4);
17307 LDKStr sig_conv = str_ref_to_owned_c(sig);
17308 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17309 *ret_conv = recover_pk(msg_ref, sig_conv);
17310 return (uint64_t)ret_conv;
17313 jboolean __attribute__((visibility("default"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
17314 LDKu8slice msg_ref;
17315 msg_ref.datalen = *((uint32_t*)msg);
17316 msg_ref.data = (int8_t*)(msg + 4);
17317 LDKStr sig_conv = str_ref_to_owned_c(sig);
17318 LDKPublicKey pk_ref;
17319 CHECK(*((uint32_t*)pk) == 33);
17320 memcpy(pk_ref.compressed_form, (uint8_t*)(pk + 4), 33);
17321 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
17325 uint32_t __attribute__((visibility("default"))) TS_Level_clone(uint32_t orig) {
17326 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
17327 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
17331 uint32_t __attribute__((visibility("default"))) TS_Level_gossip() {
17332 uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
17336 uint32_t __attribute__((visibility("default"))) TS_Level_trace() {
17337 uint32_t ret_conv = LDKLevel_to_js(Level_trace());
17341 uint32_t __attribute__((visibility("default"))) TS_Level_debug() {
17342 uint32_t ret_conv = LDKLevel_to_js(Level_debug());
17346 uint32_t __attribute__((visibility("default"))) TS_Level_info() {
17347 uint32_t ret_conv = LDKLevel_to_js(Level_info());
17351 uint32_t __attribute__((visibility("default"))) TS_Level_warn() {
17352 uint32_t ret_conv = LDKLevel_to_js(Level_warn());
17356 uint32_t __attribute__((visibility("default"))) TS_Level_error() {
17357 uint32_t ret_conv = LDKLevel_to_js(Level_error());
17361 jboolean __attribute__((visibility("default"))) TS_Level_eq(uint32_t a, uint32_t b) {
17362 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
17363 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
17364 jboolean ret_val = Level_eq(a_conv, b_conv);
17368 int64_t __attribute__((visibility("default"))) TS_Level_hash(uint32_t o) {
17369 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
17370 int64_t ret_val = Level_hash(o_conv);
17374 uint32_t __attribute__((visibility("default"))) TS_Level_max() {
17375 uint32_t ret_conv = LDKLevel_to_js(Level_max());
17379 void __attribute__((visibility("default"))) TS_Record_free(uint32_t this_obj) {
17380 LDKRecord this_obj_conv;
17381 this_obj_conv.inner = (void*)(this_obj & (~1));
17382 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17383 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17384 Record_free(this_obj_conv);
17387 uint32_t __attribute__((visibility("default"))) TS_Record_get_level(uint32_t this_ptr) {
17388 LDKRecord this_ptr_conv;
17389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17390 this_ptr_conv.is_owned = false;
17391 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17392 uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
17396 void __attribute__((visibility("default"))) TS_Record_set_level(uint32_t this_ptr, uint32_t val) {
17397 LDKRecord this_ptr_conv;
17398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17399 this_ptr_conv.is_owned = false;
17400 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17401 LDKLevel val_conv = LDKLevel_from_js(val);
17402 Record_set_level(&this_ptr_conv, val_conv);
17405 jstring __attribute__((visibility("default"))) TS_Record_get_args(uint32_t this_ptr) {
17406 LDKRecord this_ptr_conv;
17407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17408 this_ptr_conv.is_owned = false;
17409 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17410 LDKStr ret_str = Record_get_args(&this_ptr_conv);
17411 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
17416 void __attribute__((visibility("default"))) TS_Record_set_args(uint32_t this_ptr, jstring val) {
17417 LDKRecord this_ptr_conv;
17418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17419 this_ptr_conv.is_owned = false;
17420 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17421 LDKStr val_conv = str_ref_to_owned_c(val);
17422 Record_set_args(&this_ptr_conv, val_conv);
17425 jstring __attribute__((visibility("default"))) TS_Record_get_module_path(uint32_t this_ptr) {
17426 LDKRecord this_ptr_conv;
17427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17428 this_ptr_conv.is_owned = false;
17429 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17430 LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
17431 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
17436 void __attribute__((visibility("default"))) TS_Record_set_module_path(uint32_t this_ptr, jstring val) {
17437 LDKRecord this_ptr_conv;
17438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17439 this_ptr_conv.is_owned = false;
17440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17441 LDKStr val_conv = str_ref_to_owned_c(val);
17442 Record_set_module_path(&this_ptr_conv, val_conv);
17445 jstring __attribute__((visibility("default"))) TS_Record_get_file(uint32_t this_ptr) {
17446 LDKRecord this_ptr_conv;
17447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17448 this_ptr_conv.is_owned = false;
17449 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17450 LDKStr ret_str = Record_get_file(&this_ptr_conv);
17451 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
17456 void __attribute__((visibility("default"))) TS_Record_set_file(uint32_t this_ptr, jstring val) {
17457 LDKRecord this_ptr_conv;
17458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17459 this_ptr_conv.is_owned = false;
17460 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17461 LDKStr val_conv = str_ref_to_owned_c(val);
17462 Record_set_file(&this_ptr_conv, val_conv);
17465 int32_t __attribute__((visibility("default"))) TS_Record_get_line(uint32_t this_ptr) {
17466 LDKRecord this_ptr_conv;
17467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17468 this_ptr_conv.is_owned = false;
17469 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17470 int32_t ret_val = Record_get_line(&this_ptr_conv);
17474 void __attribute__((visibility("default"))) TS_Record_set_line(uint32_t this_ptr, int32_t val) {
17475 LDKRecord this_ptr_conv;
17476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17477 this_ptr_conv.is_owned = false;
17478 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17479 Record_set_line(&this_ptr_conv, val);
17482 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
17483 LDKRecord ret_var = Record_clone(arg);
17484 uint64_t ret_ref = 0;
17485 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17486 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17487 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17488 ret_ref = (uint64_t)ret_var.inner;
17489 if (ret_var.is_owned) {
17494 int64_t __attribute__((visibility("default"))) TS_Record_clone_ptr(uint32_t arg) {
17495 LDKRecord arg_conv;
17496 arg_conv.inner = (void*)(arg & (~1));
17497 arg_conv.is_owned = false;
17498 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17499 int64_t ret_val = Record_clone_ptr(&arg_conv);
17503 uint32_t __attribute__((visibility("default"))) TS_Record_clone(uint32_t orig) {
17504 LDKRecord orig_conv;
17505 orig_conv.inner = (void*)(orig & (~1));
17506 orig_conv.is_owned = false;
17507 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17508 LDKRecord ret_var = Record_clone(&orig_conv);
17509 uint64_t ret_ref = 0;
17510 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17511 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17512 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17513 ret_ref = (uint64_t)ret_var.inner;
17514 if (ret_var.is_owned) {
17520 void __attribute__((visibility("default"))) TS_Logger_free(uint32_t this_ptr) {
17521 if ((this_ptr & 1) != 0) return;
17522 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17523 CHECK_ACCESS(this_ptr_ptr);
17524 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
17525 FREE((void*)this_ptr);
17526 Logger_free(this_ptr_conv);
17529 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_free(uint32_t this_obj) {
17530 LDKChannelHandshakeConfig this_obj_conv;
17531 this_obj_conv.inner = (void*)(this_obj & (~1));
17532 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17533 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17534 ChannelHandshakeConfig_free(this_obj_conv);
17537 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
17538 LDKChannelHandshakeConfig this_ptr_conv;
17539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17540 this_ptr_conv.is_owned = false;
17541 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17542 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
17546 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
17547 LDKChannelHandshakeConfig this_ptr_conv;
17548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17549 this_ptr_conv.is_owned = false;
17550 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17551 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
17554 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
17555 LDKChannelHandshakeConfig this_ptr_conv;
17556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17557 this_ptr_conv.is_owned = false;
17558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17559 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
17563 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_to_self_delay(uint32_t this_ptr, int16_t val) {
17564 LDKChannelHandshakeConfig this_ptr_conv;
17565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17566 this_ptr_conv.is_owned = false;
17567 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17568 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
17571 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
17572 LDKChannelHandshakeConfig this_ptr_conv;
17573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17574 this_ptr_conv.is_owned = false;
17575 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17576 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
17580 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
17581 LDKChannelHandshakeConfig this_ptr_conv;
17582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17583 this_ptr_conv.is_owned = false;
17584 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17585 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
17588 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_new(int32_t minimum_depth_arg, int16_t our_to_self_delay_arg, int64_t our_htlc_minimum_msat_arg) {
17589 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
17590 uint64_t ret_ref = 0;
17591 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17592 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17593 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17594 ret_ref = (uint64_t)ret_var.inner;
17595 if (ret_var.is_owned) {
17601 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
17602 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
17603 uint64_t ret_ref = 0;
17604 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17605 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17606 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17607 ret_ref = (uint64_t)ret_var.inner;
17608 if (ret_var.is_owned) {
17613 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_clone_ptr(uint32_t arg) {
17614 LDKChannelHandshakeConfig arg_conv;
17615 arg_conv.inner = (void*)(arg & (~1));
17616 arg_conv.is_owned = false;
17617 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17618 int64_t ret_val = ChannelHandshakeConfig_clone_ptr(&arg_conv);
17622 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
17623 LDKChannelHandshakeConfig orig_conv;
17624 orig_conv.inner = (void*)(orig & (~1));
17625 orig_conv.is_owned = false;
17626 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17627 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
17628 uint64_t ret_ref = 0;
17629 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17630 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17631 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17632 ret_ref = (uint64_t)ret_var.inner;
17633 if (ret_var.is_owned) {
17639 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_default() {
17640 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
17641 uint64_t ret_ref = 0;
17642 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17643 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17644 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17645 ret_ref = (uint64_t)ret_var.inner;
17646 if (ret_var.is_owned) {
17652 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_free(uint32_t this_obj) {
17653 LDKChannelHandshakeLimits this_obj_conv;
17654 this_obj_conv.inner = (void*)(this_obj & (~1));
17655 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17656 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17657 ChannelHandshakeLimits_free(this_obj_conv);
17660 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
17661 LDKChannelHandshakeLimits this_ptr_conv;
17662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17663 this_ptr_conv.is_owned = false;
17664 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17665 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
17669 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
17670 LDKChannelHandshakeLimits this_ptr_conv;
17671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17672 this_ptr_conv.is_owned = false;
17673 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17674 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
17677 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
17678 LDKChannelHandshakeLimits this_ptr_conv;
17679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17680 this_ptr_conv.is_owned = false;
17681 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17682 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
17686 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
17687 LDKChannelHandshakeLimits this_ptr_conv;
17688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17689 this_ptr_conv.is_owned = false;
17690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17691 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
17694 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
17695 LDKChannelHandshakeLimits this_ptr_conv;
17696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17697 this_ptr_conv.is_owned = false;
17698 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17699 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
17703 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
17704 LDKChannelHandshakeLimits this_ptr_conv;
17705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17706 this_ptr_conv.is_owned = false;
17707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17708 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
17711 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
17712 LDKChannelHandshakeLimits this_ptr_conv;
17713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17714 this_ptr_conv.is_owned = false;
17715 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17716 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
17720 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
17721 LDKChannelHandshakeLimits this_ptr_conv;
17722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17723 this_ptr_conv.is_owned = false;
17724 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17725 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
17728 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
17729 LDKChannelHandshakeLimits this_ptr_conv;
17730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17731 this_ptr_conv.is_owned = false;
17732 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17733 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
17737 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
17738 LDKChannelHandshakeLimits this_ptr_conv;
17739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17740 this_ptr_conv.is_owned = false;
17741 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17742 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
17745 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
17746 LDKChannelHandshakeLimits this_ptr_conv;
17747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17748 this_ptr_conv.is_owned = false;
17749 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17750 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
17754 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
17755 LDKChannelHandshakeLimits this_ptr_conv;
17756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17757 this_ptr_conv.is_owned = false;
17758 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17759 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
17762 jboolean __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
17763 LDKChannelHandshakeLimits this_ptr_conv;
17764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17765 this_ptr_conv.is_owned = false;
17766 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17767 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
17771 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
17772 LDKChannelHandshakeLimits this_ptr_conv;
17773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17774 this_ptr_conv.is_owned = false;
17775 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17776 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
17779 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
17780 LDKChannelHandshakeLimits this_ptr_conv;
17781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17782 this_ptr_conv.is_owned = false;
17783 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17784 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
17788 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_their_to_self_delay(uint32_t this_ptr, int16_t val) {
17789 LDKChannelHandshakeLimits this_ptr_conv;
17790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17791 this_ptr_conv.is_owned = false;
17792 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17793 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
17796 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_new(int64_t min_funding_satoshis_arg, int64_t max_htlc_minimum_msat_arg, int64_t min_max_htlc_value_in_flight_msat_arg, int64_t max_channel_reserve_satoshis_arg, int16_t min_max_accepted_htlcs_arg, int32_t max_minimum_depth_arg, jboolean force_announced_channel_preference_arg, int16_t their_to_self_delay_arg) {
17797 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_new(min_funding_satoshis_arg, max_htlc_minimum_msat_arg, min_max_htlc_value_in_flight_msat_arg, max_channel_reserve_satoshis_arg, min_max_accepted_htlcs_arg, max_minimum_depth_arg, force_announced_channel_preference_arg, their_to_self_delay_arg);
17798 uint64_t ret_ref = 0;
17799 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17800 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17801 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17802 ret_ref = (uint64_t)ret_var.inner;
17803 if (ret_var.is_owned) {
17809 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
17810 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
17811 uint64_t ret_ref = 0;
17812 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17813 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17814 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17815 ret_ref = (uint64_t)ret_var.inner;
17816 if (ret_var.is_owned) {
17821 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_clone_ptr(uint32_t arg) {
17822 LDKChannelHandshakeLimits arg_conv;
17823 arg_conv.inner = (void*)(arg & (~1));
17824 arg_conv.is_owned = false;
17825 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17826 int64_t ret_val = ChannelHandshakeLimits_clone_ptr(&arg_conv);
17830 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
17831 LDKChannelHandshakeLimits orig_conv;
17832 orig_conv.inner = (void*)(orig & (~1));
17833 orig_conv.is_owned = false;
17834 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17835 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
17836 uint64_t ret_ref = 0;
17837 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17838 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17839 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17840 ret_ref = (uint64_t)ret_var.inner;
17841 if (ret_var.is_owned) {
17847 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_default() {
17848 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
17849 uint64_t ret_ref = 0;
17850 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17851 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17852 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17853 ret_ref = (uint64_t)ret_var.inner;
17854 if (ret_var.is_owned) {
17860 void __attribute__((visibility("default"))) TS_ChannelConfig_free(uint32_t this_obj) {
17861 LDKChannelConfig this_obj_conv;
17862 this_obj_conv.inner = (void*)(this_obj & (~1));
17863 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17865 ChannelConfig_free(this_obj_conv);
17868 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint32_t this_ptr) {
17869 LDKChannelConfig this_ptr_conv;
17870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17871 this_ptr_conv.is_owned = false;
17872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17873 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
17877 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
17878 LDKChannelConfig this_ptr_conv;
17879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17880 this_ptr_conv.is_owned = false;
17881 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17882 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
17885 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint32_t this_ptr) {
17886 LDKChannelConfig this_ptr_conv;
17887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17888 this_ptr_conv.is_owned = false;
17889 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17890 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
17894 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_base_msat(uint32_t this_ptr, int32_t val) {
17895 LDKChannelConfig this_ptr_conv;
17896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17897 this_ptr_conv.is_owned = false;
17898 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17899 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
17902 int16_t __attribute__((visibility("default"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) {
17903 LDKChannelConfig this_ptr_conv;
17904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17905 this_ptr_conv.is_owned = false;
17906 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17907 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
17911 void __attribute__((visibility("default"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
17912 LDKChannelConfig this_ptr_conv;
17913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17914 this_ptr_conv.is_owned = false;
17915 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17916 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
17919 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
17920 LDKChannelConfig this_ptr_conv;
17921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17922 this_ptr_conv.is_owned = false;
17923 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17924 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
17928 void __attribute__((visibility("default"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
17929 LDKChannelConfig this_ptr_conv;
17930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17931 this_ptr_conv.is_owned = false;
17932 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17933 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
17936 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
17937 LDKChannelConfig this_ptr_conv;
17938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17939 this_ptr_conv.is_owned = false;
17940 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17941 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
17945 void __attribute__((visibility("default"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
17946 LDKChannelConfig this_ptr_conv;
17947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17948 this_ptr_conv.is_owned = false;
17949 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17950 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
17953 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_get_max_dust_htlc_exposure_msat(uint32_t this_ptr) {
17954 LDKChannelConfig this_ptr_conv;
17955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17956 this_ptr_conv.is_owned = false;
17957 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17958 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
17962 void __attribute__((visibility("default"))) TS_ChannelConfig_set_max_dust_htlc_exposure_msat(uint32_t this_ptr, int64_t val) {
17963 LDKChannelConfig this_ptr_conv;
17964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17965 this_ptr_conv.is_owned = false;
17966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17967 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
17970 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_get_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr) {
17971 LDKChannelConfig this_ptr_conv;
17972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17973 this_ptr_conv.is_owned = false;
17974 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17975 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
17979 void __attribute__((visibility("default"))) TS_ChannelConfig_set_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
17980 LDKChannelConfig this_ptr_conv;
17981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17982 this_ptr_conv.is_owned = false;
17983 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17984 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
17987 uint32_t __attribute__((visibility("default"))) 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) {
17988 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);
17989 uint64_t ret_ref = 0;
17990 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17991 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17992 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17993 ret_ref = (uint64_t)ret_var.inner;
17994 if (ret_var.is_owned) {
18000 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
18001 LDKChannelConfig ret_var = ChannelConfig_clone(arg);
18002 uint64_t ret_ref = 0;
18003 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18004 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18005 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18006 ret_ref = (uint64_t)ret_var.inner;
18007 if (ret_var.is_owned) {
18012 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_clone_ptr(uint32_t arg) {
18013 LDKChannelConfig arg_conv;
18014 arg_conv.inner = (void*)(arg & (~1));
18015 arg_conv.is_owned = false;
18016 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18017 int64_t ret_val = ChannelConfig_clone_ptr(&arg_conv);
18021 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_clone(uint32_t orig) {
18022 LDKChannelConfig orig_conv;
18023 orig_conv.inner = (void*)(orig & (~1));
18024 orig_conv.is_owned = false;
18025 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18026 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
18027 uint64_t ret_ref = 0;
18028 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18029 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18030 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18031 ret_ref = (uint64_t)ret_var.inner;
18032 if (ret_var.is_owned) {
18038 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_default() {
18039 LDKChannelConfig ret_var = ChannelConfig_default();
18040 uint64_t ret_ref = 0;
18041 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18042 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18043 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18044 ret_ref = (uint64_t)ret_var.inner;
18045 if (ret_var.is_owned) {
18051 int8_tArray __attribute__((visibility("default"))) TS_ChannelConfig_write(uint32_t obj) {
18052 LDKChannelConfig obj_conv;
18053 obj_conv.inner = (void*)(obj & (~1));
18054 obj_conv.is_owned = false;
18055 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
18056 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
18057 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18058 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18059 CVec_u8Z_free(ret_var);
18063 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_read(int8_tArray ser) {
18064 LDKu8slice ser_ref;
18065 ser_ref.datalen = *((uint32_t*)ser);
18066 ser_ref.data = (int8_t*)(ser + 4);
18067 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18068 *ret_conv = ChannelConfig_read(ser_ref);
18069 return (uint64_t)ret_conv;
18072 void __attribute__((visibility("default"))) TS_UserConfig_free(uint32_t this_obj) {
18073 LDKUserConfig this_obj_conv;
18074 this_obj_conv.inner = (void*)(this_obj & (~1));
18075 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18076 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18077 UserConfig_free(this_obj_conv);
18080 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
18081 LDKUserConfig this_ptr_conv;
18082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18083 this_ptr_conv.is_owned = false;
18084 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18085 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
18086 uint64_t ret_ref = 0;
18087 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18088 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18089 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18090 ret_ref = (uint64_t)ret_var.inner;
18091 if (ret_var.is_owned) {
18097 void __attribute__((visibility("default"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
18098 LDKUserConfig this_ptr_conv;
18099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18100 this_ptr_conv.is_owned = false;
18101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18102 LDKChannelHandshakeConfig val_conv;
18103 val_conv.inner = (void*)(val & (~1));
18104 val_conv.is_owned = (val & 1) || (val == 0);
18105 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
18106 val_conv = ChannelHandshakeConfig_clone(&val_conv);
18107 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
18110 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
18111 LDKUserConfig this_ptr_conv;
18112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18113 this_ptr_conv.is_owned = false;
18114 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18115 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
18116 uint64_t ret_ref = 0;
18117 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18118 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18119 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18120 ret_ref = (uint64_t)ret_var.inner;
18121 if (ret_var.is_owned) {
18127 void __attribute__((visibility("default"))) TS_UserConfig_set_peer_channel_config_limits(uint32_t this_ptr, uint32_t val) {
18128 LDKUserConfig this_ptr_conv;
18129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18130 this_ptr_conv.is_owned = false;
18131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18132 LDKChannelHandshakeLimits val_conv;
18133 val_conv.inner = (void*)(val & (~1));
18134 val_conv.is_owned = (val & 1) || (val == 0);
18135 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
18136 val_conv = ChannelHandshakeLimits_clone(&val_conv);
18137 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
18140 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
18141 LDKUserConfig this_ptr_conv;
18142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18143 this_ptr_conv.is_owned = false;
18144 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18145 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
18146 uint64_t ret_ref = 0;
18147 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18148 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18149 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18150 ret_ref = (uint64_t)ret_var.inner;
18151 if (ret_var.is_owned) {
18157 void __attribute__((visibility("default"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
18158 LDKUserConfig this_ptr_conv;
18159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18160 this_ptr_conv.is_owned = false;
18161 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18162 LDKChannelConfig val_conv;
18163 val_conv.inner = (void*)(val & (~1));
18164 val_conv.is_owned = (val & 1) || (val == 0);
18165 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
18166 val_conv = ChannelConfig_clone(&val_conv);
18167 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
18170 jboolean __attribute__((visibility("default"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint32_t this_ptr) {
18171 LDKUserConfig this_ptr_conv;
18172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18173 this_ptr_conv.is_owned = false;
18174 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18175 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
18179 void __attribute__((visibility("default"))) TS_UserConfig_set_accept_forwards_to_priv_channels(uint32_t this_ptr, jboolean val) {
18180 LDKUserConfig this_ptr_conv;
18181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18182 this_ptr_conv.is_owned = false;
18183 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18184 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
18187 jboolean __attribute__((visibility("default"))) TS_UserConfig_get_accept_inbound_channels(uint32_t this_ptr) {
18188 LDKUserConfig this_ptr_conv;
18189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18190 this_ptr_conv.is_owned = false;
18191 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18192 jboolean ret_val = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
18196 void __attribute__((visibility("default"))) TS_UserConfig_set_accept_inbound_channels(uint32_t this_ptr, jboolean val) {
18197 LDKUserConfig this_ptr_conv;
18198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18199 this_ptr_conv.is_owned = false;
18200 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18201 UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
18204 uint32_t __attribute__((visibility("default"))) 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) {
18205 LDKChannelHandshakeConfig own_channel_config_arg_conv;
18206 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
18207 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
18208 CHECK_INNER_FIELD_ACCESS_OR_NULL(own_channel_config_arg_conv);
18209 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
18210 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
18211 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
18212 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
18213 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_channel_config_limits_arg_conv);
18214 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
18215 LDKChannelConfig channel_options_arg_conv;
18216 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
18217 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
18218 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_options_arg_conv);
18219 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
18220 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);
18221 uint64_t ret_ref = 0;
18222 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18223 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18224 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18225 ret_ref = (uint64_t)ret_var.inner;
18226 if (ret_var.is_owned) {
18232 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
18233 LDKUserConfig ret_var = UserConfig_clone(arg);
18234 uint64_t ret_ref = 0;
18235 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18236 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18237 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18238 ret_ref = (uint64_t)ret_var.inner;
18239 if (ret_var.is_owned) {
18244 int64_t __attribute__((visibility("default"))) TS_UserConfig_clone_ptr(uint32_t arg) {
18245 LDKUserConfig arg_conv;
18246 arg_conv.inner = (void*)(arg & (~1));
18247 arg_conv.is_owned = false;
18248 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18249 int64_t ret_val = UserConfig_clone_ptr(&arg_conv);
18253 uint32_t __attribute__((visibility("default"))) TS_UserConfig_clone(uint32_t orig) {
18254 LDKUserConfig orig_conv;
18255 orig_conv.inner = (void*)(orig & (~1));
18256 orig_conv.is_owned = false;
18257 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18258 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
18259 uint64_t ret_ref = 0;
18260 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18261 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18262 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18263 ret_ref = (uint64_t)ret_var.inner;
18264 if (ret_var.is_owned) {
18270 uint32_t __attribute__((visibility("default"))) TS_UserConfig_default() {
18271 LDKUserConfig ret_var = UserConfig_default();
18272 uint64_t ret_ref = 0;
18273 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18274 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18275 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18276 ret_ref = (uint64_t)ret_var.inner;
18277 if (ret_var.is_owned) {
18283 void __attribute__((visibility("default"))) TS_BestBlock_free(uint32_t this_obj) {
18284 LDKBestBlock this_obj_conv;
18285 this_obj_conv.inner = (void*)(this_obj & (~1));
18286 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18287 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18288 BestBlock_free(this_obj_conv);
18291 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
18292 LDKBestBlock ret_var = BestBlock_clone(arg);
18293 uint64_t ret_ref = 0;
18294 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18295 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18296 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18297 ret_ref = (uint64_t)ret_var.inner;
18298 if (ret_var.is_owned) {
18303 int64_t __attribute__((visibility("default"))) TS_BestBlock_clone_ptr(uint32_t arg) {
18304 LDKBestBlock arg_conv;
18305 arg_conv.inner = (void*)(arg & (~1));
18306 arg_conv.is_owned = false;
18307 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18308 int64_t ret_val = BestBlock_clone_ptr(&arg_conv);
18312 uint32_t __attribute__((visibility("default"))) TS_BestBlock_clone(uint32_t orig) {
18313 LDKBestBlock orig_conv;
18314 orig_conv.inner = (void*)(orig & (~1));
18315 orig_conv.is_owned = false;
18316 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18317 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
18318 uint64_t ret_ref = 0;
18319 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18320 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18321 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18322 ret_ref = (uint64_t)ret_var.inner;
18323 if (ret_var.is_owned) {
18329 uint32_t __attribute__((visibility("default"))) TS_BestBlock_from_genesis(uint32_t network) {
18330 LDKNetwork network_conv = LDKNetwork_from_js(network);
18331 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
18332 uint64_t ret_ref = 0;
18333 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18334 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18335 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18336 ret_ref = (uint64_t)ret_var.inner;
18337 if (ret_var.is_owned) {
18343 uint32_t __attribute__((visibility("default"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
18344 LDKThirtyTwoBytes block_hash_ref;
18345 CHECK(*((uint32_t*)block_hash) == 32);
18346 memcpy(block_hash_ref.data, (uint8_t*)(block_hash + 4), 32);
18347 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
18348 uint64_t ret_ref = 0;
18349 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18350 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18351 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18352 ret_ref = (uint64_t)ret_var.inner;
18353 if (ret_var.is_owned) {
18359 int8_tArray __attribute__((visibility("default"))) TS_BestBlock_block_hash(uint32_t this_arg) {
18360 LDKBestBlock this_arg_conv;
18361 this_arg_conv.inner = (void*)(this_arg & (~1));
18362 this_arg_conv.is_owned = false;
18363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18364 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18365 memcpy((uint8_t*)(ret_arr + 4), BestBlock_block_hash(&this_arg_conv).data, 32);
18369 int32_t __attribute__((visibility("default"))) TS_BestBlock_height(uint32_t this_arg) {
18370 LDKBestBlock this_arg_conv;
18371 this_arg_conv.inner = (void*)(this_arg & (~1));
18372 this_arg_conv.is_owned = false;
18373 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18374 int32_t ret_val = BestBlock_height(&this_arg_conv);
18378 uint32_t __attribute__((visibility("default"))) TS_AccessError_clone(uint32_t orig) {
18379 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
18380 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
18384 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_chain() {
18385 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
18389 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_tx() {
18390 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
18394 void __attribute__((visibility("default"))) TS_Access_free(uint32_t this_ptr) {
18395 if ((this_ptr & 1) != 0) return;
18396 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18397 CHECK_ACCESS(this_ptr_ptr);
18398 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
18399 FREE((void*)this_ptr);
18400 Access_free(this_ptr_conv);
18403 void __attribute__((visibility("default"))) TS_Listen_free(uint32_t this_ptr) {
18404 if ((this_ptr & 1) != 0) return;
18405 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18406 CHECK_ACCESS(this_ptr_ptr);
18407 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
18408 FREE((void*)this_ptr);
18409 Listen_free(this_ptr_conv);
18412 void __attribute__((visibility("default"))) TS_Confirm_free(uint32_t this_ptr) {
18413 if ((this_ptr & 1) != 0) return;
18414 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18415 CHECK_ACCESS(this_ptr_ptr);
18416 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
18417 FREE((void*)this_ptr);
18418 Confirm_free(this_ptr_conv);
18421 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
18422 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
18423 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
18427 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_temporary_failure() {
18428 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure());
18432 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_permanent_failure() {
18433 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure());
18437 void __attribute__((visibility("default"))) TS_Watch_free(uint32_t this_ptr) {
18438 if ((this_ptr & 1) != 0) return;
18439 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18440 CHECK_ACCESS(this_ptr_ptr);
18441 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
18442 FREE((void*)this_ptr);
18443 Watch_free(this_ptr_conv);
18446 void __attribute__((visibility("default"))) TS_Filter_free(uint32_t this_ptr) {
18447 if ((this_ptr & 1) != 0) return;
18448 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18449 CHECK_ACCESS(this_ptr_ptr);
18450 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
18451 FREE((void*)this_ptr);
18452 Filter_free(this_ptr_conv);
18455 void __attribute__((visibility("default"))) TS_WatchedOutput_free(uint32_t this_obj) {
18456 LDKWatchedOutput this_obj_conv;
18457 this_obj_conv.inner = (void*)(this_obj & (~1));
18458 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18459 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18460 WatchedOutput_free(this_obj_conv);
18463 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_block_hash(uint32_t this_ptr) {
18464 LDKWatchedOutput this_ptr_conv;
18465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18466 this_ptr_conv.is_owned = false;
18467 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18468 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18469 memcpy((uint8_t*)(ret_arr + 4), WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
18473 void __attribute__((visibility("default"))) TS_WatchedOutput_set_block_hash(uint32_t this_ptr, int8_tArray val) {
18474 LDKWatchedOutput this_ptr_conv;
18475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18476 this_ptr_conv.is_owned = false;
18477 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18478 LDKThirtyTwoBytes val_ref;
18479 CHECK(*((uint32_t*)val) == 32);
18480 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18481 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
18484 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_get_outpoint(uint32_t this_ptr) {
18485 LDKWatchedOutput this_ptr_conv;
18486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18487 this_ptr_conv.is_owned = false;
18488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18489 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
18490 uint64_t ret_ref = 0;
18491 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18492 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18493 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18494 ret_ref = (uint64_t)ret_var.inner;
18495 if (ret_var.is_owned) {
18501 void __attribute__((visibility("default"))) TS_WatchedOutput_set_outpoint(uint32_t this_ptr, uint32_t val) {
18502 LDKWatchedOutput this_ptr_conv;
18503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18504 this_ptr_conv.is_owned = false;
18505 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18506 LDKOutPoint val_conv;
18507 val_conv.inner = (void*)(val & (~1));
18508 val_conv.is_owned = (val & 1) || (val == 0);
18509 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
18510 val_conv = OutPoint_clone(&val_conv);
18511 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
18514 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_script_pubkey(uint32_t this_ptr) {
18515 LDKWatchedOutput this_ptr_conv;
18516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18517 this_ptr_conv.is_owned = false;
18518 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18519 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
18520 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18521 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18525 void __attribute__((visibility("default"))) TS_WatchedOutput_set_script_pubkey(uint32_t this_ptr, int8_tArray val) {
18526 LDKWatchedOutput this_ptr_conv;
18527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18528 this_ptr_conv.is_owned = false;
18529 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18530 LDKCVec_u8Z val_ref;
18531 val_ref.datalen = *((uint32_t*)val);
18532 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
18533 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
18534 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
18537 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_new(int8_tArray block_hash_arg, uint32_t outpoint_arg, int8_tArray script_pubkey_arg) {
18538 LDKThirtyTwoBytes block_hash_arg_ref;
18539 CHECK(*((uint32_t*)block_hash_arg) == 32);
18540 memcpy(block_hash_arg_ref.data, (uint8_t*)(block_hash_arg + 4), 32);
18541 LDKOutPoint outpoint_arg_conv;
18542 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
18543 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
18544 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
18545 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
18546 LDKCVec_u8Z script_pubkey_arg_ref;
18547 script_pubkey_arg_ref.datalen = *((uint32_t*)script_pubkey_arg);
18548 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
18549 memcpy(script_pubkey_arg_ref.data, (uint8_t*)(script_pubkey_arg + 4), script_pubkey_arg_ref.datalen);
18550 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
18551 uint64_t ret_ref = 0;
18552 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18553 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18554 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18555 ret_ref = (uint64_t)ret_var.inner;
18556 if (ret_var.is_owned) {
18562 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
18563 LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
18564 uint64_t ret_ref = 0;
18565 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18566 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18567 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18568 ret_ref = (uint64_t)ret_var.inner;
18569 if (ret_var.is_owned) {
18574 int64_t __attribute__((visibility("default"))) TS_WatchedOutput_clone_ptr(uint32_t arg) {
18575 LDKWatchedOutput arg_conv;
18576 arg_conv.inner = (void*)(arg & (~1));
18577 arg_conv.is_owned = false;
18578 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18579 int64_t ret_val = WatchedOutput_clone_ptr(&arg_conv);
18583 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_clone(uint32_t orig) {
18584 LDKWatchedOutput orig_conv;
18585 orig_conv.inner = (void*)(orig & (~1));
18586 orig_conv.is_owned = false;
18587 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18588 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
18589 uint64_t ret_ref = 0;
18590 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18591 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18592 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18593 ret_ref = (uint64_t)ret_var.inner;
18594 if (ret_var.is_owned) {
18600 int64_t __attribute__((visibility("default"))) TS_WatchedOutput_hash(uint32_t o) {
18601 LDKWatchedOutput o_conv;
18602 o_conv.inner = (void*)(o & (~1));
18603 o_conv.is_owned = false;
18604 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18605 int64_t ret_val = WatchedOutput_hash(&o_conv);
18609 void __attribute__((visibility("default"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
18610 if ((this_ptr & 1) != 0) return;
18611 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18612 CHECK_ACCESS(this_ptr_ptr);
18613 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
18614 FREE((void*)this_ptr);
18615 BroadcasterInterface_free(this_ptr_conv);
18618 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_clone(uint32_t orig) {
18619 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
18620 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
18624 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_background() {
18625 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
18629 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_normal() {
18630 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
18634 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_high_priority() {
18635 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
18639 jboolean __attribute__((visibility("default"))) TS_ConfirmationTarget_eq(uint32_t a, uint32_t b) {
18640 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
18641 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
18642 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
18646 void __attribute__((visibility("default"))) TS_FeeEstimator_free(uint32_t this_ptr) {
18647 if ((this_ptr & 1) != 0) return;
18648 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18649 CHECK_ACCESS(this_ptr_ptr);
18650 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
18651 FREE((void*)this_ptr);
18652 FeeEstimator_free(this_ptr_conv);
18655 void __attribute__((visibility("default"))) TS_MonitorUpdateId_free(uint32_t this_obj) {
18656 LDKMonitorUpdateId this_obj_conv;
18657 this_obj_conv.inner = (void*)(this_obj & (~1));
18658 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18660 MonitorUpdateId_free(this_obj_conv);
18663 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
18664 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
18665 uint64_t ret_ref = 0;
18666 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18667 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18668 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18669 ret_ref = (uint64_t)ret_var.inner;
18670 if (ret_var.is_owned) {
18675 int64_t __attribute__((visibility("default"))) TS_MonitorUpdateId_clone_ptr(uint32_t arg) {
18676 LDKMonitorUpdateId arg_conv;
18677 arg_conv.inner = (void*)(arg & (~1));
18678 arg_conv.is_owned = false;
18679 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18680 int64_t ret_val = MonitorUpdateId_clone_ptr(&arg_conv);
18684 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateId_clone(uint32_t orig) {
18685 LDKMonitorUpdateId orig_conv;
18686 orig_conv.inner = (void*)(orig & (~1));
18687 orig_conv.is_owned = false;
18688 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18689 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
18690 uint64_t ret_ref = 0;
18691 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18692 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18693 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18694 ret_ref = (uint64_t)ret_var.inner;
18695 if (ret_var.is_owned) {
18701 int64_t __attribute__((visibility("default"))) TS_MonitorUpdateId_hash(uint32_t o) {
18702 LDKMonitorUpdateId o_conv;
18703 o_conv.inner = (void*)(o & (~1));
18704 o_conv.is_owned = false;
18705 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18706 int64_t ret_val = MonitorUpdateId_hash(&o_conv);
18710 jboolean __attribute__((visibility("default"))) TS_MonitorUpdateId_eq(uint32_t a, uint32_t b) {
18711 LDKMonitorUpdateId a_conv;
18712 a_conv.inner = (void*)(a & (~1));
18713 a_conv.is_owned = false;
18714 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18715 LDKMonitorUpdateId b_conv;
18716 b_conv.inner = (void*)(b & (~1));
18717 b_conv.is_owned = false;
18718 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18719 jboolean ret_val = MonitorUpdateId_eq(&a_conv, &b_conv);
18723 void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) {
18724 if ((this_ptr & 1) != 0) return;
18725 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18726 CHECK_ACCESS(this_ptr_ptr);
18727 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
18728 FREE((void*)this_ptr);
18729 Persist_free(this_ptr_conv);
18732 void __attribute__((visibility("default"))) TS_LockedChannelMonitor_free(uint32_t this_obj) {
18733 LDKLockedChannelMonitor this_obj_conv;
18734 this_obj_conv.inner = (void*)(this_obj & (~1));
18735 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18736 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18737 LockedChannelMonitor_free(this_obj_conv);
18740 void __attribute__((visibility("default"))) TS_ChainMonitor_free(uint32_t this_obj) {
18741 LDKChainMonitor this_obj_conv;
18742 this_obj_conv.inner = (void*)(this_obj & (~1));
18743 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18744 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18745 ChainMonitor_free(this_obj_conv);
18748 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_new(uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
18749 void* chain_source_ptr = (void*)(((uint64_t)chain_source) & ~1);
18750 CHECK_ACCESS(chain_source_ptr);
18751 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
18752 // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ
18753 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
18754 // Manually implement clone for Java trait instances
18756 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
18757 CHECK_ACCESS(broadcaster_ptr);
18758 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
18759 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
18760 CHECK_ACCESS(logger_ptr);
18761 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
18762 void* feeest_ptr = (void*)(((uint64_t)feeest) & ~1);
18763 CHECK_ACCESS(feeest_ptr);
18764 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
18765 void* persister_ptr = (void*)(((uint64_t)persister) & ~1);
18766 CHECK_ACCESS(persister_ptr);
18767 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
18768 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
18769 uint64_t ret_ref = 0;
18770 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18771 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18772 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18773 ret_ref = (uint64_t)ret_var.inner;
18774 if (ret_var.is_owned) {
18780 uint32_tArray __attribute__((visibility("default"))) TS_ChainMonitor_get_claimable_balances(uint32_t this_arg, uint32_tArray ignored_channels) {
18781 LDKChainMonitor this_arg_conv;
18782 this_arg_conv.inner = (void*)(this_arg & (~1));
18783 this_arg_conv.is_owned = false;
18784 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18785 LDKCVec_ChannelDetailsZ ignored_channels_constr;
18786 ignored_channels_constr.datalen = *((uint32_t*)ignored_channels);
18787 if (ignored_channels_constr.datalen > 0)
18788 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
18790 ignored_channels_constr.data = NULL;
18791 uint32_t* ignored_channels_vals = (uint32_t*)(ignored_channels + 4);
18792 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
18793 uint32_t ignored_channels_conv_16 = ignored_channels_vals[q];
18794 LDKChannelDetails ignored_channels_conv_16_conv;
18795 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
18796 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
18797 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
18798 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
18799 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
18801 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
18802 uint32_tArray ret_arr = NULL;
18803 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
18804 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
18805 for (size_t j = 0; j < ret_var.datalen; j++) {
18806 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18807 *ret_conv_9_copy = ret_var.data[j];
18808 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
18809 ret_arr_ptr[j] = ret_conv_9_ref;
18812 FREE(ret_var.data);
18816 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_get_monitor(uint32_t this_arg, uint32_t funding_txo) {
18817 LDKChainMonitor this_arg_conv;
18818 this_arg_conv.inner = (void*)(this_arg & (~1));
18819 this_arg_conv.is_owned = false;
18820 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18821 LDKOutPoint funding_txo_conv;
18822 funding_txo_conv.inner = (void*)(funding_txo & (~1));
18823 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
18824 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
18825 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
18826 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
18827 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
18828 return (uint64_t)ret_conv;
18831 uint32_tArray __attribute__((visibility("default"))) TS_ChainMonitor_list_monitors(uint32_t this_arg) {
18832 LDKChainMonitor this_arg_conv;
18833 this_arg_conv.inner = (void*)(this_arg & (~1));
18834 this_arg_conv.is_owned = false;
18835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18836 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
18837 uint32_tArray ret_arr = NULL;
18838 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
18839 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
18840 for (size_t k = 0; k < ret_var.datalen; k++) {
18841 LDKOutPoint ret_conv_10_var = ret_var.data[k];
18842 uint64_t ret_conv_10_ref = 0;
18843 CHECK((((uint64_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18844 CHECK((((uint64_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18845 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
18846 ret_conv_10_ref = (uint64_t)ret_conv_10_var.inner;
18847 if (ret_conv_10_var.is_owned) {
18848 ret_conv_10_ref |= 1;
18850 ret_arr_ptr[k] = ret_conv_10_ref;
18853 FREE(ret_var.data);
18857 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_channel_monitor_updated(uint32_t this_arg, uint32_t funding_txo, uint32_t completed_update_id) {
18858 LDKChainMonitor this_arg_conv;
18859 this_arg_conv.inner = (void*)(this_arg & (~1));
18860 this_arg_conv.is_owned = false;
18861 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18862 LDKOutPoint funding_txo_conv;
18863 funding_txo_conv.inner = (void*)(funding_txo & (~1));
18864 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
18865 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
18866 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
18867 LDKMonitorUpdateId completed_update_id_conv;
18868 completed_update_id_conv.inner = (void*)(completed_update_id & (~1));
18869 completed_update_id_conv.is_owned = (completed_update_id & 1) || (completed_update_id == 0);
18870 CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
18871 completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
18872 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18873 *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
18874 return (uint64_t)ret_conv;
18877 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Listen(uint32_t this_arg) {
18878 LDKChainMonitor this_arg_conv;
18879 this_arg_conv.inner = (void*)(this_arg & (~1));
18880 this_arg_conv.is_owned = false;
18881 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18882 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
18883 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
18884 return (uint64_t)ret_ret;
18887 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Confirm(uint32_t this_arg) {
18888 LDKChainMonitor this_arg_conv;
18889 this_arg_conv.inner = (void*)(this_arg & (~1));
18890 this_arg_conv.is_owned = false;
18891 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18892 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
18893 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
18894 return (uint64_t)ret_ret;
18897 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
18898 LDKChainMonitor this_arg_conv;
18899 this_arg_conv.inner = (void*)(this_arg & (~1));
18900 this_arg_conv.is_owned = false;
18901 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18902 LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
18903 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
18904 return (uint64_t)ret_ret;
18907 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
18908 LDKChainMonitor this_arg_conv;
18909 this_arg_conv.inner = (void*)(this_arg & (~1));
18910 this_arg_conv.is_owned = false;
18911 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18912 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
18913 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
18914 return (uint64_t)ret_ret;
18917 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
18918 LDKChannelMonitorUpdate this_obj_conv;
18919 this_obj_conv.inner = (void*)(this_obj & (~1));
18920 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18921 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18922 ChannelMonitorUpdate_free(this_obj_conv);
18925 int64_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
18926 LDKChannelMonitorUpdate this_ptr_conv;
18927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18928 this_ptr_conv.is_owned = false;
18929 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18930 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
18934 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
18935 LDKChannelMonitorUpdate this_ptr_conv;
18936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18937 this_ptr_conv.is_owned = false;
18938 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18939 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
18942 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
18943 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
18944 uint64_t ret_ref = 0;
18945 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18946 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18947 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18948 ret_ref = (uint64_t)ret_var.inner;
18949 if (ret_var.is_owned) {
18954 int64_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_clone_ptr(uint32_t arg) {
18955 LDKChannelMonitorUpdate arg_conv;
18956 arg_conv.inner = (void*)(arg & (~1));
18957 arg_conv.is_owned = false;
18958 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18959 int64_t ret_val = ChannelMonitorUpdate_clone_ptr(&arg_conv);
18963 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
18964 LDKChannelMonitorUpdate orig_conv;
18965 orig_conv.inner = (void*)(orig & (~1));
18966 orig_conv.is_owned = false;
18967 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18968 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
18969 uint64_t ret_ref = 0;
18970 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18971 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18972 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18973 ret_ref = (uint64_t)ret_var.inner;
18974 if (ret_var.is_owned) {
18980 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
18981 LDKChannelMonitorUpdate obj_conv;
18982 obj_conv.inner = (void*)(obj & (~1));
18983 obj_conv.is_owned = false;
18984 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
18985 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
18986 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18987 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18988 CVec_u8Z_free(ret_var);
18992 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
18993 LDKu8slice ser_ref;
18994 ser_ref.datalen = *((uint32_t*)ser);
18995 ser_ref.data = (int8_t*)(ser + 4);
18996 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18997 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
18998 return (uint64_t)ret_conv;
19001 void __attribute__((visibility("default"))) TS_MonitorEvent_free(uint32_t this_ptr) {
19002 if ((this_ptr & 1) != 0) return;
19003 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
19004 CHECK_ACCESS(this_ptr_ptr);
19005 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
19006 FREE((void*)this_ptr);
19007 MonitorEvent_free(this_ptr_conv);
19010 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
19011 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
19012 *ret_copy = MonitorEvent_clone(arg);
19013 uint64_t ret_ref = (uint64_t)ret_copy;
19016 int64_t __attribute__((visibility("default"))) TS_MonitorEvent_clone_ptr(uint32_t arg) {
19017 LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)arg;
19018 int64_t ret_val = MonitorEvent_clone_ptr(arg_conv);
19022 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_clone(uint32_t orig) {
19023 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
19024 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
19025 *ret_copy = MonitorEvent_clone(orig_conv);
19026 uint64_t ret_ref = (uint64_t)ret_copy;
19030 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_htlcevent(uint32_t a) {
19031 LDKHTLCUpdate a_conv;
19032 a_conv.inner = (void*)(a & (~1));
19033 a_conv.is_owned = (a & 1) || (a == 0);
19034 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19035 a_conv = HTLCUpdate_clone(&a_conv);
19036 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
19037 *ret_copy = MonitorEvent_htlcevent(a_conv);
19038 uint64_t ret_ref = (uint64_t)ret_copy;
19042 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_commitment_tx_confirmed(uint32_t a) {
19043 LDKOutPoint a_conv;
19044 a_conv.inner = (void*)(a & (~1));
19045 a_conv.is_owned = (a & 1) || (a == 0);
19046 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19047 a_conv = OutPoint_clone(&a_conv);
19048 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
19049 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
19050 uint64_t ret_ref = (uint64_t)ret_copy;
19054 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_update_completed(uint32_t funding_txo, int64_t monitor_update_id) {
19055 LDKOutPoint funding_txo_conv;
19056 funding_txo_conv.inner = (void*)(funding_txo & (~1));
19057 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
19058 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
19059 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
19060 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
19061 *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
19062 uint64_t ret_ref = (uint64_t)ret_copy;
19066 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_update_failed(uint32_t a) {
19067 LDKOutPoint a_conv;
19068 a_conv.inner = (void*)(a & (~1));
19069 a_conv.is_owned = (a & 1) || (a == 0);
19070 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19071 a_conv = OutPoint_clone(&a_conv);
19072 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
19073 *ret_copy = MonitorEvent_update_failed(a_conv);
19074 uint64_t ret_ref = (uint64_t)ret_copy;
19078 int8_tArray __attribute__((visibility("default"))) TS_MonitorEvent_write(uint32_t obj) {
19079 LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)obj;
19080 LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
19081 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19082 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19083 CVec_u8Z_free(ret_var);
19087 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_read(int8_tArray ser) {
19088 LDKu8slice ser_ref;
19089 ser_ref.datalen = *((uint32_t*)ser);
19090 ser_ref.data = (int8_t*)(ser + 4);
19091 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
19092 *ret_conv = MonitorEvent_read(ser_ref);
19093 return (uint64_t)ret_conv;
19096 void __attribute__((visibility("default"))) TS_HTLCUpdate_free(uint32_t this_obj) {
19097 LDKHTLCUpdate this_obj_conv;
19098 this_obj_conv.inner = (void*)(this_obj & (~1));
19099 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19100 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19101 HTLCUpdate_free(this_obj_conv);
19104 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
19105 LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
19106 uint64_t ret_ref = 0;
19107 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19108 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19109 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19110 ret_ref = (uint64_t)ret_var.inner;
19111 if (ret_var.is_owned) {
19116 int64_t __attribute__((visibility("default"))) TS_HTLCUpdate_clone_ptr(uint32_t arg) {
19117 LDKHTLCUpdate arg_conv;
19118 arg_conv.inner = (void*)(arg & (~1));
19119 arg_conv.is_owned = false;
19120 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
19121 int64_t ret_val = HTLCUpdate_clone_ptr(&arg_conv);
19125 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_clone(uint32_t orig) {
19126 LDKHTLCUpdate orig_conv;
19127 orig_conv.inner = (void*)(orig & (~1));
19128 orig_conv.is_owned = false;
19129 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
19130 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
19131 uint64_t ret_ref = 0;
19132 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19133 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19134 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19135 ret_ref = (uint64_t)ret_var.inner;
19136 if (ret_var.is_owned) {
19142 int8_tArray __attribute__((visibility("default"))) TS_HTLCUpdate_write(uint32_t obj) {
19143 LDKHTLCUpdate obj_conv;
19144 obj_conv.inner = (void*)(obj & (~1));
19145 obj_conv.is_owned = false;
19146 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
19147 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
19148 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19149 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19150 CVec_u8Z_free(ret_var);
19154 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_read(int8_tArray ser) {
19155 LDKu8slice ser_ref;
19156 ser_ref.datalen = *((uint32_t*)ser);
19157 ser_ref.data = (int8_t*)(ser + 4);
19158 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
19159 *ret_conv = HTLCUpdate_read(ser_ref);
19160 return (uint64_t)ret_conv;
19163 void __attribute__((visibility("default"))) TS_Balance_free(uint32_t this_ptr) {
19164 if ((this_ptr & 1) != 0) return;
19165 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
19166 CHECK_ACCESS(this_ptr_ptr);
19167 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
19168 FREE((void*)this_ptr);
19169 Balance_free(this_ptr_conv);
19172 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
19173 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19174 *ret_copy = Balance_clone(arg);
19175 uint64_t ret_ref = (uint64_t)ret_copy;
19178 int64_t __attribute__((visibility("default"))) TS_Balance_clone_ptr(uint32_t arg) {
19179 LDKBalance* arg_conv = (LDKBalance*)arg;
19180 int64_t ret_val = Balance_clone_ptr(arg_conv);
19184 uint32_t __attribute__((visibility("default"))) TS_Balance_clone(uint32_t orig) {
19185 LDKBalance* orig_conv = (LDKBalance*)orig;
19186 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19187 *ret_copy = Balance_clone(orig_conv);
19188 uint64_t ret_ref = (uint64_t)ret_copy;
19192 uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
19193 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19194 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
19195 uint64_t ret_ref = (uint64_t)ret_copy;
19199 uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
19200 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19201 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
19202 uint64_t ret_ref = (uint64_t)ret_copy;
19206 uint32_t __attribute__((visibility("default"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
19207 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19208 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
19209 uint64_t ret_ref = (uint64_t)ret_copy;
19213 uint32_t __attribute__((visibility("default"))) TS_Balance_maybe_claimable_htlcawaiting_timeout(int64_t claimable_amount_satoshis, int32_t claimable_height) {
19214 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19215 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
19216 uint64_t ret_ref = (uint64_t)ret_copy;
19220 jboolean __attribute__((visibility("default"))) TS_Balance_eq(uint32_t a, uint32_t b) {
19221 LDKBalance* a_conv = (LDKBalance*)a;
19222 LDKBalance* b_conv = (LDKBalance*)b;
19223 jboolean ret_val = Balance_eq(a_conv, b_conv);
19227 void __attribute__((visibility("default"))) TS_ChannelMonitor_free(uint32_t this_obj) {
19228 LDKChannelMonitor this_obj_conv;
19229 this_obj_conv.inner = (void*)(this_obj & (~1));
19230 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19231 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19232 ChannelMonitor_free(this_obj_conv);
19235 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
19236 LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
19237 uint64_t ret_ref = 0;
19238 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19239 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19240 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19241 ret_ref = (uint64_t)ret_var.inner;
19242 if (ret_var.is_owned) {
19247 int64_t __attribute__((visibility("default"))) TS_ChannelMonitor_clone_ptr(uint32_t arg) {
19248 LDKChannelMonitor arg_conv;
19249 arg_conv.inner = (void*)(arg & (~1));
19250 arg_conv.is_owned = false;
19251 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
19252 int64_t ret_val = ChannelMonitor_clone_ptr(&arg_conv);
19256 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_clone(uint32_t orig) {
19257 LDKChannelMonitor orig_conv;
19258 orig_conv.inner = (void*)(orig & (~1));
19259 orig_conv.is_owned = false;
19260 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
19261 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
19262 uint64_t ret_ref = 0;
19263 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19264 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19265 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19266 ret_ref = (uint64_t)ret_var.inner;
19267 if (ret_var.is_owned) {
19273 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_write(uint32_t obj) {
19274 LDKChannelMonitor obj_conv;
19275 obj_conv.inner = (void*)(obj & (~1));
19276 obj_conv.is_owned = false;
19277 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
19278 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
19279 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19280 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19281 CVec_u8Z_free(ret_var);
19285 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_update_monitor(uint32_t this_arg, uint32_t updates, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
19286 LDKChannelMonitor this_arg_conv;
19287 this_arg_conv.inner = (void*)(this_arg & (~1));
19288 this_arg_conv.is_owned = false;
19289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19290 LDKChannelMonitorUpdate updates_conv;
19291 updates_conv.inner = (void*)(updates & (~1));
19292 updates_conv.is_owned = false;
19293 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
19294 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19295 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
19296 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
19297 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19298 if (!(fee_estimator & 1)) { CHECK_ACCESS(fee_estimator_ptr); }
19299 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
19300 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19301 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
19302 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
19303 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
19304 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
19305 return (uint64_t)ret_conv;
19308 int64_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
19309 LDKChannelMonitor this_arg_conv;
19310 this_arg_conv.inner = (void*)(this_arg & (~1));
19311 this_arg_conv.is_owned = false;
19312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19313 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
19317 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
19318 LDKChannelMonitor this_arg_conv;
19319 this_arg_conv.inner = (void*)(this_arg & (~1));
19320 this_arg_conv.is_owned = false;
19321 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19322 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
19323 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
19324 return ((uint64_t)ret_conv);
19327 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_outputs_to_watch(uint32_t this_arg) {
19328 LDKChannelMonitor this_arg_conv;
19329 this_arg_conv.inner = (void*)(this_arg & (~1));
19330 this_arg_conv.is_owned = false;
19331 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19332 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
19333 uint32_tArray ret_arr = NULL;
19334 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
19335 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19336 for (size_t o = 0; o < ret_var.datalen; o++) {
19337 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
19338 *ret_conv_40_conv = ret_var.data[o];
19339 ret_arr_ptr[o] = ((uint64_t)ret_conv_40_conv);
19342 FREE(ret_var.data);
19346 void __attribute__((visibility("default"))) TS_ChannelMonitor_load_outputs_to_watch(uint32_t this_arg, uint32_t filter) {
19347 LDKChannelMonitor this_arg_conv;
19348 this_arg_conv.inner = (void*)(this_arg & (~1));
19349 this_arg_conv.is_owned = false;
19350 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19351 void* filter_ptr = (void*)(((uint64_t)filter) & ~1);
19352 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
19353 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
19354 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
19357 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_monitor_events(uint32_t this_arg) {
19358 LDKChannelMonitor this_arg_conv;
19359 this_arg_conv.inner = (void*)(this_arg & (~1));
19360 this_arg_conv.is_owned = false;
19361 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19362 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
19363 uint32_tArray ret_arr = NULL;
19364 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
19365 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19366 for (size_t o = 0; o < ret_var.datalen; o++) {
19367 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
19368 *ret_conv_14_copy = ret_var.data[o];
19369 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
19370 ret_arr_ptr[o] = ret_conv_14_ref;
19373 FREE(ret_var.data);
19377 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
19378 LDKChannelMonitor this_arg_conv;
19379 this_arg_conv.inner = (void*)(this_arg & (~1));
19380 this_arg_conv.is_owned = false;
19381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19382 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
19383 uint32_tArray ret_arr = NULL;
19384 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
19385 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19386 for (size_t h = 0; h < ret_var.datalen; h++) {
19387 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19388 *ret_conv_7_copy = ret_var.data[h];
19389 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
19390 ret_arr_ptr[h] = ret_conv_7_ref;
19393 FREE(ret_var.data);
19397 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_holder_commitment_txn(uint32_t this_arg, uint32_t logger) {
19398 LDKChannelMonitor this_arg_conv;
19399 this_arg_conv.inner = (void*)(this_arg & (~1));
19400 this_arg_conv.is_owned = false;
19401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19402 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19403 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
19404 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
19405 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
19406 ptrArray ret_arr = NULL;
19407 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
19408 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
19409 for (size_t m = 0; m < ret_var.datalen; m++) {
19410 LDKTransaction ret_conv_12_var = ret_var.data[m];
19411 int8_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19412 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_conv_12_var.data, ret_conv_12_var.datalen);
19413 Transaction_free(ret_conv_12_var);
19414 ret_arr_ptr[m] = ret_conv_12_arr;
19417 FREE(ret_var.data);
19421 uint32_tArray __attribute__((visibility("default"))) 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) {
19422 LDKChannelMonitor this_arg_conv;
19423 this_arg_conv.inner = (void*)(this_arg & (~1));
19424 this_arg_conv.is_owned = false;
19425 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19426 unsigned char header_arr[80];
19427 CHECK(*((uint32_t*)header) == 80);
19428 memcpy(header_arr, (uint8_t*)(header + 4), 80);
19429 unsigned char (*header_ref)[80] = &header_arr;
19430 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
19431 txdata_constr.datalen = *((uint32_t*)txdata);
19432 if (txdata_constr.datalen > 0)
19433 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
19435 txdata_constr.data = NULL;
19436 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
19437 for (size_t c = 0; c < txdata_constr.datalen; c++) {
19438 uint32_t txdata_conv_28 = txdata_vals[c];
19439 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
19440 CHECK_ACCESS(txdata_conv_28_ptr);
19441 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
19442 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
19443 txdata_constr.data[c] = txdata_conv_28_conv;
19445 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19446 CHECK_ACCESS(broadcaster_ptr);
19447 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19448 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19449 CHECK_ACCESS(fee_estimator_ptr);
19450 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19451 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19452 CHECK_ACCESS(logger_ptr);
19453 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19454 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);
19455 uint32_tArray ret_arr = NULL;
19456 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
19457 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19458 for (size_t n = 0; n < ret_var.datalen; n++) {
19459 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19460 *ret_conv_39_conv = ret_var.data[n];
19461 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
19464 FREE(ret_var.data);
19468 void __attribute__((visibility("default"))) TS_ChannelMonitor_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
19469 LDKChannelMonitor this_arg_conv;
19470 this_arg_conv.inner = (void*)(this_arg & (~1));
19471 this_arg_conv.is_owned = false;
19472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19473 unsigned char header_arr[80];
19474 CHECK(*((uint32_t*)header) == 80);
19475 memcpy(header_arr, (uint8_t*)(header + 4), 80);
19476 unsigned char (*header_ref)[80] = &header_arr;
19477 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19478 CHECK_ACCESS(broadcaster_ptr);
19479 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19480 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19481 CHECK_ACCESS(fee_estimator_ptr);
19482 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19483 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19484 CHECK_ACCESS(logger_ptr);
19485 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19486 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
19489 uint32_tArray __attribute__((visibility("default"))) 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) {
19490 LDKChannelMonitor this_arg_conv;
19491 this_arg_conv.inner = (void*)(this_arg & (~1));
19492 this_arg_conv.is_owned = false;
19493 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19494 unsigned char header_arr[80];
19495 CHECK(*((uint32_t*)header) == 80);
19496 memcpy(header_arr, (uint8_t*)(header + 4), 80);
19497 unsigned char (*header_ref)[80] = &header_arr;
19498 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
19499 txdata_constr.datalen = *((uint32_t*)txdata);
19500 if (txdata_constr.datalen > 0)
19501 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
19503 txdata_constr.data = NULL;
19504 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
19505 for (size_t c = 0; c < txdata_constr.datalen; c++) {
19506 uint32_t txdata_conv_28 = txdata_vals[c];
19507 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
19508 CHECK_ACCESS(txdata_conv_28_ptr);
19509 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
19510 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
19511 txdata_constr.data[c] = txdata_conv_28_conv;
19513 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19514 CHECK_ACCESS(broadcaster_ptr);
19515 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19516 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19517 CHECK_ACCESS(fee_estimator_ptr);
19518 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19519 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19520 CHECK_ACCESS(logger_ptr);
19521 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19522 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);
19523 uint32_tArray ret_arr = NULL;
19524 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
19525 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19526 for (size_t n = 0; n < ret_var.datalen; n++) {
19527 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19528 *ret_conv_39_conv = ret_var.data[n];
19529 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
19532 FREE(ret_var.data);
19536 void __attribute__((visibility("default"))) TS_ChannelMonitor_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
19537 LDKChannelMonitor this_arg_conv;
19538 this_arg_conv.inner = (void*)(this_arg & (~1));
19539 this_arg_conv.is_owned = false;
19540 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19541 unsigned char txid_arr[32];
19542 CHECK(*((uint32_t*)txid) == 32);
19543 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
19544 unsigned char (*txid_ref)[32] = &txid_arr;
19545 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19546 CHECK_ACCESS(broadcaster_ptr);
19547 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19548 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19549 CHECK_ACCESS(fee_estimator_ptr);
19550 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19551 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19552 CHECK_ACCESS(logger_ptr);
19553 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19554 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
19557 uint32_tArray __attribute__((visibility("default"))) 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) {
19558 LDKChannelMonitor this_arg_conv;
19559 this_arg_conv.inner = (void*)(this_arg & (~1));
19560 this_arg_conv.is_owned = false;
19561 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19562 unsigned char header_arr[80];
19563 CHECK(*((uint32_t*)header) == 80);
19564 memcpy(header_arr, (uint8_t*)(header + 4), 80);
19565 unsigned char (*header_ref)[80] = &header_arr;
19566 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19567 CHECK_ACCESS(broadcaster_ptr);
19568 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19569 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19570 CHECK_ACCESS(fee_estimator_ptr);
19571 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19572 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19573 CHECK_ACCESS(logger_ptr);
19574 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19575 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
19576 uint32_tArray ret_arr = NULL;
19577 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
19578 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19579 for (size_t n = 0; n < ret_var.datalen; n++) {
19580 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19581 *ret_conv_39_conv = ret_var.data[n];
19582 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
19585 FREE(ret_var.data);
19589 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_relevant_txids(uint32_t this_arg) {
19590 LDKChannelMonitor this_arg_conv;
19591 this_arg_conv.inner = (void*)(this_arg & (~1));
19592 this_arg_conv.is_owned = false;
19593 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19594 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
19595 ptrArray ret_arr = NULL;
19596 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
19597 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
19598 for (size_t m = 0; m < ret_var.datalen; m++) {
19599 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19600 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
19601 ret_arr_ptr[m] = ret_conv_12_arr;
19604 FREE(ret_var.data);
19608 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_current_best_block(uint32_t this_arg) {
19609 LDKChannelMonitor this_arg_conv;
19610 this_arg_conv.inner = (void*)(this_arg & (~1));
19611 this_arg_conv.is_owned = false;
19612 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19613 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
19614 uint64_t ret_ref = 0;
19615 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19616 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19617 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19618 ret_ref = (uint64_t)ret_var.inner;
19619 if (ret_var.is_owned) {
19625 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_claimable_balances(uint32_t this_arg) {
19626 LDKChannelMonitor this_arg_conv;
19627 this_arg_conv.inner = (void*)(this_arg & (~1));
19628 this_arg_conv.is_owned = false;
19629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19630 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
19631 uint32_tArray ret_arr = NULL;
19632 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
19633 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19634 for (size_t j = 0; j < ret_var.datalen; j++) {
19635 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19636 *ret_conv_9_copy = ret_var.data[j];
19637 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
19638 ret_arr_ptr[j] = ret_conv_9_ref;
19641 FREE(ret_var.data);
19645 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
19646 LDKu8slice ser_ref;
19647 ser_ref.datalen = *((uint32_t*)ser);
19648 ser_ref.data = (int8_t*)(ser + 4);
19649 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
19650 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
19651 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
19652 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19653 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
19654 return (uint64_t)ret_conv;
19657 void __attribute__((visibility("default"))) TS_OutPoint_free(uint32_t this_obj) {
19658 LDKOutPoint this_obj_conv;
19659 this_obj_conv.inner = (void*)(this_obj & (~1));
19660 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19661 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19662 OutPoint_free(this_obj_conv);
19665 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
19666 LDKOutPoint this_ptr_conv;
19667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19668 this_ptr_conv.is_owned = false;
19669 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19670 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19671 memcpy((uint8_t*)(ret_arr + 4), *OutPoint_get_txid(&this_ptr_conv), 32);
19675 void __attribute__((visibility("default"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
19676 LDKOutPoint this_ptr_conv;
19677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19678 this_ptr_conv.is_owned = false;
19679 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19680 LDKThirtyTwoBytes val_ref;
19681 CHECK(*((uint32_t*)val) == 32);
19682 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19683 OutPoint_set_txid(&this_ptr_conv, val_ref);
19686 int16_t __attribute__((visibility("default"))) TS_OutPoint_get_index(uint32_t this_ptr) {
19687 LDKOutPoint this_ptr_conv;
19688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19689 this_ptr_conv.is_owned = false;
19690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19691 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
19695 void __attribute__((visibility("default"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
19696 LDKOutPoint this_ptr_conv;
19697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19698 this_ptr_conv.is_owned = false;
19699 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19700 OutPoint_set_index(&this_ptr_conv, val);
19703 uint32_t __attribute__((visibility("default"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
19704 LDKThirtyTwoBytes txid_arg_ref;
19705 CHECK(*((uint32_t*)txid_arg) == 32);
19706 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
19707 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
19708 uint64_t ret_ref = 0;
19709 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19710 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19711 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19712 ret_ref = (uint64_t)ret_var.inner;
19713 if (ret_var.is_owned) {
19719 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
19720 LDKOutPoint ret_var = OutPoint_clone(arg);
19721 uint64_t ret_ref = 0;
19722 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19723 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19724 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19725 ret_ref = (uint64_t)ret_var.inner;
19726 if (ret_var.is_owned) {
19731 int64_t __attribute__((visibility("default"))) TS_OutPoint_clone_ptr(uint32_t arg) {
19732 LDKOutPoint arg_conv;
19733 arg_conv.inner = (void*)(arg & (~1));
19734 arg_conv.is_owned = false;
19735 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
19736 int64_t ret_val = OutPoint_clone_ptr(&arg_conv);
19740 uint32_t __attribute__((visibility("default"))) TS_OutPoint_clone(uint32_t orig) {
19741 LDKOutPoint orig_conv;
19742 orig_conv.inner = (void*)(orig & (~1));
19743 orig_conv.is_owned = false;
19744 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
19745 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
19746 uint64_t ret_ref = 0;
19747 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19748 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19749 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19750 ret_ref = (uint64_t)ret_var.inner;
19751 if (ret_var.is_owned) {
19757 jboolean __attribute__((visibility("default"))) TS_OutPoint_eq(uint32_t a, uint32_t b) {
19758 LDKOutPoint a_conv;
19759 a_conv.inner = (void*)(a & (~1));
19760 a_conv.is_owned = false;
19761 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19762 LDKOutPoint b_conv;
19763 b_conv.inner = (void*)(b & (~1));
19764 b_conv.is_owned = false;
19765 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19766 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
19770 int64_t __attribute__((visibility("default"))) TS_OutPoint_hash(uint32_t o) {
19771 LDKOutPoint o_conv;
19772 o_conv.inner = (void*)(o & (~1));
19773 o_conv.is_owned = false;
19774 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19775 int64_t ret_val = OutPoint_hash(&o_conv);
19779 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
19780 LDKOutPoint this_arg_conv;
19781 this_arg_conv.inner = (void*)(this_arg & (~1));
19782 this_arg_conv.is_owned = false;
19783 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19784 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19785 memcpy((uint8_t*)(ret_arr + 4), OutPoint_to_channel_id(&this_arg_conv).data, 32);
19789 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_write(uint32_t obj) {
19790 LDKOutPoint obj_conv;
19791 obj_conv.inner = (void*)(obj & (~1));
19792 obj_conv.is_owned = false;
19793 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
19794 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
19795 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19796 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19797 CVec_u8Z_free(ret_var);
19801 uint32_t __attribute__((visibility("default"))) TS_OutPoint_read(int8_tArray ser) {
19802 LDKu8slice ser_ref;
19803 ser_ref.datalen = *((uint32_t*)ser);
19804 ser_ref.data = (int8_t*)(ser + 4);
19805 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
19806 *ret_conv = OutPoint_read(ser_ref);
19807 return (uint64_t)ret_conv;
19810 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_obj) {
19811 LDKDelayedPaymentOutputDescriptor this_obj_conv;
19812 this_obj_conv.inner = (void*)(this_obj & (~1));
19813 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19814 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19815 DelayedPaymentOutputDescriptor_free(this_obj_conv);
19818 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
19819 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19821 this_ptr_conv.is_owned = false;
19822 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19823 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
19824 uint64_t ret_ref = 0;
19825 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19826 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19827 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19828 ret_ref = (uint64_t)ret_var.inner;
19829 if (ret_var.is_owned) {
19835 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
19836 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19838 this_ptr_conv.is_owned = false;
19839 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19840 LDKOutPoint val_conv;
19841 val_conv.inner = (void*)(val & (~1));
19842 val_conv.is_owned = (val & 1) || (val == 0);
19843 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
19844 val_conv = OutPoint_clone(&val_conv);
19845 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
19848 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
19849 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19851 this_ptr_conv.is_owned = false;
19852 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19853 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19854 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
19858 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
19859 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19861 this_ptr_conv.is_owned = false;
19862 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19863 LDKPublicKey val_ref;
19864 CHECK(*((uint32_t*)val) == 33);
19865 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19866 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
19869 int16_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
19870 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19872 this_ptr_conv.is_owned = false;
19873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19874 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
19878 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
19879 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19881 this_ptr_conv.is_owned = false;
19882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19883 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
19886 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
19887 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19889 this_ptr_conv.is_owned = false;
19890 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19891 void* val_ptr = (void*)(((uint64_t)val) & ~1);
19892 CHECK_ACCESS(val_ptr);
19893 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
19894 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
19895 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
19898 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
19899 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19901 this_ptr_conv.is_owned = false;
19902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19903 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19904 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
19908 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
19909 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19911 this_ptr_conv.is_owned = false;
19912 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19913 LDKPublicKey val_ref;
19914 CHECK(*((uint32_t*)val) == 33);
19915 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19916 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
19919 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
19920 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19922 this_ptr_conv.is_owned = false;
19923 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19924 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19925 memcpy((uint8_t*)(ret_arr + 4), *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
19929 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
19930 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19932 this_ptr_conv.is_owned = false;
19933 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19934 LDKThirtyTwoBytes val_ref;
19935 CHECK(*((uint32_t*)val) == 32);
19936 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19937 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
19940 int64_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
19941 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19943 this_ptr_conv.is_owned = false;
19944 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19945 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
19949 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
19950 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19952 this_ptr_conv.is_owned = false;
19953 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19954 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
19957 uint32_t __attribute__((visibility("default"))) 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) {
19958 LDKOutPoint outpoint_arg_conv;
19959 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
19960 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
19961 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
19962 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
19963 LDKPublicKey per_commitment_point_arg_ref;
19964 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
19965 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
19966 void* output_arg_ptr = (void*)(((uint64_t)output_arg) & ~1);
19967 CHECK_ACCESS(output_arg_ptr);
19968 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
19969 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
19970 LDKPublicKey revocation_pubkey_arg_ref;
19971 CHECK(*((uint32_t*)revocation_pubkey_arg) == 33);
19972 memcpy(revocation_pubkey_arg_ref.compressed_form, (uint8_t*)(revocation_pubkey_arg + 4), 33);
19973 LDKThirtyTwoBytes channel_keys_id_arg_ref;
19974 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
19975 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
19976 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);
19977 uint64_t ret_ref = 0;
19978 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19979 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19980 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19981 ret_ref = (uint64_t)ret_var.inner;
19982 if (ret_var.is_owned) {
19988 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
19989 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
19990 uint64_t ret_ref = 0;
19991 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19992 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19993 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19994 ret_ref = (uint64_t)ret_var.inner;
19995 if (ret_var.is_owned) {
20000 int64_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint32_t arg) {
20001 LDKDelayedPaymentOutputDescriptor arg_conv;
20002 arg_conv.inner = (void*)(arg & (~1));
20003 arg_conv.is_owned = false;
20004 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20005 int64_t ret_val = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
20009 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
20010 LDKDelayedPaymentOutputDescriptor orig_conv;
20011 orig_conv.inner = (void*)(orig & (~1));
20012 orig_conv.is_owned = false;
20013 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20014 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
20015 uint64_t ret_ref = 0;
20016 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20017 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20018 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20019 ret_ref = (uint64_t)ret_var.inner;
20020 if (ret_var.is_owned) {
20026 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_write(uint32_t obj) {
20027 LDKDelayedPaymentOutputDescriptor obj_conv;
20028 obj_conv.inner = (void*)(obj & (~1));
20029 obj_conv.is_owned = false;
20030 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
20031 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
20032 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20033 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20034 CVec_u8Z_free(ret_var);
20038 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
20039 LDKu8slice ser_ref;
20040 ser_ref.datalen = *((uint32_t*)ser);
20041 ser_ref.data = (int8_t*)(ser + 4);
20042 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
20043 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
20044 return (uint64_t)ret_conv;
20047 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_obj) {
20048 LDKStaticPaymentOutputDescriptor this_obj_conv;
20049 this_obj_conv.inner = (void*)(this_obj & (~1));
20050 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20051 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20052 StaticPaymentOutputDescriptor_free(this_obj_conv);
20055 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
20056 LDKStaticPaymentOutputDescriptor this_ptr_conv;
20057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20058 this_ptr_conv.is_owned = false;
20059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20060 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
20061 uint64_t ret_ref = 0;
20062 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20063 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20064 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20065 ret_ref = (uint64_t)ret_var.inner;
20066 if (ret_var.is_owned) {
20072 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
20073 LDKStaticPaymentOutputDescriptor this_ptr_conv;
20074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20075 this_ptr_conv.is_owned = false;
20076 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20077 LDKOutPoint val_conv;
20078 val_conv.inner = (void*)(val & (~1));
20079 val_conv.is_owned = (val & 1) || (val == 0);
20080 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20081 val_conv = OutPoint_clone(&val_conv);
20082 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
20085 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
20086 LDKStaticPaymentOutputDescriptor this_ptr_conv;
20087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20088 this_ptr_conv.is_owned = false;
20089 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20090 void* val_ptr = (void*)(((uint64_t)val) & ~1);
20091 CHECK_ACCESS(val_ptr);
20092 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
20093 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
20094 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
20097 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
20098 LDKStaticPaymentOutputDescriptor this_ptr_conv;
20099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20100 this_ptr_conv.is_owned = false;
20101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20102 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20103 memcpy((uint8_t*)(ret_arr + 4), *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
20107 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
20108 LDKStaticPaymentOutputDescriptor this_ptr_conv;
20109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20110 this_ptr_conv.is_owned = false;
20111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20112 LDKThirtyTwoBytes val_ref;
20113 CHECK(*((uint32_t*)val) == 32);
20114 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20115 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
20118 int64_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
20119 LDKStaticPaymentOutputDescriptor this_ptr_conv;
20120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20121 this_ptr_conv.is_owned = false;
20122 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20123 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
20127 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
20128 LDKStaticPaymentOutputDescriptor this_ptr_conv;
20129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20130 this_ptr_conv.is_owned = false;
20131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20132 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
20135 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_new(uint32_t outpoint_arg, uint32_t output_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
20136 LDKOutPoint outpoint_arg_conv;
20137 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
20138 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
20139 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
20140 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
20141 void* output_arg_ptr = (void*)(((uint64_t)output_arg) & ~1);
20142 CHECK_ACCESS(output_arg_ptr);
20143 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
20144 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
20145 LDKThirtyTwoBytes channel_keys_id_arg_ref;
20146 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
20147 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
20148 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
20149 uint64_t ret_ref = 0;
20150 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20151 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20152 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20153 ret_ref = (uint64_t)ret_var.inner;
20154 if (ret_var.is_owned) {
20160 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
20161 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
20162 uint64_t ret_ref = 0;
20163 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20164 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20165 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20166 ret_ref = (uint64_t)ret_var.inner;
20167 if (ret_var.is_owned) {
20172 int64_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint32_t arg) {
20173 LDKStaticPaymentOutputDescriptor arg_conv;
20174 arg_conv.inner = (void*)(arg & (~1));
20175 arg_conv.is_owned = false;
20176 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20177 int64_t ret_val = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
20181 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
20182 LDKStaticPaymentOutputDescriptor orig_conv;
20183 orig_conv.inner = (void*)(orig & (~1));
20184 orig_conv.is_owned = false;
20185 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20186 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
20187 uint64_t ret_ref = 0;
20188 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20189 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20190 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20191 ret_ref = (uint64_t)ret_var.inner;
20192 if (ret_var.is_owned) {
20198 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_write(uint32_t obj) {
20199 LDKStaticPaymentOutputDescriptor obj_conv;
20200 obj_conv.inner = (void*)(obj & (~1));
20201 obj_conv.is_owned = false;
20202 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
20203 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
20204 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20205 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20206 CVec_u8Z_free(ret_var);
20210 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
20211 LDKu8slice ser_ref;
20212 ser_ref.datalen = *((uint32_t*)ser);
20213 ser_ref.data = (int8_t*)(ser + 4);
20214 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
20215 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
20216 return (uint64_t)ret_conv;
20219 void __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
20220 if ((this_ptr & 1) != 0) return;
20221 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
20222 CHECK_ACCESS(this_ptr_ptr);
20223 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
20224 FREE((void*)this_ptr);
20225 SpendableOutputDescriptor_free(this_ptr_conv);
20228 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
20229 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
20230 *ret_copy = SpendableOutputDescriptor_clone(arg);
20231 uint64_t ret_ref = (uint64_t)ret_copy;
20234 int64_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_clone_ptr(uint32_t arg) {
20235 LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)arg;
20236 int64_t ret_val = SpendableOutputDescriptor_clone_ptr(arg_conv);
20240 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
20241 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
20242 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
20243 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
20244 uint64_t ret_ref = (uint64_t)ret_copy;
20248 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_output(uint32_t outpoint, uint32_t output) {
20249 LDKOutPoint outpoint_conv;
20250 outpoint_conv.inner = (void*)(outpoint & (~1));
20251 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
20252 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
20253 outpoint_conv = OutPoint_clone(&outpoint_conv);
20254 void* output_ptr = (void*)(((uint64_t)output) & ~1);
20255 CHECK_ACCESS(output_ptr);
20256 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
20257 output_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output) & ~1));
20258 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
20259 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
20260 uint64_t ret_ref = (uint64_t)ret_copy;
20264 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint32_t a) {
20265 LDKDelayedPaymentOutputDescriptor a_conv;
20266 a_conv.inner = (void*)(a & (~1));
20267 a_conv.is_owned = (a & 1) || (a == 0);
20268 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
20269 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
20270 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
20271 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
20272 uint64_t ret_ref = (uint64_t)ret_copy;
20276 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_payment_output(uint32_t a) {
20277 LDKStaticPaymentOutputDescriptor a_conv;
20278 a_conv.inner = (void*)(a & (~1));
20279 a_conv.is_owned = (a & 1) || (a == 0);
20280 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
20281 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
20282 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
20283 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
20284 uint64_t ret_ref = (uint64_t)ret_copy;
20288 int8_tArray __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
20289 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
20290 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
20291 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20292 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20293 CVec_u8Z_free(ret_var);
20297 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
20298 LDKu8slice ser_ref;
20299 ser_ref.datalen = *((uint32_t*)ser);
20300 ser_ref.data = (int8_t*)(ser + 4);
20301 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
20302 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
20303 return (uint64_t)ret_conv;
20306 void __attribute__((visibility("default"))) TS_BaseSign_free(uint32_t this_ptr) {
20307 if ((this_ptr & 1) != 0) return;
20308 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
20309 CHECK_ACCESS(this_ptr_ptr);
20310 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
20311 FREE((void*)this_ptr);
20312 BaseSign_free(this_ptr_conv);
20315 static inline uint64_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
20316 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
20317 *ret_ret = Sign_clone(arg);
20318 return (uint64_t)ret_ret;
20320 int64_t __attribute__((visibility("default"))) TS_Sign_clone_ptr(uint32_t arg) {
20321 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
20322 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
20323 LDKSign* arg_conv = (LDKSign*)arg_ptr;
20324 int64_t ret_val = Sign_clone_ptr(arg_conv);
20328 uint32_t __attribute__((visibility("default"))) TS_Sign_clone(uint32_t orig) {
20329 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
20330 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
20331 LDKSign* orig_conv = (LDKSign*)orig_ptr;
20332 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
20333 *ret_ret = Sign_clone(orig_conv);
20334 return (uint64_t)ret_ret;
20337 void __attribute__((visibility("default"))) TS_Sign_free(uint32_t this_ptr) {
20338 if ((this_ptr & 1) != 0) return;
20339 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
20340 CHECK_ACCESS(this_ptr_ptr);
20341 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
20342 FREE((void*)this_ptr);
20343 Sign_free(this_ptr_conv);
20346 void __attribute__((visibility("default"))) TS_KeysInterface_free(uint32_t this_ptr) {
20347 if ((this_ptr & 1) != 0) return;
20348 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
20349 CHECK_ACCESS(this_ptr_ptr);
20350 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
20351 FREE((void*)this_ptr);
20352 KeysInterface_free(this_ptr_conv);
20355 void __attribute__((visibility("default"))) TS_InMemorySigner_free(uint32_t this_obj) {
20356 LDKInMemorySigner this_obj_conv;
20357 this_obj_conv.inner = (void*)(this_obj & (~1));
20358 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20359 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20360 InMemorySigner_free(this_obj_conv);
20363 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
20364 LDKInMemorySigner this_ptr_conv;
20365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20366 this_ptr_conv.is_owned = false;
20367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20368 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20369 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
20373 void __attribute__((visibility("default"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
20374 LDKInMemorySigner this_ptr_conv;
20375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20376 this_ptr_conv.is_owned = false;
20377 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20378 LDKSecretKey val_ref;
20379 CHECK(*((uint32_t*)val) == 32);
20380 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
20381 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
20384 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
20385 LDKInMemorySigner this_ptr_conv;
20386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20387 this_ptr_conv.is_owned = false;
20388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20389 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20390 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
20394 void __attribute__((visibility("default"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
20395 LDKInMemorySigner this_ptr_conv;
20396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20397 this_ptr_conv.is_owned = false;
20398 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20399 LDKSecretKey val_ref;
20400 CHECK(*((uint32_t*)val) == 32);
20401 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
20402 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
20405 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
20406 LDKInMemorySigner this_ptr_conv;
20407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20408 this_ptr_conv.is_owned = false;
20409 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20410 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20411 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
20415 void __attribute__((visibility("default"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
20416 LDKInMemorySigner this_ptr_conv;
20417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20418 this_ptr_conv.is_owned = false;
20419 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20420 LDKSecretKey val_ref;
20421 CHECK(*((uint32_t*)val) == 32);
20422 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
20423 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
20426 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
20427 LDKInMemorySigner this_ptr_conv;
20428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20429 this_ptr_conv.is_owned = false;
20430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20431 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20432 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
20436 void __attribute__((visibility("default"))) TS_InMemorySigner_set_delayed_payment_base_key(uint32_t this_ptr, int8_tArray val) {
20437 LDKInMemorySigner this_ptr_conv;
20438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20439 this_ptr_conv.is_owned = false;
20440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20441 LDKSecretKey val_ref;
20442 CHECK(*((uint32_t*)val) == 32);
20443 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
20444 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
20447 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
20448 LDKInMemorySigner this_ptr_conv;
20449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20450 this_ptr_conv.is_owned = false;
20451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20452 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20453 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
20457 void __attribute__((visibility("default"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
20458 LDKInMemorySigner this_ptr_conv;
20459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20460 this_ptr_conv.is_owned = false;
20461 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20462 LDKSecretKey val_ref;
20463 CHECK(*((uint32_t*)val) == 32);
20464 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
20465 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
20468 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
20469 LDKInMemorySigner this_ptr_conv;
20470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20471 this_ptr_conv.is_owned = false;
20472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20473 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20474 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
20478 void __attribute__((visibility("default"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
20479 LDKInMemorySigner this_ptr_conv;
20480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20481 this_ptr_conv.is_owned = false;
20482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20483 LDKThirtyTwoBytes val_ref;
20484 CHECK(*((uint32_t*)val) == 32);
20485 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20486 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
20489 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
20490 LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
20491 uint64_t ret_ref = 0;
20492 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20493 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20494 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20495 ret_ref = (uint64_t)ret_var.inner;
20496 if (ret_var.is_owned) {
20501 int64_t __attribute__((visibility("default"))) TS_InMemorySigner_clone_ptr(uint32_t arg) {
20502 LDKInMemorySigner arg_conv;
20503 arg_conv.inner = (void*)(arg & (~1));
20504 arg_conv.is_owned = false;
20505 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20506 int64_t ret_val = InMemorySigner_clone_ptr(&arg_conv);
20510 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_clone(uint32_t orig) {
20511 LDKInMemorySigner orig_conv;
20512 orig_conv.inner = (void*)(orig & (~1));
20513 orig_conv.is_owned = false;
20514 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20515 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
20516 uint64_t ret_ref = 0;
20517 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20518 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20519 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20520 ret_ref = (uint64_t)ret_var.inner;
20521 if (ret_var.is_owned) {
20527 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_new(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) {
20528 LDKSecretKey funding_key_ref;
20529 CHECK(*((uint32_t*)funding_key) == 32);
20530 memcpy(funding_key_ref.bytes, (uint8_t*)(funding_key + 4), 32);
20531 LDKSecretKey revocation_base_key_ref;
20532 CHECK(*((uint32_t*)revocation_base_key) == 32);
20533 memcpy(revocation_base_key_ref.bytes, (uint8_t*)(revocation_base_key + 4), 32);
20534 LDKSecretKey payment_key_ref;
20535 CHECK(*((uint32_t*)payment_key) == 32);
20536 memcpy(payment_key_ref.bytes, (uint8_t*)(payment_key + 4), 32);
20537 LDKSecretKey delayed_payment_base_key_ref;
20538 CHECK(*((uint32_t*)delayed_payment_base_key) == 32);
20539 memcpy(delayed_payment_base_key_ref.bytes, (uint8_t*)(delayed_payment_base_key + 4), 32);
20540 LDKSecretKey htlc_base_key_ref;
20541 CHECK(*((uint32_t*)htlc_base_key) == 32);
20542 memcpy(htlc_base_key_ref.bytes, (uint8_t*)(htlc_base_key + 4), 32);
20543 LDKThirtyTwoBytes commitment_seed_ref;
20544 CHECK(*((uint32_t*)commitment_seed) == 32);
20545 memcpy(commitment_seed_ref.data, (uint8_t*)(commitment_seed + 4), 32);
20546 LDKThirtyTwoBytes channel_keys_id_ref;
20547 CHECK(*((uint32_t*)channel_keys_id) == 32);
20548 memcpy(channel_keys_id_ref.data, (uint8_t*)(channel_keys_id + 4), 32);
20549 LDKInMemorySigner ret_var = InMemorySigner_new(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);
20550 uint64_t ret_ref = 0;
20551 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20552 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20553 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20554 ret_ref = (uint64_t)ret_var.inner;
20555 if (ret_var.is_owned) {
20561 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
20562 LDKInMemorySigner this_arg_conv;
20563 this_arg_conv.inner = (void*)(this_arg & (~1));
20564 this_arg_conv.is_owned = false;
20565 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20566 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
20567 uint64_t ret_ref = 0;
20568 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20569 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20570 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20571 ret_ref = (uint64_t)ret_var.inner;
20572 if (ret_var.is_owned) {
20578 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
20579 LDKInMemorySigner this_arg_conv;
20580 this_arg_conv.inner = (void*)(this_arg & (~1));
20581 this_arg_conv.is_owned = false;
20582 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20583 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
20587 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
20588 LDKInMemorySigner this_arg_conv;
20589 this_arg_conv.inner = (void*)(this_arg & (~1));
20590 this_arg_conv.is_owned = false;
20591 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20592 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
20596 jboolean __attribute__((visibility("default"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
20597 LDKInMemorySigner this_arg_conv;
20598 this_arg_conv.inner = (void*)(this_arg & (~1));
20599 this_arg_conv.is_owned = false;
20600 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20601 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
20605 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
20606 LDKInMemorySigner this_arg_conv;
20607 this_arg_conv.inner = (void*)(this_arg & (~1));
20608 this_arg_conv.is_owned = false;
20609 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20610 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
20611 uint64_t ret_ref = 0;
20612 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20613 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20614 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20615 ret_ref = (uint64_t)ret_var.inner;
20616 if (ret_var.is_owned) {
20622 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
20623 LDKInMemorySigner this_arg_conv;
20624 this_arg_conv.inner = (void*)(this_arg & (~1));
20625 this_arg_conv.is_owned = false;
20626 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20627 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
20628 uint64_t ret_ref = 0;
20629 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20630 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20631 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20632 ret_ref = (uint64_t)ret_var.inner;
20633 if (ret_var.is_owned) {
20639 jboolean __attribute__((visibility("default"))) TS_InMemorySigner_opt_anchors(uint32_t this_arg) {
20640 LDKInMemorySigner this_arg_conv;
20641 this_arg_conv.inner = (void*)(this_arg & (~1));
20642 this_arg_conv.is_owned = false;
20643 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20644 jboolean ret_val = InMemorySigner_opt_anchors(&this_arg_conv);
20648 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_sign_counterparty_payment_input(uint32_t this_arg, int8_tArray spend_tx, int64_t input_idx, uint32_t descriptor) {
20649 LDKInMemorySigner this_arg_conv;
20650 this_arg_conv.inner = (void*)(this_arg & (~1));
20651 this_arg_conv.is_owned = false;
20652 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20653 LDKTransaction spend_tx_ref;
20654 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
20655 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
20656 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
20657 spend_tx_ref.data_is_owned = true;
20658 LDKStaticPaymentOutputDescriptor descriptor_conv;
20659 descriptor_conv.inner = (void*)(descriptor & (~1));
20660 descriptor_conv.is_owned = false;
20661 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
20662 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20663 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
20664 return (uint64_t)ret_conv;
20667 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_sign_dynamic_p2wsh_input(uint32_t this_arg, int8_tArray spend_tx, int64_t input_idx, uint32_t descriptor) {
20668 LDKInMemorySigner this_arg_conv;
20669 this_arg_conv.inner = (void*)(this_arg & (~1));
20670 this_arg_conv.is_owned = false;
20671 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20672 LDKTransaction spend_tx_ref;
20673 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
20674 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
20675 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
20676 spend_tx_ref.data_is_owned = true;
20677 LDKDelayedPaymentOutputDescriptor descriptor_conv;
20678 descriptor_conv.inner = (void*)(descriptor & (~1));
20679 descriptor_conv.is_owned = false;
20680 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
20681 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20682 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
20683 return (uint64_t)ret_conv;
20686 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_BaseSign(uint32_t this_arg) {
20687 LDKInMemorySigner this_arg_conv;
20688 this_arg_conv.inner = (void*)(this_arg & (~1));
20689 this_arg_conv.is_owned = false;
20690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20691 LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
20692 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
20693 return (uint64_t)ret_ret;
20696 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
20697 LDKInMemorySigner this_arg_conv;
20698 this_arg_conv.inner = (void*)(this_arg & (~1));
20699 this_arg_conv.is_owned = false;
20700 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20701 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
20702 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
20703 return (uint64_t)ret_ret;
20706 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_write(uint32_t obj) {
20707 LDKInMemorySigner obj_conv;
20708 obj_conv.inner = (void*)(obj & (~1));
20709 obj_conv.is_owned = false;
20710 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
20711 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
20712 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20713 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20714 CVec_u8Z_free(ret_var);
20718 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_read(int8_tArray ser) {
20719 LDKu8slice ser_ref;
20720 ser_ref.datalen = *((uint32_t*)ser);
20721 ser_ref.data = (int8_t*)(ser + 4);
20722 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20723 *ret_conv = InMemorySigner_read(ser_ref);
20724 return (uint64_t)ret_conv;
20727 void __attribute__((visibility("default"))) TS_KeysManager_free(uint32_t this_obj) {
20728 LDKKeysManager this_obj_conv;
20729 this_obj_conv.inner = (void*)(this_obj & (~1));
20730 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20731 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20732 KeysManager_free(this_obj_conv);
20735 uint32_t __attribute__((visibility("default"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
20736 unsigned char seed_arr[32];
20737 CHECK(*((uint32_t*)seed) == 32);
20738 memcpy(seed_arr, (uint8_t*)(seed + 4), 32);
20739 unsigned char (*seed_ref)[32] = &seed_arr;
20740 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
20741 uint64_t ret_ref = 0;
20742 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20743 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20744 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20745 ret_ref = (uint64_t)ret_var.inner;
20746 if (ret_var.is_owned) {
20752 uint32_t __attribute__((visibility("default"))) TS_KeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
20753 LDKKeysManager this_arg_conv;
20754 this_arg_conv.inner = (void*)(this_arg & (~1));
20755 this_arg_conv.is_owned = false;
20756 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20757 unsigned char params_arr[32];
20758 CHECK(*((uint32_t*)params) == 32);
20759 memcpy(params_arr, (uint8_t*)(params + 4), 32);
20760 unsigned char (*params_ref)[32] = ¶ms_arr;
20761 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
20762 uint64_t ret_ref = 0;
20763 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20764 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20765 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20766 ret_ref = (uint64_t)ret_var.inner;
20767 if (ret_var.is_owned) {
20773 uint32_t __attribute__((visibility("default"))) 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) {
20774 LDKKeysManager this_arg_conv;
20775 this_arg_conv.inner = (void*)(this_arg & (~1));
20776 this_arg_conv.is_owned = false;
20777 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20778 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
20779 descriptors_constr.datalen = *((uint32_t*)descriptors);
20780 if (descriptors_constr.datalen > 0)
20781 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
20783 descriptors_constr.data = NULL;
20784 uint32_t* descriptors_vals = (uint32_t*)(descriptors + 4);
20785 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
20786 uint32_t descriptors_conv_27 = descriptors_vals[b];
20787 void* descriptors_conv_27_ptr = (void*)(((uint64_t)descriptors_conv_27) & ~1);
20788 CHECK_ACCESS(descriptors_conv_27_ptr);
20789 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
20790 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
20791 descriptors_constr.data[b] = descriptors_conv_27_conv;
20793 LDKCVec_TxOutZ outputs_constr;
20794 outputs_constr.datalen = *((uint32_t*)outputs);
20795 if (outputs_constr.datalen > 0)
20796 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
20798 outputs_constr.data = NULL;
20799 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
20800 for (size_t h = 0; h < outputs_constr.datalen; h++) {
20801 uint32_t outputs_conv_7 = outputs_vals[h];
20802 void* outputs_conv_7_ptr = (void*)(((uint64_t)outputs_conv_7) & ~1);
20803 CHECK_ACCESS(outputs_conv_7_ptr);
20804 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
20805 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
20806 outputs_constr.data[h] = outputs_conv_7_conv;
20808 LDKCVec_u8Z change_destination_script_ref;
20809 change_destination_script_ref.datalen = *((uint32_t*)change_destination_script);
20810 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
20811 memcpy(change_destination_script_ref.data, (uint8_t*)(change_destination_script + 4), change_destination_script_ref.datalen);
20812 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20813 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
20814 return (uint64_t)ret_conv;
20817 uint32_t __attribute__((visibility("default"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
20818 LDKKeysManager this_arg_conv;
20819 this_arg_conv.inner = (void*)(this_arg & (~1));
20820 this_arg_conv.is_owned = false;
20821 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20822 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
20823 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
20824 return (uint64_t)ret_ret;
20827 void __attribute__((visibility("default"))) TS_ChannelManager_free(uint32_t this_obj) {
20828 LDKChannelManager this_obj_conv;
20829 this_obj_conv.inner = (void*)(this_obj & (~1));
20830 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20831 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20832 ChannelManager_free(this_obj_conv);
20835 void __attribute__((visibility("default"))) TS_ChainParameters_free(uint32_t this_obj) {
20836 LDKChainParameters this_obj_conv;
20837 this_obj_conv.inner = (void*)(this_obj & (~1));
20838 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20839 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20840 ChainParameters_free(this_obj_conv);
20843 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
20844 LDKChainParameters this_ptr_conv;
20845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20846 this_ptr_conv.is_owned = false;
20847 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20848 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
20852 void __attribute__((visibility("default"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
20853 LDKChainParameters this_ptr_conv;
20854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20855 this_ptr_conv.is_owned = false;
20856 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20857 LDKNetwork val_conv = LDKNetwork_from_js(val);
20858 ChainParameters_set_network(&this_ptr_conv, val_conv);
20861 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_best_block(uint32_t this_ptr) {
20862 LDKChainParameters this_ptr_conv;
20863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20864 this_ptr_conv.is_owned = false;
20865 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20866 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
20867 uint64_t ret_ref = 0;
20868 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20869 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20870 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20871 ret_ref = (uint64_t)ret_var.inner;
20872 if (ret_var.is_owned) {
20878 void __attribute__((visibility("default"))) TS_ChainParameters_set_best_block(uint32_t this_ptr, uint32_t val) {
20879 LDKChainParameters this_ptr_conv;
20880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20881 this_ptr_conv.is_owned = false;
20882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20883 LDKBestBlock val_conv;
20884 val_conv.inner = (void*)(val & (~1));
20885 val_conv.is_owned = (val & 1) || (val == 0);
20886 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20887 val_conv = BestBlock_clone(&val_conv);
20888 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
20891 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_new(uint32_t network_arg, uint32_t best_block_arg) {
20892 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
20893 LDKBestBlock best_block_arg_conv;
20894 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
20895 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
20896 CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
20897 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
20898 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
20899 uint64_t ret_ref = 0;
20900 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20901 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20902 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20903 ret_ref = (uint64_t)ret_var.inner;
20904 if (ret_var.is_owned) {
20910 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
20911 LDKChainParameters ret_var = ChainParameters_clone(arg);
20912 uint64_t ret_ref = 0;
20913 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20914 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20915 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20916 ret_ref = (uint64_t)ret_var.inner;
20917 if (ret_var.is_owned) {
20922 int64_t __attribute__((visibility("default"))) TS_ChainParameters_clone_ptr(uint32_t arg) {
20923 LDKChainParameters arg_conv;
20924 arg_conv.inner = (void*)(arg & (~1));
20925 arg_conv.is_owned = false;
20926 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20927 int64_t ret_val = ChainParameters_clone_ptr(&arg_conv);
20931 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_clone(uint32_t orig) {
20932 LDKChainParameters orig_conv;
20933 orig_conv.inner = (void*)(orig & (~1));
20934 orig_conv.is_owned = false;
20935 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20936 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
20937 uint64_t ret_ref = 0;
20938 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20939 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20940 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20941 ret_ref = (uint64_t)ret_var.inner;
20942 if (ret_var.is_owned) {
20948 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_free(uint32_t this_obj) {
20949 LDKCounterpartyForwardingInfo this_obj_conv;
20950 this_obj_conv.inner = (void*)(this_obj & (~1));
20951 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20952 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20953 CounterpartyForwardingInfo_free(this_obj_conv);
20956 int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint32_t this_ptr) {
20957 LDKCounterpartyForwardingInfo this_ptr_conv;
20958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20959 this_ptr_conv.is_owned = false;
20960 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20961 int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
20965 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
20966 LDKCounterpartyForwardingInfo this_ptr_conv;
20967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20968 this_ptr_conv.is_owned = false;
20969 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20970 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
20973 int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint32_t this_ptr) {
20974 LDKCounterpartyForwardingInfo this_ptr_conv;
20975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20976 this_ptr_conv.is_owned = false;
20977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20978 int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
20982 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
20983 LDKCounterpartyForwardingInfo this_ptr_conv;
20984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20985 this_ptr_conv.is_owned = false;
20986 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20987 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
20990 int16_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
20991 LDKCounterpartyForwardingInfo this_ptr_conv;
20992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20993 this_ptr_conv.is_owned = false;
20994 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20995 int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
20999 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
21000 LDKCounterpartyForwardingInfo this_ptr_conv;
21001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21002 this_ptr_conv.is_owned = false;
21003 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21004 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
21007 uint32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_new(int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg) {
21008 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
21009 uint64_t ret_ref = 0;
21010 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21011 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21012 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21013 ret_ref = (uint64_t)ret_var.inner;
21014 if (ret_var.is_owned) {
21020 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
21021 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
21022 uint64_t ret_ref = 0;
21023 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21024 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21025 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21026 ret_ref = (uint64_t)ret_var.inner;
21027 if (ret_var.is_owned) {
21032 int64_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_clone_ptr(uint32_t arg) {
21033 LDKCounterpartyForwardingInfo arg_conv;
21034 arg_conv.inner = (void*)(arg & (~1));
21035 arg_conv.is_owned = false;
21036 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21037 int64_t ret_val = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
21041 uint32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_clone(uint32_t orig) {
21042 LDKCounterpartyForwardingInfo orig_conv;
21043 orig_conv.inner = (void*)(orig & (~1));
21044 orig_conv.is_owned = false;
21045 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21046 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
21047 uint64_t ret_ref = 0;
21048 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21049 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21050 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21051 ret_ref = (uint64_t)ret_var.inner;
21052 if (ret_var.is_owned) {
21058 void __attribute__((visibility("default"))) TS_ChannelCounterparty_free(uint32_t this_obj) {
21059 LDKChannelCounterparty this_obj_conv;
21060 this_obj_conv.inner = (void*)(this_obj & (~1));
21061 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21062 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21063 ChannelCounterparty_free(this_obj_conv);
21066 int8_tArray __attribute__((visibility("default"))) TS_ChannelCounterparty_get_node_id(uint32_t this_ptr) {
21067 LDKChannelCounterparty this_ptr_conv;
21068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21069 this_ptr_conv.is_owned = false;
21070 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21071 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21072 memcpy((uint8_t*)(ret_arr + 4), ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
21076 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_node_id(uint32_t this_ptr, int8_tArray val) {
21077 LDKChannelCounterparty 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 LDKPublicKey val_ref;
21082 CHECK(*((uint32_t*)val) == 33);
21083 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21084 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
21087 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_features(uint32_t this_ptr) {
21088 LDKChannelCounterparty 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 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
21093 uint64_t ret_ref = 0;
21094 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21095 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21096 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21097 ret_ref = (uint64_t)ret_var.inner;
21098 if (ret_var.is_owned) {
21104 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_features(uint32_t this_ptr, uint32_t val) {
21105 LDKChannelCounterparty this_ptr_conv;
21106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21107 this_ptr_conv.is_owned = false;
21108 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21109 LDKInitFeatures val_conv;
21110 val_conv.inner = (void*)(val & (~1));
21111 val_conv.is_owned = (val & 1) || (val == 0);
21112 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21113 val_conv = InitFeatures_clone(&val_conv);
21114 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
21117 int64_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint32_t this_ptr) {
21118 LDKChannelCounterparty this_ptr_conv;
21119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21120 this_ptr_conv.is_owned = false;
21121 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21122 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
21126 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint32_t this_ptr, int64_t val) {
21127 LDKChannelCounterparty this_ptr_conv;
21128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21129 this_ptr_conv.is_owned = false;
21130 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21131 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
21134 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_forwarding_info(uint32_t this_ptr) {
21135 LDKChannelCounterparty this_ptr_conv;
21136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21137 this_ptr_conv.is_owned = false;
21138 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21139 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
21140 uint64_t ret_ref = 0;
21141 if ((uint64_t)ret_var.inner > 4096) {
21142 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21143 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21144 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21145 ret_ref = (uint64_t)ret_var.inner;
21146 if (ret_var.is_owned) {
21153 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_forwarding_info(uint32_t this_ptr, uint32_t val) {
21154 LDKChannelCounterparty this_ptr_conv;
21155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21156 this_ptr_conv.is_owned = false;
21157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21158 LDKCounterpartyForwardingInfo val_conv;
21159 val_conv.inner = (void*)(val & (~1));
21160 val_conv.is_owned = (val & 1) || (val == 0);
21161 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21162 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
21163 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
21166 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_new(int8_tArray node_id_arg, uint32_t features_arg, int64_t unspendable_punishment_reserve_arg, uint32_t forwarding_info_arg) {
21167 LDKPublicKey node_id_arg_ref;
21168 CHECK(*((uint32_t*)node_id_arg) == 33);
21169 memcpy(node_id_arg_ref.compressed_form, (uint8_t*)(node_id_arg + 4), 33);
21170 LDKInitFeatures features_arg_conv;
21171 features_arg_conv.inner = (void*)(features_arg & (~1));
21172 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
21173 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
21174 features_arg_conv = InitFeatures_clone(&features_arg_conv);
21175 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
21176 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
21177 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
21178 CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
21179 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
21180 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
21181 uint64_t ret_ref = 0;
21182 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21183 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21184 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21185 ret_ref = (uint64_t)ret_var.inner;
21186 if (ret_var.is_owned) {
21192 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
21193 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
21194 uint64_t ret_ref = 0;
21195 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21196 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21197 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21198 ret_ref = (uint64_t)ret_var.inner;
21199 if (ret_var.is_owned) {
21204 int64_t __attribute__((visibility("default"))) TS_ChannelCounterparty_clone_ptr(uint32_t arg) {
21205 LDKChannelCounterparty arg_conv;
21206 arg_conv.inner = (void*)(arg & (~1));
21207 arg_conv.is_owned = false;
21208 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21209 int64_t ret_val = ChannelCounterparty_clone_ptr(&arg_conv);
21213 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_clone(uint32_t orig) {
21214 LDKChannelCounterparty orig_conv;
21215 orig_conv.inner = (void*)(orig & (~1));
21216 orig_conv.is_owned = false;
21217 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21218 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
21219 uint64_t ret_ref = 0;
21220 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21221 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21222 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21223 ret_ref = (uint64_t)ret_var.inner;
21224 if (ret_var.is_owned) {
21230 void __attribute__((visibility("default"))) TS_ChannelDetails_free(uint32_t this_obj) {
21231 LDKChannelDetails this_obj_conv;
21232 this_obj_conv.inner = (void*)(this_obj & (~1));
21233 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21234 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21235 ChannelDetails_free(this_obj_conv);
21238 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
21239 LDKChannelDetails this_ptr_conv;
21240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21241 this_ptr_conv.is_owned = false;
21242 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21243 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
21244 memcpy((uint8_t*)(ret_arr + 4), *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
21248 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
21249 LDKChannelDetails this_ptr_conv;
21250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21251 this_ptr_conv.is_owned = false;
21252 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21253 LDKThirtyTwoBytes val_ref;
21254 CHECK(*((uint32_t*)val) == 32);
21255 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
21256 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
21259 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_counterparty(uint32_t this_ptr) {
21260 LDKChannelDetails 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 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
21265 uint64_t ret_ref = 0;
21266 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21267 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21268 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21269 ret_ref = (uint64_t)ret_var.inner;
21270 if (ret_var.is_owned) {
21276 void __attribute__((visibility("default"))) TS_ChannelDetails_set_counterparty(uint32_t this_ptr, uint32_t val) {
21277 LDKChannelDetails 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 LDKChannelCounterparty val_conv;
21282 val_conv.inner = (void*)(val & (~1));
21283 val_conv.is_owned = (val & 1) || (val == 0);
21284 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21285 val_conv = ChannelCounterparty_clone(&val_conv);
21286 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
21289 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_funding_txo(uint32_t this_ptr) {
21290 LDKChannelDetails this_ptr_conv;
21291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21292 this_ptr_conv.is_owned = false;
21293 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21294 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
21295 uint64_t ret_ref = 0;
21296 if ((uint64_t)ret_var.inner > 4096) {
21297 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21298 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21299 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21300 ret_ref = (uint64_t)ret_var.inner;
21301 if (ret_var.is_owned) {
21308 void __attribute__((visibility("default"))) TS_ChannelDetails_set_funding_txo(uint32_t this_ptr, uint32_t val) {
21309 LDKChannelDetails this_ptr_conv;
21310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21311 this_ptr_conv.is_owned = false;
21312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21313 LDKOutPoint val_conv;
21314 val_conv.inner = (void*)(val & (~1));
21315 val_conv.is_owned = (val & 1) || (val == 0);
21316 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21317 val_conv = OutPoint_clone(&val_conv);
21318 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
21321 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_short_channel_id(uint32_t this_ptr) {
21322 LDKChannelDetails this_ptr_conv;
21323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21324 this_ptr_conv.is_owned = false;
21325 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21326 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
21327 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
21328 uint64_t ret_ref = (uint64_t)ret_copy;
21332 void __attribute__((visibility("default"))) TS_ChannelDetails_set_short_channel_id(uint32_t this_ptr, uint32_t val) {
21333 LDKChannelDetails this_ptr_conv;
21334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21335 this_ptr_conv.is_owned = false;
21336 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21337 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21338 CHECK_ACCESS(val_ptr);
21339 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
21340 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
21341 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
21344 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
21345 LDKChannelDetails this_ptr_conv;
21346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21347 this_ptr_conv.is_owned = false;
21348 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21349 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
21353 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
21354 LDKChannelDetails this_ptr_conv;
21355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21356 this_ptr_conv.is_owned = false;
21357 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21358 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
21361 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint32_t this_ptr) {
21362 LDKChannelDetails this_ptr_conv;
21363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21364 this_ptr_conv.is_owned = false;
21365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21366 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
21367 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
21368 uint64_t ret_ref = (uint64_t)ret_copy;
21372 void __attribute__((visibility("default"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint32_t this_ptr, uint32_t val) {
21373 LDKChannelDetails this_ptr_conv;
21374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21375 this_ptr_conv.is_owned = false;
21376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21377 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21378 CHECK_ACCESS(val_ptr);
21379 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
21380 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
21381 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
21384 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_user_channel_id(uint32_t this_ptr) {
21385 LDKChannelDetails this_ptr_conv;
21386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21387 this_ptr_conv.is_owned = false;
21388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21389 int64_t ret_val = ChannelDetails_get_user_channel_id(&this_ptr_conv);
21393 void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_channel_id(uint32_t this_ptr, int64_t val) {
21394 LDKChannelDetails this_ptr_conv;
21395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21396 this_ptr_conv.is_owned = false;
21397 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21398 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
21401 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_balance_msat(uint32_t this_ptr) {
21402 LDKChannelDetails this_ptr_conv;
21403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21404 this_ptr_conv.is_owned = false;
21405 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21406 int64_t ret_val = ChannelDetails_get_balance_msat(&this_ptr_conv);
21410 void __attribute__((visibility("default"))) TS_ChannelDetails_set_balance_msat(uint32_t this_ptr, int64_t val) {
21411 LDKChannelDetails this_ptr_conv;
21412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21413 this_ptr_conv.is_owned = false;
21414 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21415 ChannelDetails_set_balance_msat(&this_ptr_conv, val);
21418 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
21419 LDKChannelDetails this_ptr_conv;
21420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21421 this_ptr_conv.is_owned = false;
21422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21423 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
21427 void __attribute__((visibility("default"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
21428 LDKChannelDetails this_ptr_conv;
21429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21430 this_ptr_conv.is_owned = false;
21431 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21432 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
21435 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
21436 LDKChannelDetails this_ptr_conv;
21437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21438 this_ptr_conv.is_owned = false;
21439 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21440 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
21444 void __attribute__((visibility("default"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
21445 LDKChannelDetails this_ptr_conv;
21446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21447 this_ptr_conv.is_owned = false;
21448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21449 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
21452 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_confirmations_required(uint32_t this_ptr) {
21453 LDKChannelDetails this_ptr_conv;
21454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21455 this_ptr_conv.is_owned = false;
21456 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21457 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21458 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
21459 uint64_t ret_ref = (uint64_t)ret_copy;
21463 void __attribute__((visibility("default"))) TS_ChannelDetails_set_confirmations_required(uint32_t this_ptr, uint32_t val) {
21464 LDKChannelDetails this_ptr_conv;
21465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21466 this_ptr_conv.is_owned = false;
21467 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21468 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21469 CHECK_ACCESS(val_ptr);
21470 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
21471 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
21472 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
21475 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_force_close_spend_delay(uint32_t this_ptr) {
21476 LDKChannelDetails this_ptr_conv;
21477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21478 this_ptr_conv.is_owned = false;
21479 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21480 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
21481 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
21482 uint64_t ret_ref = (uint64_t)ret_copy;
21486 void __attribute__((visibility("default"))) TS_ChannelDetails_set_force_close_spend_delay(uint32_t this_ptr, uint32_t val) {
21487 LDKChannelDetails this_ptr_conv;
21488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21489 this_ptr_conv.is_owned = false;
21490 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21491 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21492 CHECK_ACCESS(val_ptr);
21493 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
21494 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)val) & ~1));
21495 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
21498 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_outbound(uint32_t this_ptr) {
21499 LDKChannelDetails this_ptr_conv;
21500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21501 this_ptr_conv.is_owned = false;
21502 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21503 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
21507 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_outbound(uint32_t this_ptr, jboolean val) {
21508 LDKChannelDetails this_ptr_conv;
21509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21510 this_ptr_conv.is_owned = false;
21511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21512 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
21515 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_funding_locked(uint32_t this_ptr) {
21516 LDKChannelDetails this_ptr_conv;
21517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21518 this_ptr_conv.is_owned = false;
21519 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21520 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
21524 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_funding_locked(uint32_t this_ptr, jboolean val) {
21525 LDKChannelDetails this_ptr_conv;
21526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21527 this_ptr_conv.is_owned = false;
21528 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21529 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
21532 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_usable(uint32_t this_ptr) {
21533 LDKChannelDetails this_ptr_conv;
21534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21535 this_ptr_conv.is_owned = false;
21536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21537 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
21541 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_usable(uint32_t this_ptr, jboolean val) {
21542 LDKChannelDetails this_ptr_conv;
21543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21544 this_ptr_conv.is_owned = false;
21545 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21546 ChannelDetails_set_is_usable(&this_ptr_conv, val);
21549 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_public(uint32_t this_ptr) {
21550 LDKChannelDetails this_ptr_conv;
21551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21552 this_ptr_conv.is_owned = false;
21553 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21554 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
21558 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_public(uint32_t this_ptr, jboolean val) {
21559 LDKChannelDetails this_ptr_conv;
21560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21561 this_ptr_conv.is_owned = false;
21562 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21563 ChannelDetails_set_is_public(&this_ptr_conv, val);
21566 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_new(int8_tArray channel_id_arg, uint32_t counterparty_arg, uint32_t funding_txo_arg, uint32_t short_channel_id_arg, int64_t channel_value_satoshis_arg, uint32_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, uint32_t confirmations_required_arg, uint32_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) {
21567 LDKThirtyTwoBytes channel_id_arg_ref;
21568 CHECK(*((uint32_t*)channel_id_arg) == 32);
21569 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
21570 LDKChannelCounterparty counterparty_arg_conv;
21571 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
21572 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
21573 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
21574 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
21575 LDKOutPoint funding_txo_arg_conv;
21576 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
21577 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
21578 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
21579 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
21580 void* short_channel_id_arg_ptr = (void*)(((uint64_t)short_channel_id_arg) & ~1);
21581 CHECK_ACCESS(short_channel_id_arg_ptr);
21582 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
21583 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1));
21584 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
21585 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
21586 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
21587 void* confirmations_required_arg_ptr = (void*)(((uint64_t)confirmations_required_arg) & ~1);
21588 CHECK_ACCESS(confirmations_required_arg_ptr);
21589 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
21590 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1));
21591 void* force_close_spend_delay_arg_ptr = (void*)(((uint64_t)force_close_spend_delay_arg) & ~1);
21592 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
21593 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
21594 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1));
21595 LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg, balance_msat_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg);
21596 uint64_t ret_ref = 0;
21597 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21598 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21599 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21600 ret_ref = (uint64_t)ret_var.inner;
21601 if (ret_var.is_owned) {
21607 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
21608 LDKChannelDetails ret_var = ChannelDetails_clone(arg);
21609 uint64_t ret_ref = 0;
21610 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21611 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21612 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21613 ret_ref = (uint64_t)ret_var.inner;
21614 if (ret_var.is_owned) {
21619 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_clone_ptr(uint32_t arg) {
21620 LDKChannelDetails arg_conv;
21621 arg_conv.inner = (void*)(arg & (~1));
21622 arg_conv.is_owned = false;
21623 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21624 int64_t ret_val = ChannelDetails_clone_ptr(&arg_conv);
21628 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_clone(uint32_t orig) {
21629 LDKChannelDetails orig_conv;
21630 orig_conv.inner = (void*)(orig & (~1));
21631 orig_conv.is_owned = false;
21632 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21633 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
21634 uint64_t ret_ref = 0;
21635 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21636 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21637 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21638 ret_ref = (uint64_t)ret_var.inner;
21639 if (ret_var.is_owned) {
21645 void __attribute__((visibility("default"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
21646 if ((this_ptr & 1) != 0) return;
21647 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
21648 CHECK_ACCESS(this_ptr_ptr);
21649 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
21650 FREE((void*)this_ptr);
21651 PaymentSendFailure_free(this_ptr_conv);
21654 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
21655 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21656 *ret_copy = PaymentSendFailure_clone(arg);
21657 uint64_t ret_ref = (uint64_t)ret_copy;
21660 int64_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone_ptr(uint32_t arg) {
21661 LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)arg;
21662 int64_t ret_val = PaymentSendFailure_clone_ptr(arg_conv);
21666 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone(uint32_t orig) {
21667 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
21668 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21669 *ret_copy = PaymentSendFailure_clone(orig_conv);
21670 uint64_t ret_ref = (uint64_t)ret_copy;
21674 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_parameter_error(uint32_t a) {
21675 void* a_ptr = (void*)(((uint64_t)a) & ~1);
21676 CHECK_ACCESS(a_ptr);
21677 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
21678 a_conv = APIError_clone((LDKAPIError*)(((uint64_t)a) & ~1));
21679 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21680 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
21681 uint64_t ret_ref = (uint64_t)ret_copy;
21685 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_path_parameter_error(uint32_tArray a) {
21686 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
21687 a_constr.datalen = *((uint32_t*)a);
21688 if (a_constr.datalen > 0)
21689 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
21691 a_constr.data = NULL;
21692 uint32_t* a_vals = (uint32_t*)(a + 4);
21693 for (size_t w = 0; w < a_constr.datalen; w++) {
21694 uint32_t a_conv_22 = a_vals[w];
21695 void* a_conv_22_ptr = (void*)(((uint64_t)a_conv_22) & ~1);
21696 CHECK_ACCESS(a_conv_22_ptr);
21697 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
21698 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
21699 a_constr.data[w] = a_conv_22_conv;
21701 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21702 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
21703 uint64_t ret_ref = (uint64_t)ret_copy;
21707 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_all_failed_retry_safe(uint32_tArray a) {
21708 LDKCVec_APIErrorZ a_constr;
21709 a_constr.datalen = *((uint32_t*)a);
21710 if (a_constr.datalen > 0)
21711 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
21713 a_constr.data = NULL;
21714 uint32_t* a_vals = (uint32_t*)(a + 4);
21715 for (size_t k = 0; k < a_constr.datalen; k++) {
21716 uint32_t a_conv_10 = a_vals[k];
21717 void* a_conv_10_ptr = (void*)(((uint64_t)a_conv_10) & ~1);
21718 CHECK_ACCESS(a_conv_10_ptr);
21719 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
21720 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uint64_t)a_conv_10) & ~1));
21721 a_constr.data[k] = a_conv_10_conv;
21723 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21724 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
21725 uint64_t ret_ref = (uint64_t)ret_copy;
21729 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_partial_failure(uint32_tArray results, uint32_t failed_paths_retry, int8_tArray payment_id) {
21730 LDKCVec_CResult_NoneAPIErrorZZ results_constr;
21731 results_constr.datalen = *((uint32_t*)results);
21732 if (results_constr.datalen > 0)
21733 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
21735 results_constr.data = NULL;
21736 uint32_t* results_vals = (uint32_t*)(results + 4);
21737 for (size_t w = 0; w < results_constr.datalen; w++) {
21738 uint32_t results_conv_22 = results_vals[w];
21739 void* results_conv_22_ptr = (void*)(((uint64_t)results_conv_22) & ~1);
21740 CHECK_ACCESS(results_conv_22_ptr);
21741 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
21742 results_constr.data[w] = results_conv_22_conv;
21744 LDKRouteParameters failed_paths_retry_conv;
21745 failed_paths_retry_conv.inner = (void*)(failed_paths_retry & (~1));
21746 failed_paths_retry_conv.is_owned = (failed_paths_retry & 1) || (failed_paths_retry == 0);
21747 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
21748 failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
21749 LDKThirtyTwoBytes payment_id_ref;
21750 CHECK(*((uint32_t*)payment_id) == 32);
21751 memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32);
21752 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21753 *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
21754 uint64_t ret_ref = (uint64_t)ret_copy;
21758 uint32_t __attribute__((visibility("default"))) 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) {
21759 void* fee_est_ptr = (void*)(((uint64_t)fee_est) & ~1);
21760 CHECK_ACCESS(fee_est_ptr);
21761 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
21762 void* chain_monitor_ptr = (void*)(((uint64_t)chain_monitor) & ~1);
21763 CHECK_ACCESS(chain_monitor_ptr);
21764 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
21765 void* tx_broadcaster_ptr = (void*)(((uint64_t)tx_broadcaster) & ~1);
21766 CHECK_ACCESS(tx_broadcaster_ptr);
21767 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
21768 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
21769 CHECK_ACCESS(logger_ptr);
21770 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
21771 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
21772 CHECK_ACCESS(keys_manager_ptr);
21773 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
21774 LDKUserConfig config_conv;
21775 config_conv.inner = (void*)(config & (~1));
21776 config_conv.is_owned = (config & 1) || (config == 0);
21777 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
21778 config_conv = UserConfig_clone(&config_conv);
21779 LDKChainParameters params_conv;
21780 params_conv.inner = (void*)(params & (~1));
21781 params_conv.is_owned = (params & 1) || (params == 0);
21782 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
21783 params_conv = ChainParameters_clone(¶ms_conv);
21784 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
21785 uint64_t ret_ref = 0;
21786 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21787 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21788 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21789 ret_ref = (uint64_t)ret_var.inner;
21790 if (ret_var.is_owned) {
21796 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_get_current_default_configuration(uint32_t this_arg) {
21797 LDKChannelManager this_arg_conv;
21798 this_arg_conv.inner = (void*)(this_arg & (~1));
21799 this_arg_conv.is_owned = false;
21800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21801 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
21802 uint64_t ret_ref = 0;
21803 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21804 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21805 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21806 ret_ref = (uint64_t)ret_var.inner;
21807 if (ret_var.is_owned) {
21813 uint32_t __attribute__((visibility("default"))) 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) {
21814 LDKChannelManager this_arg_conv;
21815 this_arg_conv.inner = (void*)(this_arg & (~1));
21816 this_arg_conv.is_owned = false;
21817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21818 LDKPublicKey their_network_key_ref;
21819 CHECK(*((uint32_t*)their_network_key) == 33);
21820 memcpy(their_network_key_ref.compressed_form, (uint8_t*)(their_network_key + 4), 33);
21821 LDKUserConfig override_config_conv;
21822 override_config_conv.inner = (void*)(override_config & (~1));
21823 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
21824 CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
21825 override_config_conv = UserConfig_clone(&override_config_conv);
21826 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
21827 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
21828 return (uint64_t)ret_conv;
21831 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
21832 LDKChannelManager this_arg_conv;
21833 this_arg_conv.inner = (void*)(this_arg & (~1));
21834 this_arg_conv.is_owned = false;
21835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21836 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
21837 uint32_tArray ret_arr = NULL;
21838 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
21839 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
21840 for (size_t q = 0; q < ret_var.datalen; q++) {
21841 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
21842 uint64_t ret_conv_16_ref = 0;
21843 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21844 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21845 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
21846 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
21847 if (ret_conv_16_var.is_owned) {
21848 ret_conv_16_ref |= 1;
21850 ret_arr_ptr[q] = ret_conv_16_ref;
21853 FREE(ret_var.data);
21857 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
21858 LDKChannelManager this_arg_conv;
21859 this_arg_conv.inner = (void*)(this_arg & (~1));
21860 this_arg_conv.is_owned = false;
21861 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21862 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
21863 uint32_tArray ret_arr = NULL;
21864 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
21865 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
21866 for (size_t q = 0; q < ret_var.datalen; q++) {
21867 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
21868 uint64_t ret_conv_16_ref = 0;
21869 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21870 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21871 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
21872 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
21873 if (ret_conv_16_var.is_owned) {
21874 ret_conv_16_ref |= 1;
21876 ret_arr_ptr[q] = ret_conv_16_ref;
21879 FREE(ret_var.data);
21883 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id) {
21884 LDKChannelManager this_arg_conv;
21885 this_arg_conv.inner = (void*)(this_arg & (~1));
21886 this_arg_conv.is_owned = false;
21887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21888 unsigned char channel_id_arr[32];
21889 CHECK(*((uint32_t*)channel_id) == 32);
21890 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
21891 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
21892 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21893 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
21894 return (uint64_t)ret_conv;
21897 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel_with_target_feerate(uint32_t this_arg, int8_tArray channel_id, int32_t target_feerate_sats_per_1000_weight) {
21898 LDKChannelManager this_arg_conv;
21899 this_arg_conv.inner = (void*)(this_arg & (~1));
21900 this_arg_conv.is_owned = false;
21901 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21902 unsigned char channel_id_arr[32];
21903 CHECK(*((uint32_t*)channel_id) == 32);
21904 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
21905 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
21906 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21907 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
21908 return (uint64_t)ret_conv;
21911 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
21912 LDKChannelManager this_arg_conv;
21913 this_arg_conv.inner = (void*)(this_arg & (~1));
21914 this_arg_conv.is_owned = false;
21915 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21916 unsigned char channel_id_arr[32];
21917 CHECK(*((uint32_t*)channel_id) == 32);
21918 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
21919 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
21920 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21921 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
21922 return (uint64_t)ret_conv;
21925 void __attribute__((visibility("default"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
21926 LDKChannelManager this_arg_conv;
21927 this_arg_conv.inner = (void*)(this_arg & (~1));
21928 this_arg_conv.is_owned = false;
21929 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21930 ChannelManager_force_close_all_channels(&this_arg_conv);
21933 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
21934 LDKChannelManager this_arg_conv;
21935 this_arg_conv.inner = (void*)(this_arg & (~1));
21936 this_arg_conv.is_owned = false;
21937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21938 LDKRoute route_conv;
21939 route_conv.inner = (void*)(route & (~1));
21940 route_conv.is_owned = false;
21941 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
21942 LDKThirtyTwoBytes payment_hash_ref;
21943 CHECK(*((uint32_t*)payment_hash) == 32);
21944 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
21945 LDKThirtyTwoBytes payment_secret_ref;
21946 CHECK(*((uint32_t*)payment_secret) == 32);
21947 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
21948 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
21949 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
21950 return (uint64_t)ret_conv;
21953 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_retry_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_id) {
21954 LDKChannelManager this_arg_conv;
21955 this_arg_conv.inner = (void*)(this_arg & (~1));
21956 this_arg_conv.is_owned = false;
21957 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21958 LDKRoute route_conv;
21959 route_conv.inner = (void*)(route & (~1));
21960 route_conv.is_owned = false;
21961 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
21962 LDKThirtyTwoBytes payment_id_ref;
21963 CHECK(*((uint32_t*)payment_id) == 32);
21964 memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32);
21965 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
21966 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
21967 return (uint64_t)ret_conv;
21970 void __attribute__((visibility("default"))) TS_ChannelManager_abandon_payment(uint32_t this_arg, int8_tArray payment_id) {
21971 LDKChannelManager this_arg_conv;
21972 this_arg_conv.inner = (void*)(this_arg & (~1));
21973 this_arg_conv.is_owned = false;
21974 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21975 LDKThirtyTwoBytes payment_id_ref;
21976 CHECK(*((uint32_t*)payment_id) == 32);
21977 memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32);
21978 ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
21981 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_spontaneous_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_preimage) {
21982 LDKChannelManager this_arg_conv;
21983 this_arg_conv.inner = (void*)(this_arg & (~1));
21984 this_arg_conv.is_owned = false;
21985 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21986 LDKRoute route_conv;
21987 route_conv.inner = (void*)(route & (~1));
21988 route_conv.is_owned = false;
21989 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
21990 LDKThirtyTwoBytes payment_preimage_ref;
21991 CHECK(*((uint32_t*)payment_preimage) == 32);
21992 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
21993 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
21994 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
21995 return (uint64_t)ret_conv;
21998 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_funding_transaction_generated(uint32_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
21999 LDKChannelManager this_arg_conv;
22000 this_arg_conv.inner = (void*)(this_arg & (~1));
22001 this_arg_conv.is_owned = false;
22002 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22003 unsigned char temporary_channel_id_arr[32];
22004 CHECK(*((uint32_t*)temporary_channel_id) == 32);
22005 memcpy(temporary_channel_id_arr, (uint8_t*)(temporary_channel_id + 4), 32);
22006 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
22007 LDKTransaction funding_transaction_ref;
22008 funding_transaction_ref.datalen = *((uint32_t*)funding_transaction);
22009 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
22010 memcpy(funding_transaction_ref.data, (uint8_t*)(funding_transaction + 4), funding_transaction_ref.datalen);
22011 funding_transaction_ref.data_is_owned = true;
22012 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
22013 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
22014 return (uint64_t)ret_conv;
22017 void __attribute__((visibility("default"))) TS_ChannelManager_broadcast_node_announcement(uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
22018 LDKChannelManager this_arg_conv;
22019 this_arg_conv.inner = (void*)(this_arg & (~1));
22020 this_arg_conv.is_owned = false;
22021 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22022 LDKThreeBytes rgb_ref;
22023 CHECK(*((uint32_t*)rgb) == 3);
22024 memcpy(rgb_ref.data, (uint8_t*)(rgb + 4), 3);
22025 LDKThirtyTwoBytes alias_ref;
22026 CHECK(*((uint32_t*)alias) == 32);
22027 memcpy(alias_ref.data, (uint8_t*)(alias + 4), 32);
22028 LDKCVec_NetAddressZ addresses_constr;
22029 addresses_constr.datalen = *((uint32_t*)addresses);
22030 if (addresses_constr.datalen > 0)
22031 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
22033 addresses_constr.data = NULL;
22034 uint32_t* addresses_vals = (uint32_t*)(addresses + 4);
22035 for (size_t m = 0; m < addresses_constr.datalen; m++) {
22036 uint32_t addresses_conv_12 = addresses_vals[m];
22037 void* addresses_conv_12_ptr = (void*)(((uint64_t)addresses_conv_12) & ~1);
22038 CHECK_ACCESS(addresses_conv_12_ptr);
22039 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
22040 addresses_constr.data[m] = addresses_conv_12_conv;
22042 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
22045 void __attribute__((visibility("default"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
22046 LDKChannelManager this_arg_conv;
22047 this_arg_conv.inner = (void*)(this_arg & (~1));
22048 this_arg_conv.is_owned = false;
22049 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22050 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
22053 void __attribute__((visibility("default"))) TS_ChannelManager_timer_tick_occurred(uint32_t this_arg) {
22054 LDKChannelManager this_arg_conv;
22055 this_arg_conv.inner = (void*)(this_arg & (~1));
22056 this_arg_conv.is_owned = false;
22057 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22058 ChannelManager_timer_tick_occurred(&this_arg_conv);
22061 jboolean __attribute__((visibility("default"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash) {
22062 LDKChannelManager this_arg_conv;
22063 this_arg_conv.inner = (void*)(this_arg & (~1));
22064 this_arg_conv.is_owned = false;
22065 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22066 unsigned char payment_hash_arr[32];
22067 CHECK(*((uint32_t*)payment_hash) == 32);
22068 memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32);
22069 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
22070 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
22074 jboolean __attribute__((visibility("default"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage) {
22075 LDKChannelManager this_arg_conv;
22076 this_arg_conv.inner = (void*)(this_arg & (~1));
22077 this_arg_conv.is_owned = false;
22078 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22079 LDKThirtyTwoBytes payment_preimage_ref;
22080 CHECK(*((uint32_t*)payment_preimage) == 32);
22081 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
22082 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
22086 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
22087 LDKChannelManager this_arg_conv;
22088 this_arg_conv.inner = (void*)(this_arg & (~1));
22089 this_arg_conv.is_owned = false;
22090 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22091 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22092 memcpy((uint8_t*)(ret_arr + 4), ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
22096 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_inbound_payment(uint32_t this_arg, uint32_t min_value_msat, int32_t invoice_expiry_delta_secs) {
22097 LDKChannelManager this_arg_conv;
22098 this_arg_conv.inner = (void*)(this_arg & (~1));
22099 this_arg_conv.is_owned = false;
22100 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22101 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
22102 CHECK_ACCESS(min_value_msat_ptr);
22103 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
22104 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
22105 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
22106 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
22107 return (uint64_t)ret_conv;
22110 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_inbound_payment_legacy(uint32_t this_arg, uint32_t min_value_msat, int32_t invoice_expiry_delta_secs) {
22111 LDKChannelManager this_arg_conv;
22112 this_arg_conv.inner = (void*)(this_arg & (~1));
22113 this_arg_conv.is_owned = false;
22114 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22115 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
22116 CHECK_ACCESS(min_value_msat_ptr);
22117 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
22118 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
22119 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
22120 *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
22121 return (uint64_t)ret_conv;
22124 uint32_t __attribute__((visibility("default"))) 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) {
22125 LDKChannelManager this_arg_conv;
22126 this_arg_conv.inner = (void*)(this_arg & (~1));
22127 this_arg_conv.is_owned = false;
22128 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22129 LDKThirtyTwoBytes payment_hash_ref;
22130 CHECK(*((uint32_t*)payment_hash) == 32);
22131 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
22132 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
22133 CHECK_ACCESS(min_value_msat_ptr);
22134 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
22135 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
22136 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
22137 *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
22138 return (uint64_t)ret_conv;
22141 uint32_t __attribute__((visibility("default"))) 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) {
22142 LDKChannelManager this_arg_conv;
22143 this_arg_conv.inner = (void*)(this_arg & (~1));
22144 this_arg_conv.is_owned = false;
22145 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22146 LDKThirtyTwoBytes payment_hash_ref;
22147 CHECK(*((uint32_t*)payment_hash) == 32);
22148 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
22149 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
22150 CHECK_ACCESS(min_value_msat_ptr);
22151 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
22152 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
22153 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
22154 *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
22155 return (uint64_t)ret_conv;
22158 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_get_payment_preimage(uint32_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
22159 LDKChannelManager this_arg_conv;
22160 this_arg_conv.inner = (void*)(this_arg & (~1));
22161 this_arg_conv.is_owned = false;
22162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22163 LDKThirtyTwoBytes payment_hash_ref;
22164 CHECK(*((uint32_t*)payment_hash) == 32);
22165 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
22166 LDKThirtyTwoBytes payment_secret_ref;
22167 CHECK(*((uint32_t*)payment_secret) == 32);
22168 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
22169 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
22170 *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
22171 return (uint64_t)ret_conv;
22174 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
22175 LDKChannelManager this_arg_conv;
22176 this_arg_conv.inner = (void*)(this_arg & (~1));
22177 this_arg_conv.is_owned = false;
22178 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22179 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
22180 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
22181 return (uint64_t)ret_ret;
22184 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
22185 LDKChannelManager this_arg_conv;
22186 this_arg_conv.inner = (void*)(this_arg & (~1));
22187 this_arg_conv.is_owned = false;
22188 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22189 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
22190 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
22191 return (uint64_t)ret_ret;
22194 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
22195 LDKChannelManager this_arg_conv;
22196 this_arg_conv.inner = (void*)(this_arg & (~1));
22197 this_arg_conv.is_owned = false;
22198 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22199 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
22200 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
22201 return (uint64_t)ret_ret;
22204 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Confirm(uint32_t this_arg) {
22205 LDKChannelManager this_arg_conv;
22206 this_arg_conv.inner = (void*)(this_arg & (~1));
22207 this_arg_conv.is_owned = false;
22208 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22209 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
22210 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
22211 return (uint64_t)ret_ret;
22214 jboolean __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update_timeout(uint32_t this_arg, int64_t max_wait) {
22215 LDKChannelManager this_arg_conv;
22216 this_arg_conv.inner = (void*)(this_arg & (~1));
22217 this_arg_conv.is_owned = false;
22218 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22219 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
22223 void __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
22224 LDKChannelManager this_arg_conv;
22225 this_arg_conv.inner = (void*)(this_arg & (~1));
22226 this_arg_conv.is_owned = false;
22227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22228 ChannelManager_await_persistable_update(&this_arg_conv);
22231 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_current_best_block(uint32_t this_arg) {
22232 LDKChannelManager this_arg_conv;
22233 this_arg_conv.inner = (void*)(this_arg & (~1));
22234 this_arg_conv.is_owned = false;
22235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22236 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
22237 uint64_t ret_ref = 0;
22238 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22239 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22240 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22241 ret_ref = (uint64_t)ret_var.inner;
22242 if (ret_var.is_owned) {
22248 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
22249 LDKChannelManager this_arg_conv;
22250 this_arg_conv.inner = (void*)(this_arg & (~1));
22251 this_arg_conv.is_owned = false;
22252 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22253 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
22254 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
22255 return (uint64_t)ret_ret;
22258 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_write(uint32_t obj) {
22259 LDKChannelManager obj_conv;
22260 obj_conv.inner = (void*)(obj & (~1));
22261 obj_conv.is_owned = false;
22262 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22263 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
22264 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22265 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22266 CVec_u8Z_free(ret_var);
22270 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
22271 LDKChannelManagerReadArgs this_obj_conv;
22272 this_obj_conv.inner = (void*)(this_obj & (~1));
22273 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22274 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22275 ChannelManagerReadArgs_free(this_obj_conv);
22278 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
22279 LDKChannelManagerReadArgs this_ptr_conv;
22280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22281 this_ptr_conv.is_owned = false;
22282 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22283 // WARNING: This object doesn't live past this scope, needs clone!
22284 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv)) | 1;
22288 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
22289 LDKChannelManagerReadArgs this_ptr_conv;
22290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22291 this_ptr_conv.is_owned = false;
22292 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22293 void* val_ptr = (void*)(((uint64_t)val) & ~1);
22294 CHECK_ACCESS(val_ptr);
22295 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
22296 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
22299 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
22300 LDKChannelManagerReadArgs this_ptr_conv;
22301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22302 this_ptr_conv.is_owned = false;
22303 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22304 // WARNING: This object doesn't live past this scope, needs clone!
22305 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv)) | 1;
22309 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
22310 LDKChannelManagerReadArgs this_ptr_conv;
22311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22312 this_ptr_conv.is_owned = false;
22313 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22314 void* val_ptr = (void*)(((uint64_t)val) & ~1);
22315 CHECK_ACCESS(val_ptr);
22316 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
22317 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
22320 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
22321 LDKChannelManagerReadArgs this_ptr_conv;
22322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22323 this_ptr_conv.is_owned = false;
22324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22325 // WARNING: This object doesn't live past this scope, needs clone!
22326 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv)) | 1;
22330 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
22331 LDKChannelManagerReadArgs this_ptr_conv;
22332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22333 this_ptr_conv.is_owned = false;
22334 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22335 void* val_ptr = (void*)(((uint64_t)val) & ~1);
22336 CHECK_ACCESS(val_ptr);
22337 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
22338 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
22341 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
22342 LDKChannelManagerReadArgs this_ptr_conv;
22343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22344 this_ptr_conv.is_owned = false;
22345 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22346 // WARNING: This object doesn't live past this scope, needs clone!
22347 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv)) | 1;
22351 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
22352 LDKChannelManagerReadArgs this_ptr_conv;
22353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22354 this_ptr_conv.is_owned = false;
22355 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22356 void* val_ptr = (void*)(((uint64_t)val) & ~1);
22357 CHECK_ACCESS(val_ptr);
22358 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
22359 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
22362 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
22363 LDKChannelManagerReadArgs this_ptr_conv;
22364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22365 this_ptr_conv.is_owned = false;
22366 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22367 // WARNING: This object doesn't live past this scope, needs clone!
22368 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv)) | 1;
22372 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
22373 LDKChannelManagerReadArgs this_ptr_conv;
22374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22375 this_ptr_conv.is_owned = false;
22376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22377 void* val_ptr = (void*)(((uint64_t)val) & ~1);
22378 CHECK_ACCESS(val_ptr);
22379 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
22380 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
22383 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
22384 LDKChannelManagerReadArgs this_ptr_conv;
22385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22386 this_ptr_conv.is_owned = false;
22387 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22388 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
22389 uint64_t ret_ref = 0;
22390 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22391 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22392 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22393 ret_ref = (uint64_t)ret_var.inner;
22394 if (ret_var.is_owned) {
22400 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
22401 LDKChannelManagerReadArgs this_ptr_conv;
22402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22403 this_ptr_conv.is_owned = false;
22404 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22405 LDKUserConfig val_conv;
22406 val_conv.inner = (void*)(val & (~1));
22407 val_conv.is_owned = (val & 1) || (val == 0);
22408 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
22409 val_conv = UserConfig_clone(&val_conv);
22410 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
22413 uint32_t __attribute__((visibility("default"))) 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) {
22414 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
22415 CHECK_ACCESS(keys_manager_ptr);
22416 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
22417 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
22418 CHECK_ACCESS(fee_estimator_ptr);
22419 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
22420 void* chain_monitor_ptr = (void*)(((uint64_t)chain_monitor) & ~1);
22421 CHECK_ACCESS(chain_monitor_ptr);
22422 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
22423 void* tx_broadcaster_ptr = (void*)(((uint64_t)tx_broadcaster) & ~1);
22424 CHECK_ACCESS(tx_broadcaster_ptr);
22425 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
22426 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
22427 CHECK_ACCESS(logger_ptr);
22428 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22429 LDKUserConfig default_config_conv;
22430 default_config_conv.inner = (void*)(default_config & (~1));
22431 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
22432 CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
22433 default_config_conv = UserConfig_clone(&default_config_conv);
22434 LDKCVec_ChannelMonitorZ channel_monitors_constr;
22435 channel_monitors_constr.datalen = *((uint32_t*)channel_monitors);
22436 if (channel_monitors_constr.datalen > 0)
22437 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
22439 channel_monitors_constr.data = NULL;
22440 uint32_t* channel_monitors_vals = (uint32_t*)(channel_monitors + 4);
22441 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
22442 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
22443 LDKChannelMonitor channel_monitors_conv_16_conv;
22444 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
22445 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
22446 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
22447 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
22449 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);
22450 uint64_t ret_ref = 0;
22451 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22452 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22453 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22454 ret_ref = (uint64_t)ret_var.inner;
22455 if (ret_var.is_owned) {
22461 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
22462 LDKu8slice ser_ref;
22463 ser_ref.datalen = *((uint32_t*)ser);
22464 ser_ref.data = (int8_t*)(ser + 4);
22465 LDKChannelManagerReadArgs arg_conv;
22466 arg_conv.inner = (void*)(arg & (~1));
22467 arg_conv.is_owned = (arg & 1) || (arg == 0);
22468 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22469 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
22470 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
22471 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
22472 return (uint64_t)ret_conv;
22475 void __attribute__((visibility("default"))) TS_DecodeError_free(uint32_t this_obj) {
22476 LDKDecodeError this_obj_conv;
22477 this_obj_conv.inner = (void*)(this_obj & (~1));
22478 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22479 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22480 DecodeError_free(this_obj_conv);
22483 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
22484 LDKDecodeError ret_var = DecodeError_clone(arg);
22485 uint64_t ret_ref = 0;
22486 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22487 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22488 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22489 ret_ref = (uint64_t)ret_var.inner;
22490 if (ret_var.is_owned) {
22495 int64_t __attribute__((visibility("default"))) TS_DecodeError_clone_ptr(uint32_t arg) {
22496 LDKDecodeError arg_conv;
22497 arg_conv.inner = (void*)(arg & (~1));
22498 arg_conv.is_owned = false;
22499 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22500 int64_t ret_val = DecodeError_clone_ptr(&arg_conv);
22504 uint32_t __attribute__((visibility("default"))) TS_DecodeError_clone(uint32_t orig) {
22505 LDKDecodeError orig_conv;
22506 orig_conv.inner = (void*)(orig & (~1));
22507 orig_conv.is_owned = false;
22508 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22509 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
22510 uint64_t ret_ref = 0;
22511 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22512 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22513 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22514 ret_ref = (uint64_t)ret_var.inner;
22515 if (ret_var.is_owned) {
22521 void __attribute__((visibility("default"))) TS_Init_free(uint32_t this_obj) {
22522 LDKInit this_obj_conv;
22523 this_obj_conv.inner = (void*)(this_obj & (~1));
22524 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22525 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22526 Init_free(this_obj_conv);
22529 uint32_t __attribute__((visibility("default"))) TS_Init_get_features(uint32_t this_ptr) {
22530 LDKInit this_ptr_conv;
22531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22532 this_ptr_conv.is_owned = false;
22533 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22534 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
22535 uint64_t ret_ref = 0;
22536 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22537 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22538 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22539 ret_ref = (uint64_t)ret_var.inner;
22540 if (ret_var.is_owned) {
22546 void __attribute__((visibility("default"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
22547 LDKInit this_ptr_conv;
22548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22549 this_ptr_conv.is_owned = false;
22550 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22551 LDKInitFeatures val_conv;
22552 val_conv.inner = (void*)(val & (~1));
22553 val_conv.is_owned = (val & 1) || (val == 0);
22554 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
22555 val_conv = InitFeatures_clone(&val_conv);
22556 Init_set_features(&this_ptr_conv, val_conv);
22559 uint32_t __attribute__((visibility("default"))) TS_Init_new(uint32_t features_arg) {
22560 LDKInitFeatures features_arg_conv;
22561 features_arg_conv.inner = (void*)(features_arg & (~1));
22562 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
22563 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
22564 features_arg_conv = InitFeatures_clone(&features_arg_conv);
22565 LDKInit ret_var = Init_new(features_arg_conv);
22566 uint64_t ret_ref = 0;
22567 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22568 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22569 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22570 ret_ref = (uint64_t)ret_var.inner;
22571 if (ret_var.is_owned) {
22577 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
22578 LDKInit ret_var = Init_clone(arg);
22579 uint64_t ret_ref = 0;
22580 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22581 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22582 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22583 ret_ref = (uint64_t)ret_var.inner;
22584 if (ret_var.is_owned) {
22589 int64_t __attribute__((visibility("default"))) TS_Init_clone_ptr(uint32_t arg) {
22591 arg_conv.inner = (void*)(arg & (~1));
22592 arg_conv.is_owned = false;
22593 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22594 int64_t ret_val = Init_clone_ptr(&arg_conv);
22598 uint32_t __attribute__((visibility("default"))) TS_Init_clone(uint32_t orig) {
22600 orig_conv.inner = (void*)(orig & (~1));
22601 orig_conv.is_owned = false;
22602 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22603 LDKInit ret_var = Init_clone(&orig_conv);
22604 uint64_t ret_ref = 0;
22605 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22606 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22607 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22608 ret_ref = (uint64_t)ret_var.inner;
22609 if (ret_var.is_owned) {
22615 void __attribute__((visibility("default"))) TS_ErrorMessage_free(uint32_t this_obj) {
22616 LDKErrorMessage this_obj_conv;
22617 this_obj_conv.inner = (void*)(this_obj & (~1));
22618 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22619 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22620 ErrorMessage_free(this_obj_conv);
22623 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
22624 LDKErrorMessage this_ptr_conv;
22625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22626 this_ptr_conv.is_owned = false;
22627 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22628 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22629 memcpy((uint8_t*)(ret_arr + 4), *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
22633 void __attribute__((visibility("default"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
22634 LDKErrorMessage this_ptr_conv;
22635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22636 this_ptr_conv.is_owned = false;
22637 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22638 LDKThirtyTwoBytes val_ref;
22639 CHECK(*((uint32_t*)val) == 32);
22640 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
22641 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
22644 jstring __attribute__((visibility("default"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
22645 LDKErrorMessage this_ptr_conv;
22646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22647 this_ptr_conv.is_owned = false;
22648 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22649 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
22650 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
22655 void __attribute__((visibility("default"))) TS_ErrorMessage_set_data(uint32_t this_ptr, jstring val) {
22656 LDKErrorMessage this_ptr_conv;
22657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22658 this_ptr_conv.is_owned = false;
22659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22660 LDKStr val_conv = str_ref_to_owned_c(val);
22661 ErrorMessage_set_data(&this_ptr_conv, val_conv);
22664 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
22665 LDKThirtyTwoBytes channel_id_arg_ref;
22666 CHECK(*((uint32_t*)channel_id_arg) == 32);
22667 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
22668 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
22669 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
22670 uint64_t ret_ref = 0;
22671 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22672 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22673 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22674 ret_ref = (uint64_t)ret_var.inner;
22675 if (ret_var.is_owned) {
22681 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
22682 LDKErrorMessage ret_var = ErrorMessage_clone(arg);
22683 uint64_t ret_ref = 0;
22684 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22685 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22686 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22687 ret_ref = (uint64_t)ret_var.inner;
22688 if (ret_var.is_owned) {
22693 int64_t __attribute__((visibility("default"))) TS_ErrorMessage_clone_ptr(uint32_t arg) {
22694 LDKErrorMessage arg_conv;
22695 arg_conv.inner = (void*)(arg & (~1));
22696 arg_conv.is_owned = false;
22697 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22698 int64_t ret_val = ErrorMessage_clone_ptr(&arg_conv);
22702 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_clone(uint32_t orig) {
22703 LDKErrorMessage orig_conv;
22704 orig_conv.inner = (void*)(orig & (~1));
22705 orig_conv.is_owned = false;
22706 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22707 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
22708 uint64_t ret_ref = 0;
22709 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22710 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22711 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22712 ret_ref = (uint64_t)ret_var.inner;
22713 if (ret_var.is_owned) {
22719 void __attribute__((visibility("default"))) TS_Ping_free(uint32_t this_obj) {
22720 LDKPing this_obj_conv;
22721 this_obj_conv.inner = (void*)(this_obj & (~1));
22722 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22723 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22724 Ping_free(this_obj_conv);
22727 int16_t __attribute__((visibility("default"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
22728 LDKPing this_ptr_conv;
22729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22730 this_ptr_conv.is_owned = false;
22731 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22732 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
22736 void __attribute__((visibility("default"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
22737 LDKPing this_ptr_conv;
22738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22739 this_ptr_conv.is_owned = false;
22740 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22741 Ping_set_ponglen(&this_ptr_conv, val);
22744 int16_t __attribute__((visibility("default"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
22745 LDKPing this_ptr_conv;
22746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22747 this_ptr_conv.is_owned = false;
22748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22749 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
22753 void __attribute__((visibility("default"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
22754 LDKPing this_ptr_conv;
22755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22756 this_ptr_conv.is_owned = false;
22757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22758 Ping_set_byteslen(&this_ptr_conv, val);
22761 uint32_t __attribute__((visibility("default"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
22762 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
22763 uint64_t ret_ref = 0;
22764 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22765 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22766 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22767 ret_ref = (uint64_t)ret_var.inner;
22768 if (ret_var.is_owned) {
22774 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
22775 LDKPing ret_var = Ping_clone(arg);
22776 uint64_t ret_ref = 0;
22777 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22778 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22779 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22780 ret_ref = (uint64_t)ret_var.inner;
22781 if (ret_var.is_owned) {
22786 int64_t __attribute__((visibility("default"))) TS_Ping_clone_ptr(uint32_t arg) {
22788 arg_conv.inner = (void*)(arg & (~1));
22789 arg_conv.is_owned = false;
22790 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22791 int64_t ret_val = Ping_clone_ptr(&arg_conv);
22795 uint32_t __attribute__((visibility("default"))) TS_Ping_clone(uint32_t orig) {
22797 orig_conv.inner = (void*)(orig & (~1));
22798 orig_conv.is_owned = false;
22799 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22800 LDKPing ret_var = Ping_clone(&orig_conv);
22801 uint64_t ret_ref = 0;
22802 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22803 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22804 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22805 ret_ref = (uint64_t)ret_var.inner;
22806 if (ret_var.is_owned) {
22812 void __attribute__((visibility("default"))) TS_Pong_free(uint32_t this_obj) {
22813 LDKPong this_obj_conv;
22814 this_obj_conv.inner = (void*)(this_obj & (~1));
22815 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22816 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22817 Pong_free(this_obj_conv);
22820 int16_t __attribute__((visibility("default"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
22821 LDKPong this_ptr_conv;
22822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22823 this_ptr_conv.is_owned = false;
22824 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22825 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
22829 void __attribute__((visibility("default"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
22830 LDKPong this_ptr_conv;
22831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22832 this_ptr_conv.is_owned = false;
22833 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22834 Pong_set_byteslen(&this_ptr_conv, val);
22837 uint32_t __attribute__((visibility("default"))) TS_Pong_new(int16_t byteslen_arg) {
22838 LDKPong ret_var = Pong_new(byteslen_arg);
22839 uint64_t ret_ref = 0;
22840 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22841 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22842 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22843 ret_ref = (uint64_t)ret_var.inner;
22844 if (ret_var.is_owned) {
22850 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
22851 LDKPong ret_var = Pong_clone(arg);
22852 uint64_t ret_ref = 0;
22853 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22854 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22855 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22856 ret_ref = (uint64_t)ret_var.inner;
22857 if (ret_var.is_owned) {
22862 int64_t __attribute__((visibility("default"))) TS_Pong_clone_ptr(uint32_t arg) {
22864 arg_conv.inner = (void*)(arg & (~1));
22865 arg_conv.is_owned = false;
22866 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22867 int64_t ret_val = Pong_clone_ptr(&arg_conv);
22871 uint32_t __attribute__((visibility("default"))) TS_Pong_clone(uint32_t orig) {
22873 orig_conv.inner = (void*)(orig & (~1));
22874 orig_conv.is_owned = false;
22875 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22876 LDKPong ret_var = Pong_clone(&orig_conv);
22877 uint64_t ret_ref = 0;
22878 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22879 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22880 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22881 ret_ref = (uint64_t)ret_var.inner;
22882 if (ret_var.is_owned) {
22888 void __attribute__((visibility("default"))) TS_OpenChannel_free(uint32_t this_obj) {
22889 LDKOpenChannel this_obj_conv;
22890 this_obj_conv.inner = (void*)(this_obj & (~1));
22891 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22892 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22893 OpenChannel_free(this_obj_conv);
22896 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
22897 LDKOpenChannel this_ptr_conv;
22898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22899 this_ptr_conv.is_owned = false;
22900 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22901 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22902 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
22906 void __attribute__((visibility("default"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
22907 LDKOpenChannel this_ptr_conv;
22908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22909 this_ptr_conv.is_owned = false;
22910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22911 LDKThirtyTwoBytes val_ref;
22912 CHECK(*((uint32_t*)val) == 32);
22913 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
22914 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
22917 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
22918 LDKOpenChannel this_ptr_conv;
22919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22920 this_ptr_conv.is_owned = false;
22921 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22922 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22923 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
22927 void __attribute__((visibility("default"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
22928 LDKOpenChannel this_ptr_conv;
22929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22930 this_ptr_conv.is_owned = false;
22931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22932 LDKThirtyTwoBytes val_ref;
22933 CHECK(*((uint32_t*)val) == 32);
22934 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
22935 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
22938 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
22939 LDKOpenChannel this_ptr_conv;
22940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22941 this_ptr_conv.is_owned = false;
22942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22943 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
22947 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
22948 LDKOpenChannel this_ptr_conv;
22949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22950 this_ptr_conv.is_owned = false;
22951 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22952 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
22955 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
22956 LDKOpenChannel this_ptr_conv;
22957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22958 this_ptr_conv.is_owned = false;
22959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22960 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
22964 void __attribute__((visibility("default"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
22965 LDKOpenChannel this_ptr_conv;
22966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22967 this_ptr_conv.is_owned = false;
22968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22969 OpenChannel_set_push_msat(&this_ptr_conv, val);
22972 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
22973 LDKOpenChannel this_ptr_conv;
22974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22975 this_ptr_conv.is_owned = false;
22976 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22977 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
22981 void __attribute__((visibility("default"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
22982 LDKOpenChannel this_ptr_conv;
22983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22984 this_ptr_conv.is_owned = false;
22985 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22986 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
22989 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
22990 LDKOpenChannel this_ptr_conv;
22991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22992 this_ptr_conv.is_owned = false;
22993 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22994 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
22998 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
22999 LDKOpenChannel this_ptr_conv;
23000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23001 this_ptr_conv.is_owned = false;
23002 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23003 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
23006 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
23007 LDKOpenChannel this_ptr_conv;
23008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23009 this_ptr_conv.is_owned = false;
23010 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23011 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
23015 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
23016 LDKOpenChannel this_ptr_conv;
23017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23018 this_ptr_conv.is_owned = false;
23019 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23020 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
23023 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
23024 LDKOpenChannel this_ptr_conv;
23025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23026 this_ptr_conv.is_owned = false;
23027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23028 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
23032 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
23033 LDKOpenChannel this_ptr_conv;
23034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23035 this_ptr_conv.is_owned = false;
23036 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23037 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
23040 int32_t __attribute__((visibility("default"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
23041 LDKOpenChannel this_ptr_conv;
23042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23043 this_ptr_conv.is_owned = false;
23044 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23045 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
23049 void __attribute__((visibility("default"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
23050 LDKOpenChannel this_ptr_conv;
23051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23052 this_ptr_conv.is_owned = false;
23053 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23054 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
23057 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
23058 LDKOpenChannel this_ptr_conv;
23059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23060 this_ptr_conv.is_owned = false;
23061 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23062 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
23066 void __attribute__((visibility("default"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
23067 LDKOpenChannel this_ptr_conv;
23068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23069 this_ptr_conv.is_owned = false;
23070 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23071 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
23074 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
23075 LDKOpenChannel this_ptr_conv;
23076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23077 this_ptr_conv.is_owned = false;
23078 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23079 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
23083 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
23084 LDKOpenChannel this_ptr_conv;
23085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23086 this_ptr_conv.is_owned = false;
23087 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23088 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
23091 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
23092 LDKOpenChannel this_ptr_conv;
23093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23094 this_ptr_conv.is_owned = false;
23095 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23096 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23097 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
23101 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
23102 LDKOpenChannel this_ptr_conv;
23103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23104 this_ptr_conv.is_owned = false;
23105 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23106 LDKPublicKey val_ref;
23107 CHECK(*((uint32_t*)val) == 33);
23108 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
23109 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
23112 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
23113 LDKOpenChannel this_ptr_conv;
23114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23115 this_ptr_conv.is_owned = false;
23116 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23117 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23118 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
23122 void __attribute__((visibility("default"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
23123 LDKOpenChannel this_ptr_conv;
23124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23125 this_ptr_conv.is_owned = false;
23126 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23127 LDKPublicKey val_ref;
23128 CHECK(*((uint32_t*)val) == 33);
23129 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
23130 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
23133 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
23134 LDKOpenChannel this_ptr_conv;
23135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23136 this_ptr_conv.is_owned = false;
23137 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23138 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23139 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
23143 void __attribute__((visibility("default"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
23144 LDKOpenChannel this_ptr_conv;
23145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23146 this_ptr_conv.is_owned = false;
23147 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23148 LDKPublicKey val_ref;
23149 CHECK(*((uint32_t*)val) == 33);
23150 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
23151 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
23154 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
23155 LDKOpenChannel this_ptr_conv;
23156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23157 this_ptr_conv.is_owned = false;
23158 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23159 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23160 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
23164 void __attribute__((visibility("default"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
23165 LDKOpenChannel this_ptr_conv;
23166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23167 this_ptr_conv.is_owned = false;
23168 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23169 LDKPublicKey val_ref;
23170 CHECK(*((uint32_t*)val) == 33);
23171 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
23172 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
23175 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
23176 LDKOpenChannel this_ptr_conv;
23177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23178 this_ptr_conv.is_owned = false;
23179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23180 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23181 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
23185 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
23186 LDKOpenChannel this_ptr_conv;
23187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23188 this_ptr_conv.is_owned = false;
23189 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23190 LDKPublicKey val_ref;
23191 CHECK(*((uint32_t*)val) == 33);
23192 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
23193 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
23196 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
23197 LDKOpenChannel this_ptr_conv;
23198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23199 this_ptr_conv.is_owned = false;
23200 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23201 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23202 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
23206 void __attribute__((visibility("default"))) TS_OpenChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
23207 LDKOpenChannel this_ptr_conv;
23208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23209 this_ptr_conv.is_owned = false;
23210 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23211 LDKPublicKey val_ref;
23212 CHECK(*((uint32_t*)val) == 33);
23213 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
23214 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
23217 int8_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
23218 LDKOpenChannel this_ptr_conv;
23219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23220 this_ptr_conv.is_owned = false;
23221 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23222 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
23226 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
23227 LDKOpenChannel this_ptr_conv;
23228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23229 this_ptr_conv.is_owned = false;
23230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23231 OpenChannel_set_channel_flags(&this_ptr_conv, val);
23234 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_type(uint32_t this_ptr) {
23235 LDKOpenChannel this_ptr_conv;
23236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23237 this_ptr_conv.is_owned = false;
23238 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23239 LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
23240 uint64_t ret_ref = 0;
23241 if ((uint64_t)ret_var.inner > 4096) {
23242 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23243 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23244 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23245 ret_ref = (uint64_t)ret_var.inner;
23246 if (ret_var.is_owned) {
23253 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_type(uint32_t this_ptr, uint32_t val) {
23254 LDKOpenChannel this_ptr_conv;
23255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23256 this_ptr_conv.is_owned = false;
23257 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23258 LDKChannelTypeFeatures val_conv;
23259 val_conv.inner = (void*)(val & (~1));
23260 val_conv.is_owned = (val & 1) || (val == 0);
23261 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23262 val_conv = ChannelTypeFeatures_clone(&val_conv);
23263 OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
23266 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
23267 LDKOpenChannel ret_var = OpenChannel_clone(arg);
23268 uint64_t ret_ref = 0;
23269 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23270 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23271 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23272 ret_ref = (uint64_t)ret_var.inner;
23273 if (ret_var.is_owned) {
23278 int64_t __attribute__((visibility("default"))) TS_OpenChannel_clone_ptr(uint32_t arg) {
23279 LDKOpenChannel arg_conv;
23280 arg_conv.inner = (void*)(arg & (~1));
23281 arg_conv.is_owned = false;
23282 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23283 int64_t ret_val = OpenChannel_clone_ptr(&arg_conv);
23287 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_clone(uint32_t orig) {
23288 LDKOpenChannel orig_conv;
23289 orig_conv.inner = (void*)(orig & (~1));
23290 orig_conv.is_owned = false;
23291 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23292 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
23293 uint64_t ret_ref = 0;
23294 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23295 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23296 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23297 ret_ref = (uint64_t)ret_var.inner;
23298 if (ret_var.is_owned) {
23304 void __attribute__((visibility("default"))) TS_AcceptChannel_free(uint32_t this_obj) {
23305 LDKAcceptChannel this_obj_conv;
23306 this_obj_conv.inner = (void*)(this_obj & (~1));
23307 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23308 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23309 AcceptChannel_free(this_obj_conv);
23312 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
23313 LDKAcceptChannel this_ptr_conv;
23314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23315 this_ptr_conv.is_owned = false;
23316 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23317 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23318 memcpy((uint8_t*)(ret_arr + 4), *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
23322 void __attribute__((visibility("default"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
23323 LDKAcceptChannel this_ptr_conv;
23324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23325 this_ptr_conv.is_owned = false;
23326 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23327 LDKThirtyTwoBytes val_ref;
23328 CHECK(*((uint32_t*)val) == 32);
23329 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23330 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
23333 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
23334 LDKAcceptChannel this_ptr_conv;
23335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23336 this_ptr_conv.is_owned = false;
23337 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23338 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
23342 void __attribute__((visibility("default"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
23343 LDKAcceptChannel this_ptr_conv;
23344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23345 this_ptr_conv.is_owned = false;
23346 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23347 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
23350 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
23351 LDKAcceptChannel this_ptr_conv;
23352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23353 this_ptr_conv.is_owned = false;
23354 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23355 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
23359 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
23360 LDKAcceptChannel this_ptr_conv;
23361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23362 this_ptr_conv.is_owned = false;
23363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23364 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
23367 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
23368 LDKAcceptChannel this_ptr_conv;
23369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23370 this_ptr_conv.is_owned = false;
23371 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23372 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
23376 void __attribute__((visibility("default"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
23377 LDKAcceptChannel this_ptr_conv;
23378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23379 this_ptr_conv.is_owned = false;
23380 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23381 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
23384 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
23385 LDKAcceptChannel this_ptr_conv;
23386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23387 this_ptr_conv.is_owned = false;
23388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23389 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
23393 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
23394 LDKAcceptChannel this_ptr_conv;
23395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23396 this_ptr_conv.is_owned = false;
23397 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23398 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
23401 int32_t __attribute__((visibility("default"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
23402 LDKAcceptChannel this_ptr_conv;
23403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23404 this_ptr_conv.is_owned = false;
23405 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23406 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
23410 void __attribute__((visibility("default"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
23411 LDKAcceptChannel this_ptr_conv;
23412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23413 this_ptr_conv.is_owned = false;
23414 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23415 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
23418 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
23419 LDKAcceptChannel this_ptr_conv;
23420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23421 this_ptr_conv.is_owned = false;
23422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23423 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
23427 void __attribute__((visibility("default"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
23428 LDKAcceptChannel this_ptr_conv;
23429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23430 this_ptr_conv.is_owned = false;
23431 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23432 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
23435 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
23436 LDKAcceptChannel this_ptr_conv;
23437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23438 this_ptr_conv.is_owned = false;
23439 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23440 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
23444 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
23445 LDKAcceptChannel this_ptr_conv;
23446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23447 this_ptr_conv.is_owned = false;
23448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23449 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
23452 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
23453 LDKAcceptChannel this_ptr_conv;
23454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23455 this_ptr_conv.is_owned = false;
23456 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23457 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23458 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
23462 void __attribute__((visibility("default"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
23463 LDKAcceptChannel this_ptr_conv;
23464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23465 this_ptr_conv.is_owned = false;
23466 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23467 LDKPublicKey val_ref;
23468 CHECK(*((uint32_t*)val) == 33);
23469 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
23470 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
23473 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
23474 LDKAcceptChannel this_ptr_conv;
23475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23476 this_ptr_conv.is_owned = false;
23477 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23478 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23479 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
23483 void __attribute__((visibility("default"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
23484 LDKAcceptChannel this_ptr_conv;
23485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23486 this_ptr_conv.is_owned = false;
23487 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23488 LDKPublicKey val_ref;
23489 CHECK(*((uint32_t*)val) == 33);
23490 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
23491 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
23494 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
23495 LDKAcceptChannel this_ptr_conv;
23496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23497 this_ptr_conv.is_owned = false;
23498 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23499 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23500 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
23504 void __attribute__((visibility("default"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
23505 LDKAcceptChannel this_ptr_conv;
23506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23507 this_ptr_conv.is_owned = false;
23508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23509 LDKPublicKey val_ref;
23510 CHECK(*((uint32_t*)val) == 33);
23511 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
23512 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
23515 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
23516 LDKAcceptChannel this_ptr_conv;
23517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23518 this_ptr_conv.is_owned = false;
23519 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23520 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23521 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
23525 void __attribute__((visibility("default"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
23526 LDKAcceptChannel this_ptr_conv;
23527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23528 this_ptr_conv.is_owned = false;
23529 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23530 LDKPublicKey val_ref;
23531 CHECK(*((uint32_t*)val) == 33);
23532 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
23533 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
23536 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
23537 LDKAcceptChannel this_ptr_conv;
23538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23539 this_ptr_conv.is_owned = false;
23540 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23541 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23542 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
23546 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
23547 LDKAcceptChannel this_ptr_conv;
23548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23549 this_ptr_conv.is_owned = false;
23550 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23551 LDKPublicKey val_ref;
23552 CHECK(*((uint32_t*)val) == 33);
23553 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
23554 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
23557 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
23558 LDKAcceptChannel this_ptr_conv;
23559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23560 this_ptr_conv.is_owned = false;
23561 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23562 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23563 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
23567 void __attribute__((visibility("default"))) TS_AcceptChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
23568 LDKAcceptChannel this_ptr_conv;
23569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23570 this_ptr_conv.is_owned = false;
23571 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23572 LDKPublicKey val_ref;
23573 CHECK(*((uint32_t*)val) == 33);
23574 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
23575 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
23578 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
23579 LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
23580 uint64_t ret_ref = 0;
23581 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23582 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23583 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23584 ret_ref = (uint64_t)ret_var.inner;
23585 if (ret_var.is_owned) {
23590 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_clone_ptr(uint32_t arg) {
23591 LDKAcceptChannel arg_conv;
23592 arg_conv.inner = (void*)(arg & (~1));
23593 arg_conv.is_owned = false;
23594 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23595 int64_t ret_val = AcceptChannel_clone_ptr(&arg_conv);
23599 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_clone(uint32_t orig) {
23600 LDKAcceptChannel orig_conv;
23601 orig_conv.inner = (void*)(orig & (~1));
23602 orig_conv.is_owned = false;
23603 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23604 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
23605 uint64_t ret_ref = 0;
23606 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23607 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23608 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23609 ret_ref = (uint64_t)ret_var.inner;
23610 if (ret_var.is_owned) {
23616 void __attribute__((visibility("default"))) TS_FundingCreated_free(uint32_t this_obj) {
23617 LDKFundingCreated this_obj_conv;
23618 this_obj_conv.inner = (void*)(this_obj & (~1));
23619 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23620 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23621 FundingCreated_free(this_obj_conv);
23624 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
23625 LDKFundingCreated this_ptr_conv;
23626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23627 this_ptr_conv.is_owned = false;
23628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23629 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23630 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
23634 void __attribute__((visibility("default"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
23635 LDKFundingCreated this_ptr_conv;
23636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23637 this_ptr_conv.is_owned = false;
23638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23639 LDKThirtyTwoBytes val_ref;
23640 CHECK(*((uint32_t*)val) == 32);
23641 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23642 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
23645 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
23646 LDKFundingCreated this_ptr_conv;
23647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23648 this_ptr_conv.is_owned = false;
23649 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23650 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23651 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
23655 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
23656 LDKFundingCreated this_ptr_conv;
23657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23658 this_ptr_conv.is_owned = false;
23659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23660 LDKThirtyTwoBytes val_ref;
23661 CHECK(*((uint32_t*)val) == 32);
23662 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23663 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
23666 int16_t __attribute__((visibility("default"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
23667 LDKFundingCreated this_ptr_conv;
23668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23669 this_ptr_conv.is_owned = false;
23670 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23671 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
23675 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
23676 LDKFundingCreated this_ptr_conv;
23677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23678 this_ptr_conv.is_owned = false;
23679 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23680 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
23683 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
23684 LDKFundingCreated this_ptr_conv;
23685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23686 this_ptr_conv.is_owned = false;
23687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23688 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
23689 memcpy((uint8_t*)(ret_arr + 4), FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
23693 void __attribute__((visibility("default"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
23694 LDKFundingCreated 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 LDKSignature val_ref;
23699 CHECK(*((uint32_t*)val) == 64);
23700 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
23701 FundingCreated_set_signature(&this_ptr_conv, val_ref);
23704 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_new(int8_tArray temporary_channel_id_arg, int8_tArray funding_txid_arg, int16_t funding_output_index_arg, int8_tArray signature_arg) {
23705 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
23706 CHECK(*((uint32_t*)temporary_channel_id_arg) == 32);
23707 memcpy(temporary_channel_id_arg_ref.data, (uint8_t*)(temporary_channel_id_arg + 4), 32);
23708 LDKThirtyTwoBytes funding_txid_arg_ref;
23709 CHECK(*((uint32_t*)funding_txid_arg) == 32);
23710 memcpy(funding_txid_arg_ref.data, (uint8_t*)(funding_txid_arg + 4), 32);
23711 LDKSignature signature_arg_ref;
23712 CHECK(*((uint32_t*)signature_arg) == 64);
23713 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
23714 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
23715 uint64_t ret_ref = 0;
23716 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23717 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23718 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23719 ret_ref = (uint64_t)ret_var.inner;
23720 if (ret_var.is_owned) {
23726 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
23727 LDKFundingCreated ret_var = FundingCreated_clone(arg);
23728 uint64_t ret_ref = 0;
23729 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23730 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23731 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23732 ret_ref = (uint64_t)ret_var.inner;
23733 if (ret_var.is_owned) {
23738 int64_t __attribute__((visibility("default"))) TS_FundingCreated_clone_ptr(uint32_t arg) {
23739 LDKFundingCreated arg_conv;
23740 arg_conv.inner = (void*)(arg & (~1));
23741 arg_conv.is_owned = false;
23742 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23743 int64_t ret_val = FundingCreated_clone_ptr(&arg_conv);
23747 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_clone(uint32_t orig) {
23748 LDKFundingCreated orig_conv;
23749 orig_conv.inner = (void*)(orig & (~1));
23750 orig_conv.is_owned = false;
23751 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23752 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
23753 uint64_t ret_ref = 0;
23754 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23755 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23756 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23757 ret_ref = (uint64_t)ret_var.inner;
23758 if (ret_var.is_owned) {
23764 void __attribute__((visibility("default"))) TS_FundingSigned_free(uint32_t this_obj) {
23765 LDKFundingSigned this_obj_conv;
23766 this_obj_conv.inner = (void*)(this_obj & (~1));
23767 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23768 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23769 FundingSigned_free(this_obj_conv);
23772 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
23773 LDKFundingSigned this_ptr_conv;
23774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23775 this_ptr_conv.is_owned = false;
23776 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23777 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23778 memcpy((uint8_t*)(ret_arr + 4), *FundingSigned_get_channel_id(&this_ptr_conv), 32);
23782 void __attribute__((visibility("default"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23783 LDKFundingSigned this_ptr_conv;
23784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23785 this_ptr_conv.is_owned = false;
23786 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23787 LDKThirtyTwoBytes val_ref;
23788 CHECK(*((uint32_t*)val) == 32);
23789 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23790 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
23793 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
23794 LDKFundingSigned this_ptr_conv;
23795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23796 this_ptr_conv.is_owned = false;
23797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23798 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
23799 memcpy((uint8_t*)(ret_arr + 4), FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
23803 void __attribute__((visibility("default"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
23804 LDKFundingSigned this_ptr_conv;
23805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23806 this_ptr_conv.is_owned = false;
23807 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23808 LDKSignature val_ref;
23809 CHECK(*((uint32_t*)val) == 64);
23810 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
23811 FundingSigned_set_signature(&this_ptr_conv, val_ref);
23814 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
23815 LDKThirtyTwoBytes channel_id_arg_ref;
23816 CHECK(*((uint32_t*)channel_id_arg) == 32);
23817 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
23818 LDKSignature signature_arg_ref;
23819 CHECK(*((uint32_t*)signature_arg) == 64);
23820 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
23821 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
23822 uint64_t ret_ref = 0;
23823 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23824 CHECK((((uint64_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 = (uint64_t)ret_var.inner;
23827 if (ret_var.is_owned) {
23833 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
23834 LDKFundingSigned ret_var = FundingSigned_clone(arg);
23835 uint64_t ret_ref = 0;
23836 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23837 CHECK((((uint64_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 = (uint64_t)ret_var.inner;
23840 if (ret_var.is_owned) {
23845 int64_t __attribute__((visibility("default"))) TS_FundingSigned_clone_ptr(uint32_t arg) {
23846 LDKFundingSigned 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 int64_t ret_val = FundingSigned_clone_ptr(&arg_conv);
23854 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_clone(uint32_t orig) {
23855 LDKFundingSigned 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 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
23860 uint64_t ret_ref = 0;
23861 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23862 CHECK((((uint64_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 = (uint64_t)ret_var.inner;
23865 if (ret_var.is_owned) {
23871 void __attribute__((visibility("default"))) TS_FundingLocked_free(uint32_t this_obj) {
23872 LDKFundingLocked this_obj_conv;
23873 this_obj_conv.inner = (void*)(this_obj & (~1));
23874 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23875 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23876 FundingLocked_free(this_obj_conv);
23879 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_channel_id(uint32_t this_ptr) {
23880 LDKFundingLocked this_ptr_conv;
23881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23882 this_ptr_conv.is_owned = false;
23883 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23884 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23885 memcpy((uint8_t*)(ret_arr + 4), *FundingLocked_get_channel_id(&this_ptr_conv), 32);
23889 void __attribute__((visibility("default"))) TS_FundingLocked_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23890 LDKFundingLocked this_ptr_conv;
23891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23892 this_ptr_conv.is_owned = false;
23893 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23894 LDKThirtyTwoBytes val_ref;
23895 CHECK(*((uint32_t*)val) == 32);
23896 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23897 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
23900 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_next_per_commitment_point(uint32_t this_ptr) {
23901 LDKFundingLocked this_ptr_conv;
23902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23903 this_ptr_conv.is_owned = false;
23904 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23905 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23906 memcpy((uint8_t*)(ret_arr + 4), FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
23910 void __attribute__((visibility("default"))) TS_FundingLocked_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
23911 LDKFundingLocked this_ptr_conv;
23912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23913 this_ptr_conv.is_owned = false;
23914 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23915 LDKPublicKey val_ref;
23916 CHECK(*((uint32_t*)val) == 33);
23917 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
23918 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
23921 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
23922 LDKThirtyTwoBytes channel_id_arg_ref;
23923 CHECK(*((uint32_t*)channel_id_arg) == 32);
23924 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
23925 LDKPublicKey next_per_commitment_point_arg_ref;
23926 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
23927 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
23928 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
23929 uint64_t ret_ref = 0;
23930 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23931 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23932 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23933 ret_ref = (uint64_t)ret_var.inner;
23934 if (ret_var.is_owned) {
23940 static inline uint64_t FundingLocked_clone_ptr(LDKFundingLocked *NONNULL_PTR arg) {
23941 LDKFundingLocked ret_var = FundingLocked_clone(arg);
23942 uint64_t ret_ref = 0;
23943 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23944 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23945 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23946 ret_ref = (uint64_t)ret_var.inner;
23947 if (ret_var.is_owned) {
23952 int64_t __attribute__((visibility("default"))) TS_FundingLocked_clone_ptr(uint32_t arg) {
23953 LDKFundingLocked arg_conv;
23954 arg_conv.inner = (void*)(arg & (~1));
23955 arg_conv.is_owned = false;
23956 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23957 int64_t ret_val = FundingLocked_clone_ptr(&arg_conv);
23961 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_clone(uint32_t orig) {
23962 LDKFundingLocked orig_conv;
23963 orig_conv.inner = (void*)(orig & (~1));
23964 orig_conv.is_owned = false;
23965 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23966 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
23967 uint64_t ret_ref = 0;
23968 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23969 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23970 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23971 ret_ref = (uint64_t)ret_var.inner;
23972 if (ret_var.is_owned) {
23978 void __attribute__((visibility("default"))) TS_Shutdown_free(uint32_t this_obj) {
23979 LDKShutdown this_obj_conv;
23980 this_obj_conv.inner = (void*)(this_obj & (~1));
23981 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23982 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23983 Shutdown_free(this_obj_conv);
23986 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
23987 LDKShutdown this_ptr_conv;
23988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23989 this_ptr_conv.is_owned = false;
23990 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23991 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23992 memcpy((uint8_t*)(ret_arr + 4), *Shutdown_get_channel_id(&this_ptr_conv), 32);
23996 void __attribute__((visibility("default"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23997 LDKShutdown this_ptr_conv;
23998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23999 this_ptr_conv.is_owned = false;
24000 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24001 LDKThirtyTwoBytes val_ref;
24002 CHECK(*((uint32_t*)val) == 32);
24003 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24004 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
24007 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
24008 LDKShutdown this_ptr_conv;
24009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24010 this_ptr_conv.is_owned = false;
24011 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24012 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
24013 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24014 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24018 void __attribute__((visibility("default"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
24019 LDKShutdown this_ptr_conv;
24020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24021 this_ptr_conv.is_owned = false;
24022 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24023 LDKCVec_u8Z val_ref;
24024 val_ref.datalen = *((uint32_t*)val);
24025 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
24026 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
24027 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
24030 uint32_t __attribute__((visibility("default"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
24031 LDKThirtyTwoBytes channel_id_arg_ref;
24032 CHECK(*((uint32_t*)channel_id_arg) == 32);
24033 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
24034 LDKCVec_u8Z scriptpubkey_arg_ref;
24035 scriptpubkey_arg_ref.datalen = *((uint32_t*)scriptpubkey_arg);
24036 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
24037 memcpy(scriptpubkey_arg_ref.data, (uint8_t*)(scriptpubkey_arg + 4), scriptpubkey_arg_ref.datalen);
24038 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
24039 uint64_t ret_ref = 0;
24040 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24041 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24042 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24043 ret_ref = (uint64_t)ret_var.inner;
24044 if (ret_var.is_owned) {
24050 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
24051 LDKShutdown ret_var = Shutdown_clone(arg);
24052 uint64_t ret_ref = 0;
24053 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24054 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24055 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24056 ret_ref = (uint64_t)ret_var.inner;
24057 if (ret_var.is_owned) {
24062 int64_t __attribute__((visibility("default"))) TS_Shutdown_clone_ptr(uint32_t arg) {
24063 LDKShutdown arg_conv;
24064 arg_conv.inner = (void*)(arg & (~1));
24065 arg_conv.is_owned = false;
24066 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24067 int64_t ret_val = Shutdown_clone_ptr(&arg_conv);
24071 uint32_t __attribute__((visibility("default"))) TS_Shutdown_clone(uint32_t orig) {
24072 LDKShutdown orig_conv;
24073 orig_conv.inner = (void*)(orig & (~1));
24074 orig_conv.is_owned = false;
24075 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24076 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
24077 uint64_t ret_ref = 0;
24078 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24079 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24080 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24081 ret_ref = (uint64_t)ret_var.inner;
24082 if (ret_var.is_owned) {
24088 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_free(uint32_t this_obj) {
24089 LDKClosingSignedFeeRange this_obj_conv;
24090 this_obj_conv.inner = (void*)(this_obj & (~1));
24091 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24092 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24093 ClosingSignedFeeRange_free(this_obj_conv);
24096 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint32_t this_ptr) {
24097 LDKClosingSignedFeeRange this_ptr_conv;
24098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24099 this_ptr_conv.is_owned = false;
24100 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24101 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
24105 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint32_t this_ptr, int64_t val) {
24106 LDKClosingSignedFeeRange this_ptr_conv;
24107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24108 this_ptr_conv.is_owned = false;
24109 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24110 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
24113 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint32_t this_ptr) {
24114 LDKClosingSignedFeeRange this_ptr_conv;
24115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24116 this_ptr_conv.is_owned = false;
24117 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24118 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
24122 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
24123 LDKClosingSignedFeeRange this_ptr_conv;
24124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24125 this_ptr_conv.is_owned = false;
24126 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24127 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
24130 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
24131 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
24132 uint64_t ret_ref = 0;
24133 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24134 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24135 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24136 ret_ref = (uint64_t)ret_var.inner;
24137 if (ret_var.is_owned) {
24143 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
24144 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
24145 uint64_t ret_ref = 0;
24146 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24147 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24148 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24149 ret_ref = (uint64_t)ret_var.inner;
24150 if (ret_var.is_owned) {
24155 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_clone_ptr(uint32_t arg) {
24156 LDKClosingSignedFeeRange arg_conv;
24157 arg_conv.inner = (void*)(arg & (~1));
24158 arg_conv.is_owned = false;
24159 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24160 int64_t ret_val = ClosingSignedFeeRange_clone_ptr(&arg_conv);
24164 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_clone(uint32_t orig) {
24165 LDKClosingSignedFeeRange orig_conv;
24166 orig_conv.inner = (void*)(orig & (~1));
24167 orig_conv.is_owned = false;
24168 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24169 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
24170 uint64_t ret_ref = 0;
24171 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24172 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24173 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24174 ret_ref = (uint64_t)ret_var.inner;
24175 if (ret_var.is_owned) {
24181 void __attribute__((visibility("default"))) TS_ClosingSigned_free(uint32_t this_obj) {
24182 LDKClosingSigned this_obj_conv;
24183 this_obj_conv.inner = (void*)(this_obj & (~1));
24184 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24185 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24186 ClosingSigned_free(this_obj_conv);
24189 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
24190 LDKClosingSigned this_ptr_conv;
24191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24192 this_ptr_conv.is_owned = false;
24193 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24194 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24195 memcpy((uint8_t*)(ret_arr + 4), *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
24199 void __attribute__((visibility("default"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24200 LDKClosingSigned this_ptr_conv;
24201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24202 this_ptr_conv.is_owned = false;
24203 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24204 LDKThirtyTwoBytes val_ref;
24205 CHECK(*((uint32_t*)val) == 32);
24206 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24207 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
24210 int64_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
24211 LDKClosingSigned this_ptr_conv;
24212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24213 this_ptr_conv.is_owned = false;
24214 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24215 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
24219 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
24220 LDKClosingSigned this_ptr_conv;
24221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24222 this_ptr_conv.is_owned = false;
24223 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24224 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
24227 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
24228 LDKClosingSigned 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_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
24233 memcpy((uint8_t*)(ret_arr + 4), ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
24237 void __attribute__((visibility("default"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
24238 LDKClosingSigned 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 LDKSignature val_ref;
24243 CHECK(*((uint32_t*)val) == 64);
24244 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
24245 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
24248 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_range(uint32_t this_ptr) {
24249 LDKClosingSigned 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 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
24254 uint64_t ret_ref = 0;
24255 if ((uint64_t)ret_var.inner > 4096) {
24256 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24257 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24258 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24259 ret_ref = (uint64_t)ret_var.inner;
24260 if (ret_var.is_owned) {
24267 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_range(uint32_t this_ptr, uint32_t val) {
24268 LDKClosingSigned this_ptr_conv;
24269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24270 this_ptr_conv.is_owned = false;
24271 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24272 LDKClosingSignedFeeRange val_conv;
24273 val_conv.inner = (void*)(val & (~1));
24274 val_conv.is_owned = (val & 1) || (val == 0);
24275 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24276 val_conv = ClosingSignedFeeRange_clone(&val_conv);
24277 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
24280 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_new(int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, uint32_t fee_range_arg) {
24281 LDKThirtyTwoBytes channel_id_arg_ref;
24282 CHECK(*((uint32_t*)channel_id_arg) == 32);
24283 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
24284 LDKSignature signature_arg_ref;
24285 CHECK(*((uint32_t*)signature_arg) == 64);
24286 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
24287 LDKClosingSignedFeeRange fee_range_arg_conv;
24288 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
24289 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
24290 CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
24291 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
24292 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
24293 uint64_t ret_ref = 0;
24294 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24295 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24296 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24297 ret_ref = (uint64_t)ret_var.inner;
24298 if (ret_var.is_owned) {
24304 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
24305 LDKClosingSigned ret_var = ClosingSigned_clone(arg);
24306 uint64_t ret_ref = 0;
24307 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24308 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24309 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24310 ret_ref = (uint64_t)ret_var.inner;
24311 if (ret_var.is_owned) {
24316 int64_t __attribute__((visibility("default"))) TS_ClosingSigned_clone_ptr(uint32_t arg) {
24317 LDKClosingSigned arg_conv;
24318 arg_conv.inner = (void*)(arg & (~1));
24319 arg_conv.is_owned = false;
24320 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24321 int64_t ret_val = ClosingSigned_clone_ptr(&arg_conv);
24325 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_clone(uint32_t orig) {
24326 LDKClosingSigned orig_conv;
24327 orig_conv.inner = (void*)(orig & (~1));
24328 orig_conv.is_owned = false;
24329 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24330 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
24331 uint64_t ret_ref = 0;
24332 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24333 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24334 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24335 ret_ref = (uint64_t)ret_var.inner;
24336 if (ret_var.is_owned) {
24342 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_free(uint32_t this_obj) {
24343 LDKUpdateAddHTLC this_obj_conv;
24344 this_obj_conv.inner = (void*)(this_obj & (~1));
24345 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24346 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24347 UpdateAddHTLC_free(this_obj_conv);
24350 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
24351 LDKUpdateAddHTLC this_ptr_conv;
24352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24353 this_ptr_conv.is_owned = false;
24354 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24355 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24356 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
24360 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24361 LDKUpdateAddHTLC this_ptr_conv;
24362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24363 this_ptr_conv.is_owned = false;
24364 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24365 LDKThirtyTwoBytes val_ref;
24366 CHECK(*((uint32_t*)val) == 32);
24367 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24368 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
24371 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
24372 LDKUpdateAddHTLC this_ptr_conv;
24373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24374 this_ptr_conv.is_owned = false;
24375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24376 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
24380 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
24381 LDKUpdateAddHTLC this_ptr_conv;
24382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24383 this_ptr_conv.is_owned = false;
24384 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24385 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
24388 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
24389 LDKUpdateAddHTLC this_ptr_conv;
24390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24391 this_ptr_conv.is_owned = false;
24392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24393 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
24397 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
24398 LDKUpdateAddHTLC this_ptr_conv;
24399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24400 this_ptr_conv.is_owned = false;
24401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24402 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
24405 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
24406 LDKUpdateAddHTLC this_ptr_conv;
24407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24408 this_ptr_conv.is_owned = false;
24409 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24410 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24411 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
24415 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
24416 LDKUpdateAddHTLC this_ptr_conv;
24417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24418 this_ptr_conv.is_owned = false;
24419 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24420 LDKThirtyTwoBytes val_ref;
24421 CHECK(*((uint32_t*)val) == 32);
24422 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24423 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
24426 int32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
24427 LDKUpdateAddHTLC this_ptr_conv;
24428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24429 this_ptr_conv.is_owned = false;
24430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24431 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
24435 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
24436 LDKUpdateAddHTLC this_ptr_conv;
24437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24438 this_ptr_conv.is_owned = false;
24439 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24440 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
24443 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
24444 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
24445 uint64_t ret_ref = 0;
24446 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24447 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24448 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24449 ret_ref = (uint64_t)ret_var.inner;
24450 if (ret_var.is_owned) {
24455 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_clone_ptr(uint32_t arg) {
24456 LDKUpdateAddHTLC arg_conv;
24457 arg_conv.inner = (void*)(arg & (~1));
24458 arg_conv.is_owned = false;
24459 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24460 int64_t ret_val = UpdateAddHTLC_clone_ptr(&arg_conv);
24464 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
24465 LDKUpdateAddHTLC orig_conv;
24466 orig_conv.inner = (void*)(orig & (~1));
24467 orig_conv.is_owned = false;
24468 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24469 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
24470 uint64_t ret_ref = 0;
24471 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24472 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24473 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24474 ret_ref = (uint64_t)ret_var.inner;
24475 if (ret_var.is_owned) {
24481 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_free(uint32_t this_obj) {
24482 LDKUpdateFulfillHTLC this_obj_conv;
24483 this_obj_conv.inner = (void*)(this_obj & (~1));
24484 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24485 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24486 UpdateFulfillHTLC_free(this_obj_conv);
24489 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
24490 LDKUpdateFulfillHTLC this_ptr_conv;
24491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24492 this_ptr_conv.is_owned = false;
24493 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24494 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24495 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
24499 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24500 LDKUpdateFulfillHTLC this_ptr_conv;
24501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24502 this_ptr_conv.is_owned = false;
24503 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24504 LDKThirtyTwoBytes val_ref;
24505 CHECK(*((uint32_t*)val) == 32);
24506 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24507 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
24510 int64_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
24511 LDKUpdateFulfillHTLC this_ptr_conv;
24512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24513 this_ptr_conv.is_owned = false;
24514 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24515 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
24519 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
24520 LDKUpdateFulfillHTLC this_ptr_conv;
24521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24522 this_ptr_conv.is_owned = false;
24523 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24524 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
24527 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
24528 LDKUpdateFulfillHTLC this_ptr_conv;
24529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24530 this_ptr_conv.is_owned = false;
24531 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24532 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24533 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
24537 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
24538 LDKUpdateFulfillHTLC this_ptr_conv;
24539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24540 this_ptr_conv.is_owned = false;
24541 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24542 LDKThirtyTwoBytes val_ref;
24543 CHECK(*((uint32_t*)val) == 32);
24544 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24545 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
24548 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
24549 LDKThirtyTwoBytes channel_id_arg_ref;
24550 CHECK(*((uint32_t*)channel_id_arg) == 32);
24551 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
24552 LDKThirtyTwoBytes payment_preimage_arg_ref;
24553 CHECK(*((uint32_t*)payment_preimage_arg) == 32);
24554 memcpy(payment_preimage_arg_ref.data, (uint8_t*)(payment_preimage_arg + 4), 32);
24555 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
24556 uint64_t ret_ref = 0;
24557 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24558 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24559 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24560 ret_ref = (uint64_t)ret_var.inner;
24561 if (ret_var.is_owned) {
24567 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
24568 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
24569 uint64_t ret_ref = 0;
24570 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24571 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24572 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24573 ret_ref = (uint64_t)ret_var.inner;
24574 if (ret_var.is_owned) {
24579 int64_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_clone_ptr(uint32_t arg) {
24580 LDKUpdateFulfillHTLC arg_conv;
24581 arg_conv.inner = (void*)(arg & (~1));
24582 arg_conv.is_owned = false;
24583 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24584 int64_t ret_val = UpdateFulfillHTLC_clone_ptr(&arg_conv);
24588 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
24589 LDKUpdateFulfillHTLC orig_conv;
24590 orig_conv.inner = (void*)(orig & (~1));
24591 orig_conv.is_owned = false;
24592 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24593 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
24594 uint64_t ret_ref = 0;
24595 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24596 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24597 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24598 ret_ref = (uint64_t)ret_var.inner;
24599 if (ret_var.is_owned) {
24605 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_free(uint32_t this_obj) {
24606 LDKUpdateFailHTLC this_obj_conv;
24607 this_obj_conv.inner = (void*)(this_obj & (~1));
24608 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24609 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24610 UpdateFailHTLC_free(this_obj_conv);
24613 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
24614 LDKUpdateFailHTLC this_ptr_conv;
24615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24616 this_ptr_conv.is_owned = false;
24617 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24618 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24619 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
24623 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24624 LDKUpdateFailHTLC this_ptr_conv;
24625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24626 this_ptr_conv.is_owned = false;
24627 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24628 LDKThirtyTwoBytes val_ref;
24629 CHECK(*((uint32_t*)val) == 32);
24630 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24631 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
24634 int64_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
24635 LDKUpdateFailHTLC this_ptr_conv;
24636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24637 this_ptr_conv.is_owned = false;
24638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24639 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
24643 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
24644 LDKUpdateFailHTLC this_ptr_conv;
24645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24646 this_ptr_conv.is_owned = false;
24647 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24648 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
24651 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
24652 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
24653 uint64_t ret_ref = 0;
24654 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24655 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24656 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24657 ret_ref = (uint64_t)ret_var.inner;
24658 if (ret_var.is_owned) {
24663 int64_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_clone_ptr(uint32_t arg) {
24664 LDKUpdateFailHTLC arg_conv;
24665 arg_conv.inner = (void*)(arg & (~1));
24666 arg_conv.is_owned = false;
24667 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24668 int64_t ret_val = UpdateFailHTLC_clone_ptr(&arg_conv);
24672 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
24673 LDKUpdateFailHTLC orig_conv;
24674 orig_conv.inner = (void*)(orig & (~1));
24675 orig_conv.is_owned = false;
24676 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24677 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
24678 uint64_t ret_ref = 0;
24679 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24680 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24681 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24682 ret_ref = (uint64_t)ret_var.inner;
24683 if (ret_var.is_owned) {
24689 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_obj) {
24690 LDKUpdateFailMalformedHTLC this_obj_conv;
24691 this_obj_conv.inner = (void*)(this_obj & (~1));
24692 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24693 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24694 UpdateFailMalformedHTLC_free(this_obj_conv);
24697 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
24698 LDKUpdateFailMalformedHTLC this_ptr_conv;
24699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24700 this_ptr_conv.is_owned = false;
24701 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24702 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24703 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
24707 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24708 LDKUpdateFailMalformedHTLC this_ptr_conv;
24709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24710 this_ptr_conv.is_owned = false;
24711 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24712 LDKThirtyTwoBytes val_ref;
24713 CHECK(*((uint32_t*)val) == 32);
24714 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24715 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
24718 int64_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
24719 LDKUpdateFailMalformedHTLC this_ptr_conv;
24720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24721 this_ptr_conv.is_owned = false;
24722 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24723 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
24727 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
24728 LDKUpdateFailMalformedHTLC this_ptr_conv;
24729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24730 this_ptr_conv.is_owned = false;
24731 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24732 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
24735 int16_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
24736 LDKUpdateFailMalformedHTLC this_ptr_conv;
24737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24738 this_ptr_conv.is_owned = false;
24739 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24740 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
24744 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
24745 LDKUpdateFailMalformedHTLC this_ptr_conv;
24746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24747 this_ptr_conv.is_owned = false;
24748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24749 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
24752 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
24753 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
24754 uint64_t ret_ref = 0;
24755 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24756 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24757 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24758 ret_ref = (uint64_t)ret_var.inner;
24759 if (ret_var.is_owned) {
24764 int64_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint32_t arg) {
24765 LDKUpdateFailMalformedHTLC arg_conv;
24766 arg_conv.inner = (void*)(arg & (~1));
24767 arg_conv.is_owned = false;
24768 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24769 int64_t ret_val = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
24773 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
24774 LDKUpdateFailMalformedHTLC orig_conv;
24775 orig_conv.inner = (void*)(orig & (~1));
24776 orig_conv.is_owned = false;
24777 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24778 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
24779 uint64_t ret_ref = 0;
24780 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24781 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24782 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24783 ret_ref = (uint64_t)ret_var.inner;
24784 if (ret_var.is_owned) {
24790 void __attribute__((visibility("default"))) TS_CommitmentSigned_free(uint32_t this_obj) {
24791 LDKCommitmentSigned this_obj_conv;
24792 this_obj_conv.inner = (void*)(this_obj & (~1));
24793 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24794 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24795 CommitmentSigned_free(this_obj_conv);
24798 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
24799 LDKCommitmentSigned this_ptr_conv;
24800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24801 this_ptr_conv.is_owned = false;
24802 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24803 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24804 memcpy((uint8_t*)(ret_arr + 4), *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
24808 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24809 LDKCommitmentSigned this_ptr_conv;
24810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24811 this_ptr_conv.is_owned = false;
24812 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24813 LDKThirtyTwoBytes val_ref;
24814 CHECK(*((uint32_t*)val) == 32);
24815 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24816 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
24819 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
24820 LDKCommitmentSigned this_ptr_conv;
24821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24822 this_ptr_conv.is_owned = false;
24823 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24824 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
24825 memcpy((uint8_t*)(ret_arr + 4), CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
24829 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
24830 LDKCommitmentSigned this_ptr_conv;
24831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24832 this_ptr_conv.is_owned = false;
24833 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24834 LDKSignature val_ref;
24835 CHECK(*((uint32_t*)val) == 64);
24836 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
24837 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
24840 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
24841 LDKCommitmentSigned 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 LDKCVec_SignatureZ val_constr;
24846 val_constr.datalen = *((uint32_t*)val);
24847 if (val_constr.datalen > 0)
24848 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
24850 val_constr.data = NULL;
24851 int8_tArray* val_vals = (int8_tArray*)(val + 4);
24852 for (size_t m = 0; m < val_constr.datalen; m++) {
24853 int8_tArray val_conv_12 = val_vals[m];
24854 LDKSignature val_conv_12_ref;
24855 CHECK(*((uint32_t*)val_conv_12) == 64);
24856 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
24857 val_constr.data[m] = val_conv_12_ref;
24859 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
24862 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
24863 LDKThirtyTwoBytes channel_id_arg_ref;
24864 CHECK(*((uint32_t*)channel_id_arg) == 32);
24865 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
24866 LDKSignature signature_arg_ref;
24867 CHECK(*((uint32_t*)signature_arg) == 64);
24868 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
24869 LDKCVec_SignatureZ htlc_signatures_arg_constr;
24870 htlc_signatures_arg_constr.datalen = *((uint32_t*)htlc_signatures_arg);
24871 if (htlc_signatures_arg_constr.datalen > 0)
24872 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
24874 htlc_signatures_arg_constr.data = NULL;
24875 int8_tArray* htlc_signatures_arg_vals = (int8_tArray*)(htlc_signatures_arg + 4);
24876 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
24877 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
24878 LDKSignature htlc_signatures_arg_conv_12_ref;
24879 CHECK(*((uint32_t*)htlc_signatures_arg_conv_12) == 64);
24880 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, (uint8_t*)(htlc_signatures_arg_conv_12 + 4), 64);
24881 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
24883 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
24884 uint64_t ret_ref = 0;
24885 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24886 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24887 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24888 ret_ref = (uint64_t)ret_var.inner;
24889 if (ret_var.is_owned) {
24895 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
24896 LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
24897 uint64_t ret_ref = 0;
24898 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24899 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24900 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24901 ret_ref = (uint64_t)ret_var.inner;
24902 if (ret_var.is_owned) {
24907 int64_t __attribute__((visibility("default"))) TS_CommitmentSigned_clone_ptr(uint32_t arg) {
24908 LDKCommitmentSigned arg_conv;
24909 arg_conv.inner = (void*)(arg & (~1));
24910 arg_conv.is_owned = false;
24911 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24912 int64_t ret_val = CommitmentSigned_clone_ptr(&arg_conv);
24916 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_clone(uint32_t orig) {
24917 LDKCommitmentSigned orig_conv;
24918 orig_conv.inner = (void*)(orig & (~1));
24919 orig_conv.is_owned = false;
24920 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24921 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
24922 uint64_t ret_ref = 0;
24923 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24924 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24925 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24926 ret_ref = (uint64_t)ret_var.inner;
24927 if (ret_var.is_owned) {
24933 void __attribute__((visibility("default"))) TS_RevokeAndACK_free(uint32_t this_obj) {
24934 LDKRevokeAndACK this_obj_conv;
24935 this_obj_conv.inner = (void*)(this_obj & (~1));
24936 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24938 RevokeAndACK_free(this_obj_conv);
24941 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
24942 LDKRevokeAndACK this_ptr_conv;
24943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24944 this_ptr_conv.is_owned = false;
24945 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24946 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24947 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
24951 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24952 LDKRevokeAndACK this_ptr_conv;
24953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24954 this_ptr_conv.is_owned = false;
24955 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24956 LDKThirtyTwoBytes val_ref;
24957 CHECK(*((uint32_t*)val) == 32);
24958 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24959 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
24962 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
24963 LDKRevokeAndACK this_ptr_conv;
24964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24965 this_ptr_conv.is_owned = false;
24966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24967 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24968 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
24972 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
24973 LDKRevokeAndACK this_ptr_conv;
24974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24975 this_ptr_conv.is_owned = false;
24976 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24977 LDKThirtyTwoBytes val_ref;
24978 CHECK(*((uint32_t*)val) == 32);
24979 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24980 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
24983 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
24984 LDKRevokeAndACK this_ptr_conv;
24985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24986 this_ptr_conv.is_owned = false;
24987 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24988 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
24989 memcpy((uint8_t*)(ret_arr + 4), RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
24993 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
24994 LDKRevokeAndACK this_ptr_conv;
24995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24996 this_ptr_conv.is_owned = false;
24997 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24998 LDKPublicKey val_ref;
24999 CHECK(*((uint32_t*)val) == 33);
25000 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
25001 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
25004 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_new(int8_tArray channel_id_arg, int8_tArray per_commitment_secret_arg, int8_tArray next_per_commitment_point_arg) {
25005 LDKThirtyTwoBytes channel_id_arg_ref;
25006 CHECK(*((uint32_t*)channel_id_arg) == 32);
25007 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
25008 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
25009 CHECK(*((uint32_t*)per_commitment_secret_arg) == 32);
25010 memcpy(per_commitment_secret_arg_ref.data, (uint8_t*)(per_commitment_secret_arg + 4), 32);
25011 LDKPublicKey next_per_commitment_point_arg_ref;
25012 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
25013 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
25014 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
25015 uint64_t ret_ref = 0;
25016 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25017 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25018 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25019 ret_ref = (uint64_t)ret_var.inner;
25020 if (ret_var.is_owned) {
25026 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
25027 LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
25028 uint64_t ret_ref = 0;
25029 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25030 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25031 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25032 ret_ref = (uint64_t)ret_var.inner;
25033 if (ret_var.is_owned) {
25038 int64_t __attribute__((visibility("default"))) TS_RevokeAndACK_clone_ptr(uint32_t arg) {
25039 LDKRevokeAndACK arg_conv;
25040 arg_conv.inner = (void*)(arg & (~1));
25041 arg_conv.is_owned = false;
25042 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25043 int64_t ret_val = RevokeAndACK_clone_ptr(&arg_conv);
25047 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_clone(uint32_t orig) {
25048 LDKRevokeAndACK orig_conv;
25049 orig_conv.inner = (void*)(orig & (~1));
25050 orig_conv.is_owned = false;
25051 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25052 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
25053 uint64_t ret_ref = 0;
25054 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25055 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25056 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25057 ret_ref = (uint64_t)ret_var.inner;
25058 if (ret_var.is_owned) {
25064 void __attribute__((visibility("default"))) TS_UpdateFee_free(uint32_t this_obj) {
25065 LDKUpdateFee this_obj_conv;
25066 this_obj_conv.inner = (void*)(this_obj & (~1));
25067 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25068 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25069 UpdateFee_free(this_obj_conv);
25072 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
25073 LDKUpdateFee this_ptr_conv;
25074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25075 this_ptr_conv.is_owned = false;
25076 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25077 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
25078 memcpy((uint8_t*)(ret_arr + 4), *UpdateFee_get_channel_id(&this_ptr_conv), 32);
25082 void __attribute__((visibility("default"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
25083 LDKUpdateFee this_ptr_conv;
25084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25085 this_ptr_conv.is_owned = false;
25086 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25087 LDKThirtyTwoBytes val_ref;
25088 CHECK(*((uint32_t*)val) == 32);
25089 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
25090 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
25093 int32_t __attribute__((visibility("default"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
25094 LDKUpdateFee this_ptr_conv;
25095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25096 this_ptr_conv.is_owned = false;
25097 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25098 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
25102 void __attribute__((visibility("default"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
25103 LDKUpdateFee this_ptr_conv;
25104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25105 this_ptr_conv.is_owned = false;
25106 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25107 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
25110 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
25111 LDKThirtyTwoBytes channel_id_arg_ref;
25112 CHECK(*((uint32_t*)channel_id_arg) == 32);
25113 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
25114 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
25115 uint64_t ret_ref = 0;
25116 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25117 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25118 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25119 ret_ref = (uint64_t)ret_var.inner;
25120 if (ret_var.is_owned) {
25126 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
25127 LDKUpdateFee ret_var = UpdateFee_clone(arg);
25128 uint64_t ret_ref = 0;
25129 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25130 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25131 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25132 ret_ref = (uint64_t)ret_var.inner;
25133 if (ret_var.is_owned) {
25138 int64_t __attribute__((visibility("default"))) TS_UpdateFee_clone_ptr(uint32_t arg) {
25139 LDKUpdateFee arg_conv;
25140 arg_conv.inner = (void*)(arg & (~1));
25141 arg_conv.is_owned = false;
25142 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25143 int64_t ret_val = UpdateFee_clone_ptr(&arg_conv);
25147 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_clone(uint32_t orig) {
25148 LDKUpdateFee orig_conv;
25149 orig_conv.inner = (void*)(orig & (~1));
25150 orig_conv.is_owned = false;
25151 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25152 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
25153 uint64_t ret_ref = 0;
25154 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25155 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25156 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25157 ret_ref = (uint64_t)ret_var.inner;
25158 if (ret_var.is_owned) {
25164 void __attribute__((visibility("default"))) TS_DataLossProtect_free(uint32_t this_obj) {
25165 LDKDataLossProtect this_obj_conv;
25166 this_obj_conv.inner = (void*)(this_obj & (~1));
25167 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25168 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25169 DataLossProtect_free(this_obj_conv);
25172 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_your_last_per_commitment_secret(uint32_t this_ptr) {
25173 LDKDataLossProtect this_ptr_conv;
25174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25175 this_ptr_conv.is_owned = false;
25176 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25177 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
25178 memcpy((uint8_t*)(ret_arr + 4), *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
25182 void __attribute__((visibility("default"))) TS_DataLossProtect_set_your_last_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
25183 LDKDataLossProtect this_ptr_conv;
25184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25185 this_ptr_conv.is_owned = false;
25186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25187 LDKThirtyTwoBytes val_ref;
25188 CHECK(*((uint32_t*)val) == 32);
25189 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
25190 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
25193 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_my_current_per_commitment_point(uint32_t this_ptr) {
25194 LDKDataLossProtect this_ptr_conv;
25195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25196 this_ptr_conv.is_owned = false;
25197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25198 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
25199 memcpy((uint8_t*)(ret_arr + 4), DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
25203 void __attribute__((visibility("default"))) TS_DataLossProtect_set_my_current_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
25204 LDKDataLossProtect this_ptr_conv;
25205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25206 this_ptr_conv.is_owned = false;
25207 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25208 LDKPublicKey val_ref;
25209 CHECK(*((uint32_t*)val) == 33);
25210 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
25211 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
25214 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_new(int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
25215 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
25216 CHECK(*((uint32_t*)your_last_per_commitment_secret_arg) == 32);
25217 memcpy(your_last_per_commitment_secret_arg_ref.data, (uint8_t*)(your_last_per_commitment_secret_arg + 4), 32);
25218 LDKPublicKey my_current_per_commitment_point_arg_ref;
25219 CHECK(*((uint32_t*)my_current_per_commitment_point_arg) == 33);
25220 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(my_current_per_commitment_point_arg + 4), 33);
25221 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
25222 uint64_t ret_ref = 0;
25223 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25224 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25225 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25226 ret_ref = (uint64_t)ret_var.inner;
25227 if (ret_var.is_owned) {
25233 static inline uint64_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
25234 LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
25235 uint64_t ret_ref = 0;
25236 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25237 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25238 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25239 ret_ref = (uint64_t)ret_var.inner;
25240 if (ret_var.is_owned) {
25245 int64_t __attribute__((visibility("default"))) TS_DataLossProtect_clone_ptr(uint32_t arg) {
25246 LDKDataLossProtect arg_conv;
25247 arg_conv.inner = (void*)(arg & (~1));
25248 arg_conv.is_owned = false;
25249 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25250 int64_t ret_val = DataLossProtect_clone_ptr(&arg_conv);
25254 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_clone(uint32_t orig) {
25255 LDKDataLossProtect orig_conv;
25256 orig_conv.inner = (void*)(orig & (~1));
25257 orig_conv.is_owned = false;
25258 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25259 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
25260 uint64_t ret_ref = 0;
25261 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25262 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25263 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25264 ret_ref = (uint64_t)ret_var.inner;
25265 if (ret_var.is_owned) {
25271 void __attribute__((visibility("default"))) TS_ChannelReestablish_free(uint32_t this_obj) {
25272 LDKChannelReestablish this_obj_conv;
25273 this_obj_conv.inner = (void*)(this_obj & (~1));
25274 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25275 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25276 ChannelReestablish_free(this_obj_conv);
25279 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
25280 LDKChannelReestablish this_ptr_conv;
25281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25282 this_ptr_conv.is_owned = false;
25283 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25284 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
25285 memcpy((uint8_t*)(ret_arr + 4), *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
25289 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
25290 LDKChannelReestablish this_ptr_conv;
25291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25292 this_ptr_conv.is_owned = false;
25293 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25294 LDKThirtyTwoBytes val_ref;
25295 CHECK(*((uint32_t*)val) == 32);
25296 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
25297 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
25300 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
25301 LDKChannelReestablish this_ptr_conv;
25302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25303 this_ptr_conv.is_owned = false;
25304 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25305 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
25309 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_local_commitment_number(uint32_t this_ptr, int64_t val) {
25310 LDKChannelReestablish 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 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
25317 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
25318 LDKChannelReestablish this_ptr_conv;
25319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25320 this_ptr_conv.is_owned = false;
25321 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25322 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
25326 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_remote_commitment_number(uint32_t this_ptr, int64_t val) {
25327 LDKChannelReestablish this_ptr_conv;
25328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25329 this_ptr_conv.is_owned = false;
25330 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25331 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
25334 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
25335 LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
25336 uint64_t ret_ref = 0;
25337 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25338 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25339 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25340 ret_ref = (uint64_t)ret_var.inner;
25341 if (ret_var.is_owned) {
25346 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_clone_ptr(uint32_t arg) {
25347 LDKChannelReestablish arg_conv;
25348 arg_conv.inner = (void*)(arg & (~1));
25349 arg_conv.is_owned = false;
25350 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25351 int64_t ret_val = ChannelReestablish_clone_ptr(&arg_conv);
25355 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_clone(uint32_t orig) {
25356 LDKChannelReestablish orig_conv;
25357 orig_conv.inner = (void*)(orig & (~1));
25358 orig_conv.is_owned = false;
25359 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25360 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
25361 uint64_t ret_ref = 0;
25362 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25363 CHECK((((uint64_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 = (uint64_t)ret_var.inner;
25366 if (ret_var.is_owned) {
25372 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_free(uint32_t this_obj) {
25373 LDKAnnouncementSignatures this_obj_conv;
25374 this_obj_conv.inner = (void*)(this_obj & (~1));
25375 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25377 AnnouncementSignatures_free(this_obj_conv);
25380 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
25381 LDKAnnouncementSignatures this_ptr_conv;
25382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25383 this_ptr_conv.is_owned = false;
25384 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25385 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
25386 memcpy((uint8_t*)(ret_arr + 4), *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
25390 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
25391 LDKAnnouncementSignatures this_ptr_conv;
25392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25393 this_ptr_conv.is_owned = false;
25394 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25395 LDKThirtyTwoBytes val_ref;
25396 CHECK(*((uint32_t*)val) == 32);
25397 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
25398 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
25401 int64_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
25402 LDKAnnouncementSignatures this_ptr_conv;
25403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25404 this_ptr_conv.is_owned = false;
25405 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25406 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
25410 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
25411 LDKAnnouncementSignatures this_ptr_conv;
25412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25413 this_ptr_conv.is_owned = false;
25414 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25415 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
25418 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
25419 LDKAnnouncementSignatures this_ptr_conv;
25420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25421 this_ptr_conv.is_owned = false;
25422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25423 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
25424 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
25428 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
25429 LDKAnnouncementSignatures this_ptr_conv;
25430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25431 this_ptr_conv.is_owned = false;
25432 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25433 LDKSignature val_ref;
25434 CHECK(*((uint32_t*)val) == 64);
25435 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
25436 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
25439 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
25440 LDKAnnouncementSignatures this_ptr_conv;
25441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25442 this_ptr_conv.is_owned = false;
25443 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25444 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
25445 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
25449 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
25450 LDKAnnouncementSignatures this_ptr_conv;
25451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25452 this_ptr_conv.is_owned = false;
25453 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25454 LDKSignature val_ref;
25455 CHECK(*((uint32_t*)val) == 64);
25456 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
25457 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
25460 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_new(int8_tArray channel_id_arg, int64_t short_channel_id_arg, int8_tArray node_signature_arg, int8_tArray bitcoin_signature_arg) {
25461 LDKThirtyTwoBytes channel_id_arg_ref;
25462 CHECK(*((uint32_t*)channel_id_arg) == 32);
25463 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
25464 LDKSignature node_signature_arg_ref;
25465 CHECK(*((uint32_t*)node_signature_arg) == 64);
25466 memcpy(node_signature_arg_ref.compact_form, (uint8_t*)(node_signature_arg + 4), 64);
25467 LDKSignature bitcoin_signature_arg_ref;
25468 CHECK(*((uint32_t*)bitcoin_signature_arg) == 64);
25469 memcpy(bitcoin_signature_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_arg + 4), 64);
25470 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
25471 uint64_t ret_ref = 0;
25472 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25473 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25474 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25475 ret_ref = (uint64_t)ret_var.inner;
25476 if (ret_var.is_owned) {
25482 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
25483 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
25484 uint64_t ret_ref = 0;
25485 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25486 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25487 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25488 ret_ref = (uint64_t)ret_var.inner;
25489 if (ret_var.is_owned) {
25494 int64_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_clone_ptr(uint32_t arg) {
25495 LDKAnnouncementSignatures arg_conv;
25496 arg_conv.inner = (void*)(arg & (~1));
25497 arg_conv.is_owned = false;
25498 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25499 int64_t ret_val = AnnouncementSignatures_clone_ptr(&arg_conv);
25503 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
25504 LDKAnnouncementSignatures orig_conv;
25505 orig_conv.inner = (void*)(orig & (~1));
25506 orig_conv.is_owned = false;
25507 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25508 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
25509 uint64_t ret_ref = 0;
25510 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25511 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25512 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25513 ret_ref = (uint64_t)ret_var.inner;
25514 if (ret_var.is_owned) {
25520 void __attribute__((visibility("default"))) TS_NetAddress_free(uint32_t this_ptr) {
25521 if ((this_ptr & 1) != 0) return;
25522 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
25523 CHECK_ACCESS(this_ptr_ptr);
25524 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
25525 FREE((void*)this_ptr);
25526 NetAddress_free(this_ptr_conv);
25529 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
25530 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25531 *ret_copy = NetAddress_clone(arg);
25532 uint64_t ret_ref = (uint64_t)ret_copy;
25535 int64_t __attribute__((visibility("default"))) TS_NetAddress_clone_ptr(uint32_t arg) {
25536 LDKNetAddress* arg_conv = (LDKNetAddress*)arg;
25537 int64_t ret_val = NetAddress_clone_ptr(arg_conv);
25541 uint32_t __attribute__((visibility("default"))) TS_NetAddress_clone(uint32_t orig) {
25542 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
25543 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25544 *ret_copy = NetAddress_clone(orig_conv);
25545 uint64_t ret_ref = (uint64_t)ret_copy;
25549 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
25550 LDKFourBytes addr_ref;
25551 CHECK(*((uint32_t*)addr) == 4);
25552 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 4);
25553 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25554 *ret_copy = NetAddress_ipv4(addr_ref, port);
25555 uint64_t ret_ref = (uint64_t)ret_copy;
25559 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
25560 LDKSixteenBytes addr_ref;
25561 CHECK(*((uint32_t*)addr) == 16);
25562 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 16);
25563 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25564 *ret_copy = NetAddress_ipv6(addr_ref, port);
25565 uint64_t ret_ref = (uint64_t)ret_copy;
25569 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v2(int8_tArray a) {
25570 LDKTwelveBytes a_ref;
25571 CHECK(*((uint32_t*)a) == 12);
25572 memcpy(a_ref.data, (uint8_t*)(a + 4), 12);
25573 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25574 *ret_copy = NetAddress_onion_v2(a_ref);
25575 uint64_t ret_ref = (uint64_t)ret_copy;
25579 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v3(int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
25580 LDKThirtyTwoBytes ed25519_pubkey_ref;
25581 CHECK(*((uint32_t*)ed25519_pubkey) == 32);
25582 memcpy(ed25519_pubkey_ref.data, (uint8_t*)(ed25519_pubkey + 4), 32);
25583 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25584 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
25585 uint64_t ret_ref = (uint64_t)ret_copy;
25589 int8_tArray __attribute__((visibility("default"))) TS_NetAddress_write(uint32_t obj) {
25590 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
25591 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
25592 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25593 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25594 CVec_u8Z_free(ret_var);
25598 uint32_t __attribute__((visibility("default"))) TS_NetAddress_read(int8_tArray ser) {
25599 LDKu8slice ser_ref;
25600 ser_ref.datalen = *((uint32_t*)ser);
25601 ser_ref.data = (int8_t*)(ser + 4);
25602 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
25603 *ret_conv = NetAddress_read(ser_ref);
25604 return (uint64_t)ret_conv;
25607 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_obj) {
25608 LDKUnsignedNodeAnnouncement this_obj_conv;
25609 this_obj_conv.inner = (void*)(this_obj & (~1));
25610 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25611 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25612 UnsignedNodeAnnouncement_free(this_obj_conv);
25615 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
25616 LDKUnsignedNodeAnnouncement this_ptr_conv;
25617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25618 this_ptr_conv.is_owned = false;
25619 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25620 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
25621 uint64_t ret_ref = 0;
25622 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25623 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25624 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25625 ret_ref = (uint64_t)ret_var.inner;
25626 if (ret_var.is_owned) {
25632 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
25633 LDKUnsignedNodeAnnouncement this_ptr_conv;
25634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25635 this_ptr_conv.is_owned = false;
25636 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25637 LDKNodeFeatures val_conv;
25638 val_conv.inner = (void*)(val & (~1));
25639 val_conv.is_owned = (val & 1) || (val == 0);
25640 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25641 val_conv = NodeFeatures_clone(&val_conv);
25642 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
25645 int32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
25646 LDKUnsignedNodeAnnouncement this_ptr_conv;
25647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25648 this_ptr_conv.is_owned = false;
25649 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25650 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
25654 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
25655 LDKUnsignedNodeAnnouncement this_ptr_conv;
25656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25657 this_ptr_conv.is_owned = false;
25658 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25659 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
25662 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
25663 LDKUnsignedNodeAnnouncement this_ptr_conv;
25664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25665 this_ptr_conv.is_owned = false;
25666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25667 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
25668 memcpy((uint8_t*)(ret_arr + 4), UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
25672 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
25673 LDKUnsignedNodeAnnouncement this_ptr_conv;
25674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25675 this_ptr_conv.is_owned = false;
25676 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25677 LDKPublicKey val_ref;
25678 CHECK(*((uint32_t*)val) == 33);
25679 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
25680 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
25683 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
25684 LDKUnsignedNodeAnnouncement this_ptr_conv;
25685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25686 this_ptr_conv.is_owned = false;
25687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25688 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
25689 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
25693 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
25694 LDKUnsignedNodeAnnouncement this_ptr_conv;
25695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25696 this_ptr_conv.is_owned = false;
25697 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25698 LDKThreeBytes val_ref;
25699 CHECK(*((uint32_t*)val) == 3);
25700 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
25701 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
25704 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
25705 LDKUnsignedNodeAnnouncement this_ptr_conv;
25706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25707 this_ptr_conv.is_owned = false;
25708 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25709 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
25710 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
25714 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
25715 LDKUnsignedNodeAnnouncement this_ptr_conv;
25716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25717 this_ptr_conv.is_owned = false;
25718 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25719 LDKThirtyTwoBytes val_ref;
25720 CHECK(*((uint32_t*)val) == 32);
25721 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
25722 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
25725 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
25726 LDKUnsignedNodeAnnouncement this_ptr_conv;
25727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25728 this_ptr_conv.is_owned = false;
25729 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25730 LDKCVec_NetAddressZ val_constr;
25731 val_constr.datalen = *((uint32_t*)val);
25732 if (val_constr.datalen > 0)
25733 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
25735 val_constr.data = NULL;
25736 uint32_t* val_vals = (uint32_t*)(val + 4);
25737 for (size_t m = 0; m < val_constr.datalen; m++) {
25738 uint32_t val_conv_12 = val_vals[m];
25739 void* val_conv_12_ptr = (void*)(((uint64_t)val_conv_12) & ~1);
25740 CHECK_ACCESS(val_conv_12_ptr);
25741 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
25742 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
25743 val_constr.data[m] = val_conv_12_conv;
25745 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
25748 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
25749 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
25750 uint64_t ret_ref = 0;
25751 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25752 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25753 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25754 ret_ref = (uint64_t)ret_var.inner;
25755 if (ret_var.is_owned) {
25760 int64_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint32_t arg) {
25761 LDKUnsignedNodeAnnouncement arg_conv;
25762 arg_conv.inner = (void*)(arg & (~1));
25763 arg_conv.is_owned = false;
25764 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25765 int64_t ret_val = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
25769 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
25770 LDKUnsignedNodeAnnouncement orig_conv;
25771 orig_conv.inner = (void*)(orig & (~1));
25772 orig_conv.is_owned = false;
25773 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25774 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
25775 uint64_t ret_ref = 0;
25776 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25777 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25778 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25779 ret_ref = (uint64_t)ret_var.inner;
25780 if (ret_var.is_owned) {
25786 void __attribute__((visibility("default"))) TS_NodeAnnouncement_free(uint32_t this_obj) {
25787 LDKNodeAnnouncement this_obj_conv;
25788 this_obj_conv.inner = (void*)(this_obj & (~1));
25789 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25790 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25791 NodeAnnouncement_free(this_obj_conv);
25794 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
25795 LDKNodeAnnouncement this_ptr_conv;
25796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25797 this_ptr_conv.is_owned = false;
25798 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25799 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
25800 memcpy((uint8_t*)(ret_arr + 4), NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
25804 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
25805 LDKNodeAnnouncement this_ptr_conv;
25806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25807 this_ptr_conv.is_owned = false;
25808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25809 LDKSignature val_ref;
25810 CHECK(*((uint32_t*)val) == 64);
25811 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
25812 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
25815 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
25816 LDKNodeAnnouncement this_ptr_conv;
25817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25818 this_ptr_conv.is_owned = false;
25819 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25820 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
25821 uint64_t ret_ref = 0;
25822 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25823 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25824 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25825 ret_ref = (uint64_t)ret_var.inner;
25826 if (ret_var.is_owned) {
25832 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
25833 LDKNodeAnnouncement this_ptr_conv;
25834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25835 this_ptr_conv.is_owned = false;
25836 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25837 LDKUnsignedNodeAnnouncement val_conv;
25838 val_conv.inner = (void*)(val & (~1));
25839 val_conv.is_owned = (val & 1) || (val == 0);
25840 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25841 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
25842 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
25845 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
25846 LDKSignature signature_arg_ref;
25847 CHECK(*((uint32_t*)signature_arg) == 64);
25848 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
25849 LDKUnsignedNodeAnnouncement contents_arg_conv;
25850 contents_arg_conv.inner = (void*)(contents_arg & (~1));
25851 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
25852 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
25853 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
25854 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
25855 uint64_t ret_ref = 0;
25856 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25857 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25858 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25859 ret_ref = (uint64_t)ret_var.inner;
25860 if (ret_var.is_owned) {
25866 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
25867 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
25868 uint64_t ret_ref = 0;
25869 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25870 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25871 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25872 ret_ref = (uint64_t)ret_var.inner;
25873 if (ret_var.is_owned) {
25878 int64_t __attribute__((visibility("default"))) TS_NodeAnnouncement_clone_ptr(uint32_t arg) {
25879 LDKNodeAnnouncement arg_conv;
25880 arg_conv.inner = (void*)(arg & (~1));
25881 arg_conv.is_owned = false;
25882 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25883 int64_t ret_val = NodeAnnouncement_clone_ptr(&arg_conv);
25887 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_clone(uint32_t orig) {
25888 LDKNodeAnnouncement orig_conv;
25889 orig_conv.inner = (void*)(orig & (~1));
25890 orig_conv.is_owned = false;
25891 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25892 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
25893 uint64_t ret_ref = 0;
25894 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25895 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25896 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25897 ret_ref = (uint64_t)ret_var.inner;
25898 if (ret_var.is_owned) {
25904 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_obj) {
25905 LDKUnsignedChannelAnnouncement this_obj_conv;
25906 this_obj_conv.inner = (void*)(this_obj & (~1));
25907 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25908 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25909 UnsignedChannelAnnouncement_free(this_obj_conv);
25912 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
25913 LDKUnsignedChannelAnnouncement this_ptr_conv;
25914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25915 this_ptr_conv.is_owned = false;
25916 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25917 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
25918 uint64_t ret_ref = 0;
25919 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25920 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25921 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25922 ret_ref = (uint64_t)ret_var.inner;
25923 if (ret_var.is_owned) {
25929 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
25930 LDKUnsignedChannelAnnouncement this_ptr_conv;
25931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25932 this_ptr_conv.is_owned = false;
25933 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25934 LDKChannelFeatures val_conv;
25935 val_conv.inner = (void*)(val & (~1));
25936 val_conv.is_owned = (val & 1) || (val == 0);
25937 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25938 val_conv = ChannelFeatures_clone(&val_conv);
25939 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
25942 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
25943 LDKUnsignedChannelAnnouncement this_ptr_conv;
25944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25945 this_ptr_conv.is_owned = false;
25946 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25947 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
25948 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
25952 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
25953 LDKUnsignedChannelAnnouncement this_ptr_conv;
25954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25955 this_ptr_conv.is_owned = false;
25956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25957 LDKThirtyTwoBytes val_ref;
25958 CHECK(*((uint32_t*)val) == 32);
25959 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
25960 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
25963 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
25964 LDKUnsignedChannelAnnouncement this_ptr_conv;
25965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25966 this_ptr_conv.is_owned = false;
25967 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25968 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
25972 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
25973 LDKUnsignedChannelAnnouncement this_ptr_conv;
25974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25975 this_ptr_conv.is_owned = false;
25976 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25977 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
25980 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
25981 LDKUnsignedChannelAnnouncement this_ptr_conv;
25982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25983 this_ptr_conv.is_owned = false;
25984 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25985 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
25986 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
25990 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
25991 LDKUnsignedChannelAnnouncement this_ptr_conv;
25992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25993 this_ptr_conv.is_owned = false;
25994 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25995 LDKPublicKey val_ref;
25996 CHECK(*((uint32_t*)val) == 33);
25997 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
25998 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
26001 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
26002 LDKUnsignedChannelAnnouncement this_ptr_conv;
26003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26004 this_ptr_conv.is_owned = false;
26005 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26006 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
26007 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
26011 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
26012 LDKUnsignedChannelAnnouncement this_ptr_conv;
26013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26014 this_ptr_conv.is_owned = false;
26015 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26016 LDKPublicKey val_ref;
26017 CHECK(*((uint32_t*)val) == 33);
26018 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
26019 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
26022 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
26023 LDKUnsignedChannelAnnouncement this_ptr_conv;
26024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26025 this_ptr_conv.is_owned = false;
26026 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26027 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
26028 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
26032 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
26033 LDKUnsignedChannelAnnouncement this_ptr_conv;
26034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26035 this_ptr_conv.is_owned = false;
26036 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26037 LDKPublicKey val_ref;
26038 CHECK(*((uint32_t*)val) == 33);
26039 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
26040 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
26043 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
26044 LDKUnsignedChannelAnnouncement this_ptr_conv;
26045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26046 this_ptr_conv.is_owned = false;
26047 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26048 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
26049 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
26053 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
26054 LDKUnsignedChannelAnnouncement this_ptr_conv;
26055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26056 this_ptr_conv.is_owned = false;
26057 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26058 LDKPublicKey val_ref;
26059 CHECK(*((uint32_t*)val) == 33);
26060 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
26061 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
26064 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
26065 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
26066 uint64_t ret_ref = 0;
26067 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26068 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26069 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26070 ret_ref = (uint64_t)ret_var.inner;
26071 if (ret_var.is_owned) {
26076 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint32_t arg) {
26077 LDKUnsignedChannelAnnouncement arg_conv;
26078 arg_conv.inner = (void*)(arg & (~1));
26079 arg_conv.is_owned = false;
26080 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26081 int64_t ret_val = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
26085 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
26086 LDKUnsignedChannelAnnouncement orig_conv;
26087 orig_conv.inner = (void*)(orig & (~1));
26088 orig_conv.is_owned = false;
26089 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26090 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
26091 uint64_t ret_ref = 0;
26092 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26093 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26094 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26095 ret_ref = (uint64_t)ret_var.inner;
26096 if (ret_var.is_owned) {
26102 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_free(uint32_t this_obj) {
26103 LDKChannelAnnouncement this_obj_conv;
26104 this_obj_conv.inner = (void*)(this_obj & (~1));
26105 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26106 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26107 ChannelAnnouncement_free(this_obj_conv);
26110 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
26111 LDKChannelAnnouncement this_ptr_conv;
26112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26113 this_ptr_conv.is_owned = false;
26114 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26115 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
26116 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
26120 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
26121 LDKChannelAnnouncement this_ptr_conv;
26122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26123 this_ptr_conv.is_owned = false;
26124 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26125 LDKSignature val_ref;
26126 CHECK(*((uint32_t*)val) == 64);
26127 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
26128 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
26131 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
26132 LDKChannelAnnouncement this_ptr_conv;
26133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26134 this_ptr_conv.is_owned = false;
26135 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26136 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
26137 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
26141 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
26142 LDKChannelAnnouncement this_ptr_conv;
26143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26144 this_ptr_conv.is_owned = false;
26145 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26146 LDKSignature val_ref;
26147 CHECK(*((uint32_t*)val) == 64);
26148 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
26149 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
26152 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
26153 LDKChannelAnnouncement this_ptr_conv;
26154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26155 this_ptr_conv.is_owned = false;
26156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26157 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
26158 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
26162 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
26163 LDKChannelAnnouncement this_ptr_conv;
26164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26165 this_ptr_conv.is_owned = false;
26166 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26167 LDKSignature val_ref;
26168 CHECK(*((uint32_t*)val) == 64);
26169 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
26170 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
26173 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
26174 LDKChannelAnnouncement this_ptr_conv;
26175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26176 this_ptr_conv.is_owned = false;
26177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26178 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
26179 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
26183 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
26184 LDKChannelAnnouncement this_ptr_conv;
26185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26186 this_ptr_conv.is_owned = false;
26187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26188 LDKSignature val_ref;
26189 CHECK(*((uint32_t*)val) == 64);
26190 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
26191 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
26194 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
26195 LDKChannelAnnouncement this_ptr_conv;
26196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26197 this_ptr_conv.is_owned = false;
26198 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26199 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
26200 uint64_t ret_ref = 0;
26201 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26202 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26203 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26204 ret_ref = (uint64_t)ret_var.inner;
26205 if (ret_var.is_owned) {
26211 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
26212 LDKChannelAnnouncement this_ptr_conv;
26213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26214 this_ptr_conv.is_owned = false;
26215 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26216 LDKUnsignedChannelAnnouncement val_conv;
26217 val_conv.inner = (void*)(val & (~1));
26218 val_conv.is_owned = (val & 1) || (val == 0);
26219 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26220 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
26221 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
26224 uint32_t __attribute__((visibility("default"))) 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) {
26225 LDKSignature node_signature_1_arg_ref;
26226 CHECK(*((uint32_t*)node_signature_1_arg) == 64);
26227 memcpy(node_signature_1_arg_ref.compact_form, (uint8_t*)(node_signature_1_arg + 4), 64);
26228 LDKSignature node_signature_2_arg_ref;
26229 CHECK(*((uint32_t*)node_signature_2_arg) == 64);
26230 memcpy(node_signature_2_arg_ref.compact_form, (uint8_t*)(node_signature_2_arg + 4), 64);
26231 LDKSignature bitcoin_signature_1_arg_ref;
26232 CHECK(*((uint32_t*)bitcoin_signature_1_arg) == 64);
26233 memcpy(bitcoin_signature_1_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_1_arg + 4), 64);
26234 LDKSignature bitcoin_signature_2_arg_ref;
26235 CHECK(*((uint32_t*)bitcoin_signature_2_arg) == 64);
26236 memcpy(bitcoin_signature_2_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_2_arg + 4), 64);
26237 LDKUnsignedChannelAnnouncement contents_arg_conv;
26238 contents_arg_conv.inner = (void*)(contents_arg & (~1));
26239 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
26240 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
26241 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
26242 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);
26243 uint64_t ret_ref = 0;
26244 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26245 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26246 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26247 ret_ref = (uint64_t)ret_var.inner;
26248 if (ret_var.is_owned) {
26254 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
26255 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
26256 uint64_t ret_ref = 0;
26257 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26258 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26259 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26260 ret_ref = (uint64_t)ret_var.inner;
26261 if (ret_var.is_owned) {
26266 int64_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_clone_ptr(uint32_t arg) {
26267 LDKChannelAnnouncement arg_conv;
26268 arg_conv.inner = (void*)(arg & (~1));
26269 arg_conv.is_owned = false;
26270 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26271 int64_t ret_val = ChannelAnnouncement_clone_ptr(&arg_conv);
26275 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
26276 LDKChannelAnnouncement orig_conv;
26277 orig_conv.inner = (void*)(orig & (~1));
26278 orig_conv.is_owned = false;
26279 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26280 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
26281 uint64_t ret_ref = 0;
26282 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26283 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26284 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26285 ret_ref = (uint64_t)ret_var.inner;
26286 if (ret_var.is_owned) {
26292 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_free(uint32_t this_obj) {
26293 LDKUnsignedChannelUpdate this_obj_conv;
26294 this_obj_conv.inner = (void*)(this_obj & (~1));
26295 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26296 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26297 UnsignedChannelUpdate_free(this_obj_conv);
26300 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
26301 LDKUnsignedChannelUpdate this_ptr_conv;
26302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26303 this_ptr_conv.is_owned = false;
26304 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26305 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
26306 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
26310 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26311 LDKUnsignedChannelUpdate this_ptr_conv;
26312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26313 this_ptr_conv.is_owned = false;
26314 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26315 LDKThirtyTwoBytes val_ref;
26316 CHECK(*((uint32_t*)val) == 32);
26317 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
26318 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
26321 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
26322 LDKUnsignedChannelUpdate this_ptr_conv;
26323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26324 this_ptr_conv.is_owned = false;
26325 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26326 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
26330 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
26331 LDKUnsignedChannelUpdate this_ptr_conv;
26332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26333 this_ptr_conv.is_owned = false;
26334 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26335 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
26338 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
26339 LDKUnsignedChannelUpdate this_ptr_conv;
26340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26341 this_ptr_conv.is_owned = false;
26342 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26343 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
26347 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
26348 LDKUnsignedChannelUpdate this_ptr_conv;
26349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26350 this_ptr_conv.is_owned = false;
26351 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26352 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
26355 int8_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
26356 LDKUnsignedChannelUpdate this_ptr_conv;
26357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26358 this_ptr_conv.is_owned = false;
26359 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26360 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
26364 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
26365 LDKUnsignedChannelUpdate this_ptr_conv;
26366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26367 this_ptr_conv.is_owned = false;
26368 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26369 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
26372 int16_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
26373 LDKUnsignedChannelUpdate this_ptr_conv;
26374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26375 this_ptr_conv.is_owned = false;
26376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26377 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
26381 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
26382 LDKUnsignedChannelUpdate this_ptr_conv;
26383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26384 this_ptr_conv.is_owned = false;
26385 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26386 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
26389 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
26390 LDKUnsignedChannelUpdate this_ptr_conv;
26391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26392 this_ptr_conv.is_owned = false;
26393 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26394 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
26398 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
26399 LDKUnsignedChannelUpdate this_ptr_conv;
26400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26401 this_ptr_conv.is_owned = false;
26402 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26403 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
26406 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
26407 LDKUnsignedChannelUpdate this_ptr_conv;
26408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26409 this_ptr_conv.is_owned = false;
26410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26411 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
26415 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
26416 LDKUnsignedChannelUpdate this_ptr_conv;
26417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26418 this_ptr_conv.is_owned = false;
26419 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26420 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
26423 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
26424 LDKUnsignedChannelUpdate this_ptr_conv;
26425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26426 this_ptr_conv.is_owned = false;
26427 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26428 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
26432 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
26433 LDKUnsignedChannelUpdate this_ptr_conv;
26434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26435 this_ptr_conv.is_owned = false;
26436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26437 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
26440 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
26441 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
26442 uint64_t ret_ref = 0;
26443 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26444 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26445 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26446 ret_ref = (uint64_t)ret_var.inner;
26447 if (ret_var.is_owned) {
26452 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_clone_ptr(uint32_t arg) {
26453 LDKUnsignedChannelUpdate arg_conv;
26454 arg_conv.inner = (void*)(arg & (~1));
26455 arg_conv.is_owned = false;
26456 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26457 int64_t ret_val = UnsignedChannelUpdate_clone_ptr(&arg_conv);
26461 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
26462 LDKUnsignedChannelUpdate orig_conv;
26463 orig_conv.inner = (void*)(orig & (~1));
26464 orig_conv.is_owned = false;
26465 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26466 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
26467 uint64_t ret_ref = 0;
26468 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26469 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26470 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26471 ret_ref = (uint64_t)ret_var.inner;
26472 if (ret_var.is_owned) {
26478 void __attribute__((visibility("default"))) TS_ChannelUpdate_free(uint32_t this_obj) {
26479 LDKChannelUpdate this_obj_conv;
26480 this_obj_conv.inner = (void*)(this_obj & (~1));
26481 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26483 ChannelUpdate_free(this_obj_conv);
26486 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
26487 LDKChannelUpdate this_ptr_conv;
26488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26489 this_ptr_conv.is_owned = false;
26490 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26491 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
26492 memcpy((uint8_t*)(ret_arr + 4), ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
26496 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
26497 LDKChannelUpdate this_ptr_conv;
26498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26499 this_ptr_conv.is_owned = false;
26500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26501 LDKSignature val_ref;
26502 CHECK(*((uint32_t*)val) == 64);
26503 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
26504 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
26507 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
26508 LDKChannelUpdate this_ptr_conv;
26509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26510 this_ptr_conv.is_owned = false;
26511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26512 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
26513 uint64_t ret_ref = 0;
26514 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26515 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26516 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26517 ret_ref = (uint64_t)ret_var.inner;
26518 if (ret_var.is_owned) {
26524 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
26525 LDKChannelUpdate this_ptr_conv;
26526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26527 this_ptr_conv.is_owned = false;
26528 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26529 LDKUnsignedChannelUpdate val_conv;
26530 val_conv.inner = (void*)(val & (~1));
26531 val_conv.is_owned = (val & 1) || (val == 0);
26532 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26533 val_conv = UnsignedChannelUpdate_clone(&val_conv);
26534 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
26537 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
26538 LDKSignature signature_arg_ref;
26539 CHECK(*((uint32_t*)signature_arg) == 64);
26540 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
26541 LDKUnsignedChannelUpdate contents_arg_conv;
26542 contents_arg_conv.inner = (void*)(contents_arg & (~1));
26543 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
26544 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
26545 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
26546 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
26547 uint64_t ret_ref = 0;
26548 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26549 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26550 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26551 ret_ref = (uint64_t)ret_var.inner;
26552 if (ret_var.is_owned) {
26558 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
26559 LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
26560 uint64_t ret_ref = 0;
26561 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26562 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26563 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26564 ret_ref = (uint64_t)ret_var.inner;
26565 if (ret_var.is_owned) {
26570 int64_t __attribute__((visibility("default"))) TS_ChannelUpdate_clone_ptr(uint32_t arg) {
26571 LDKChannelUpdate arg_conv;
26572 arg_conv.inner = (void*)(arg & (~1));
26573 arg_conv.is_owned = false;
26574 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26575 int64_t ret_val = ChannelUpdate_clone_ptr(&arg_conv);
26579 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_clone(uint32_t orig) {
26580 LDKChannelUpdate orig_conv;
26581 orig_conv.inner = (void*)(orig & (~1));
26582 orig_conv.is_owned = false;
26583 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26584 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
26585 uint64_t ret_ref = 0;
26586 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26587 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26588 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26589 ret_ref = (uint64_t)ret_var.inner;
26590 if (ret_var.is_owned) {
26596 void __attribute__((visibility("default"))) TS_QueryChannelRange_free(uint32_t this_obj) {
26597 LDKQueryChannelRange this_obj_conv;
26598 this_obj_conv.inner = (void*)(this_obj & (~1));
26599 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26600 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26601 QueryChannelRange_free(this_obj_conv);
26604 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
26605 LDKQueryChannelRange this_ptr_conv;
26606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26607 this_ptr_conv.is_owned = false;
26608 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26609 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
26610 memcpy((uint8_t*)(ret_arr + 4), *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
26614 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26615 LDKQueryChannelRange this_ptr_conv;
26616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26617 this_ptr_conv.is_owned = false;
26618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26619 LDKThirtyTwoBytes val_ref;
26620 CHECK(*((uint32_t*)val) == 32);
26621 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
26622 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
26625 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
26626 LDKQueryChannelRange this_ptr_conv;
26627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26628 this_ptr_conv.is_owned = false;
26629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26630 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
26634 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
26635 LDKQueryChannelRange this_ptr_conv;
26636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26637 this_ptr_conv.is_owned = false;
26638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26639 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
26642 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
26643 LDKQueryChannelRange this_ptr_conv;
26644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26645 this_ptr_conv.is_owned = false;
26646 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26647 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
26651 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
26652 LDKQueryChannelRange this_ptr_conv;
26653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26654 this_ptr_conv.is_owned = false;
26655 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26656 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
26659 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
26660 LDKThirtyTwoBytes chain_hash_arg_ref;
26661 CHECK(*((uint32_t*)chain_hash_arg) == 32);
26662 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
26663 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
26664 uint64_t ret_ref = 0;
26665 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26666 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26667 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26668 ret_ref = (uint64_t)ret_var.inner;
26669 if (ret_var.is_owned) {
26675 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
26676 LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
26677 uint64_t ret_ref = 0;
26678 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26679 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26680 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26681 ret_ref = (uint64_t)ret_var.inner;
26682 if (ret_var.is_owned) {
26687 int64_t __attribute__((visibility("default"))) TS_QueryChannelRange_clone_ptr(uint32_t arg) {
26688 LDKQueryChannelRange arg_conv;
26689 arg_conv.inner = (void*)(arg & (~1));
26690 arg_conv.is_owned = false;
26691 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26692 int64_t ret_val = QueryChannelRange_clone_ptr(&arg_conv);
26696 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_clone(uint32_t orig) {
26697 LDKQueryChannelRange orig_conv;
26698 orig_conv.inner = (void*)(orig & (~1));
26699 orig_conv.is_owned = false;
26700 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26701 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
26702 uint64_t ret_ref = 0;
26703 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26704 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26705 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26706 ret_ref = (uint64_t)ret_var.inner;
26707 if (ret_var.is_owned) {
26713 void __attribute__((visibility("default"))) TS_ReplyChannelRange_free(uint32_t this_obj) {
26714 LDKReplyChannelRange this_obj_conv;
26715 this_obj_conv.inner = (void*)(this_obj & (~1));
26716 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26717 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26718 ReplyChannelRange_free(this_obj_conv);
26721 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
26722 LDKReplyChannelRange this_ptr_conv;
26723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26724 this_ptr_conv.is_owned = false;
26725 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26726 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
26727 memcpy((uint8_t*)(ret_arr + 4), *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
26731 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26732 LDKReplyChannelRange this_ptr_conv;
26733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26734 this_ptr_conv.is_owned = false;
26735 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26736 LDKThirtyTwoBytes val_ref;
26737 CHECK(*((uint32_t*)val) == 32);
26738 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
26739 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
26742 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
26743 LDKReplyChannelRange this_ptr_conv;
26744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26745 this_ptr_conv.is_owned = false;
26746 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26747 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
26751 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
26752 LDKReplyChannelRange this_ptr_conv;
26753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26754 this_ptr_conv.is_owned = false;
26755 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26756 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
26759 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
26760 LDKReplyChannelRange this_ptr_conv;
26761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26762 this_ptr_conv.is_owned = false;
26763 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26764 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
26768 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
26769 LDKReplyChannelRange this_ptr_conv;
26770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26771 this_ptr_conv.is_owned = false;
26772 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26773 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
26776 jboolean __attribute__((visibility("default"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
26777 LDKReplyChannelRange this_ptr_conv;
26778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26779 this_ptr_conv.is_owned = false;
26780 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26781 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
26785 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
26786 LDKReplyChannelRange this_ptr_conv;
26787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26788 this_ptr_conv.is_owned = false;
26789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26790 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
26793 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
26794 LDKReplyChannelRange this_ptr_conv;
26795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26796 this_ptr_conv.is_owned = false;
26797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26798 LDKCVec_u64Z val_constr;
26799 val_constr.datalen = *((uint32_t*)val);
26800 if (val_constr.datalen > 0)
26801 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26803 val_constr.data = NULL;
26804 int64_t* val_vals = (int64_t*)(val + 4);
26805 for (size_t i = 0; i < val_constr.datalen; i++) {
26806 int64_t val_conv_8 = val_vals[i];
26807 val_constr.data[i] = val_conv_8;
26809 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
26812 uint32_t __attribute__((visibility("default"))) 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) {
26813 LDKThirtyTwoBytes chain_hash_arg_ref;
26814 CHECK(*((uint32_t*)chain_hash_arg) == 32);
26815 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
26816 LDKCVec_u64Z short_channel_ids_arg_constr;
26817 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
26818 if (short_channel_ids_arg_constr.datalen > 0)
26819 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26821 short_channel_ids_arg_constr.data = NULL;
26822 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
26823 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
26824 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
26825 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
26827 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
26828 uint64_t ret_ref = 0;
26829 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26830 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26831 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26832 ret_ref = (uint64_t)ret_var.inner;
26833 if (ret_var.is_owned) {
26839 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
26840 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
26841 uint64_t ret_ref = 0;
26842 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26843 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26844 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26845 ret_ref = (uint64_t)ret_var.inner;
26846 if (ret_var.is_owned) {
26851 int64_t __attribute__((visibility("default"))) TS_ReplyChannelRange_clone_ptr(uint32_t arg) {
26852 LDKReplyChannelRange arg_conv;
26853 arg_conv.inner = (void*)(arg & (~1));
26854 arg_conv.is_owned = false;
26855 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26856 int64_t ret_val = ReplyChannelRange_clone_ptr(&arg_conv);
26860 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_clone(uint32_t orig) {
26861 LDKReplyChannelRange orig_conv;
26862 orig_conv.inner = (void*)(orig & (~1));
26863 orig_conv.is_owned = false;
26864 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26865 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
26866 uint64_t ret_ref = 0;
26867 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26868 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26869 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26870 ret_ref = (uint64_t)ret_var.inner;
26871 if (ret_var.is_owned) {
26877 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_free(uint32_t this_obj) {
26878 LDKQueryShortChannelIds this_obj_conv;
26879 this_obj_conv.inner = (void*)(this_obj & (~1));
26880 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26881 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26882 QueryShortChannelIds_free(this_obj_conv);
26885 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
26886 LDKQueryShortChannelIds this_ptr_conv;
26887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26888 this_ptr_conv.is_owned = false;
26889 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26890 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
26891 memcpy((uint8_t*)(ret_arr + 4), *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
26895 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26896 LDKQueryShortChannelIds this_ptr_conv;
26897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26898 this_ptr_conv.is_owned = false;
26899 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26900 LDKThirtyTwoBytes val_ref;
26901 CHECK(*((uint32_t*)val) == 32);
26902 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
26903 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
26906 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
26907 LDKQueryShortChannelIds this_ptr_conv;
26908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26909 this_ptr_conv.is_owned = false;
26910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26911 LDKCVec_u64Z val_constr;
26912 val_constr.datalen = *((uint32_t*)val);
26913 if (val_constr.datalen > 0)
26914 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26916 val_constr.data = NULL;
26917 int64_t* val_vals = (int64_t*)(val + 4);
26918 for (size_t i = 0; i < val_constr.datalen; i++) {
26919 int64_t val_conv_8 = val_vals[i];
26920 val_constr.data[i] = val_conv_8;
26922 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
26925 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
26926 LDKThirtyTwoBytes chain_hash_arg_ref;
26927 CHECK(*((uint32_t*)chain_hash_arg) == 32);
26928 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
26929 LDKCVec_u64Z short_channel_ids_arg_constr;
26930 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
26931 if (short_channel_ids_arg_constr.datalen > 0)
26932 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26934 short_channel_ids_arg_constr.data = NULL;
26935 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
26936 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
26937 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
26938 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
26940 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
26941 uint64_t ret_ref = 0;
26942 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26943 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26944 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26945 ret_ref = (uint64_t)ret_var.inner;
26946 if (ret_var.is_owned) {
26952 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
26953 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
26954 uint64_t ret_ref = 0;
26955 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26956 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26957 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26958 ret_ref = (uint64_t)ret_var.inner;
26959 if (ret_var.is_owned) {
26964 int64_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_clone_ptr(uint32_t arg) {
26965 LDKQueryShortChannelIds arg_conv;
26966 arg_conv.inner = (void*)(arg & (~1));
26967 arg_conv.is_owned = false;
26968 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26969 int64_t ret_val = QueryShortChannelIds_clone_ptr(&arg_conv);
26973 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
26974 LDKQueryShortChannelIds orig_conv;
26975 orig_conv.inner = (void*)(orig & (~1));
26976 orig_conv.is_owned = false;
26977 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26978 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
26979 uint64_t ret_ref = 0;
26980 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26981 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26982 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26983 ret_ref = (uint64_t)ret_var.inner;
26984 if (ret_var.is_owned) {
26990 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_obj) {
26991 LDKReplyShortChannelIdsEnd this_obj_conv;
26992 this_obj_conv.inner = (void*)(this_obj & (~1));
26993 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26994 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26995 ReplyShortChannelIdsEnd_free(this_obj_conv);
26998 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
26999 LDKReplyShortChannelIdsEnd this_ptr_conv;
27000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27001 this_ptr_conv.is_owned = false;
27002 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27003 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
27004 memcpy((uint8_t*)(ret_arr + 4), *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
27008 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
27009 LDKReplyShortChannelIdsEnd this_ptr_conv;
27010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27011 this_ptr_conv.is_owned = false;
27012 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27013 LDKThirtyTwoBytes val_ref;
27014 CHECK(*((uint32_t*)val) == 32);
27015 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
27016 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
27019 jboolean __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
27020 LDKReplyShortChannelIdsEnd this_ptr_conv;
27021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27022 this_ptr_conv.is_owned = false;
27023 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27024 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
27028 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
27029 LDKReplyShortChannelIdsEnd this_ptr_conv;
27030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27031 this_ptr_conv.is_owned = false;
27032 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27033 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
27036 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
27037 LDKThirtyTwoBytes chain_hash_arg_ref;
27038 CHECK(*((uint32_t*)chain_hash_arg) == 32);
27039 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
27040 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
27041 uint64_t ret_ref = 0;
27042 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27043 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27044 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27045 ret_ref = (uint64_t)ret_var.inner;
27046 if (ret_var.is_owned) {
27052 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
27053 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
27054 uint64_t ret_ref = 0;
27055 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27056 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27057 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27058 ret_ref = (uint64_t)ret_var.inner;
27059 if (ret_var.is_owned) {
27064 int64_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint32_t arg) {
27065 LDKReplyShortChannelIdsEnd arg_conv;
27066 arg_conv.inner = (void*)(arg & (~1));
27067 arg_conv.is_owned = false;
27068 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27069 int64_t ret_val = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
27073 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
27074 LDKReplyShortChannelIdsEnd orig_conv;
27075 orig_conv.inner = (void*)(orig & (~1));
27076 orig_conv.is_owned = false;
27077 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27078 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
27079 uint64_t ret_ref = 0;
27080 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27081 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27082 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27083 ret_ref = (uint64_t)ret_var.inner;
27084 if (ret_var.is_owned) {
27090 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_free(uint32_t this_obj) {
27091 LDKGossipTimestampFilter this_obj_conv;
27092 this_obj_conv.inner = (void*)(this_obj & (~1));
27093 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27095 GossipTimestampFilter_free(this_obj_conv);
27098 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
27099 LDKGossipTimestampFilter this_ptr_conv;
27100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27101 this_ptr_conv.is_owned = false;
27102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27103 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
27104 memcpy((uint8_t*)(ret_arr + 4), *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
27108 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
27109 LDKGossipTimestampFilter this_ptr_conv;
27110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27111 this_ptr_conv.is_owned = false;
27112 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27113 LDKThirtyTwoBytes val_ref;
27114 CHECK(*((uint32_t*)val) == 32);
27115 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
27116 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
27119 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
27120 LDKGossipTimestampFilter this_ptr_conv;
27121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27122 this_ptr_conv.is_owned = false;
27123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27124 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
27128 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
27129 LDKGossipTimestampFilter this_ptr_conv;
27130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27131 this_ptr_conv.is_owned = false;
27132 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27133 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
27136 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
27137 LDKGossipTimestampFilter this_ptr_conv;
27138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27139 this_ptr_conv.is_owned = false;
27140 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27141 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
27145 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
27146 LDKGossipTimestampFilter this_ptr_conv;
27147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27148 this_ptr_conv.is_owned = false;
27149 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27150 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
27153 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
27154 LDKThirtyTwoBytes chain_hash_arg_ref;
27155 CHECK(*((uint32_t*)chain_hash_arg) == 32);
27156 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
27157 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
27158 uint64_t ret_ref = 0;
27159 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27160 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27161 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27162 ret_ref = (uint64_t)ret_var.inner;
27163 if (ret_var.is_owned) {
27169 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
27170 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
27171 uint64_t ret_ref = 0;
27172 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27173 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27174 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27175 ret_ref = (uint64_t)ret_var.inner;
27176 if (ret_var.is_owned) {
27181 int64_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_clone_ptr(uint32_t arg) {
27182 LDKGossipTimestampFilter arg_conv;
27183 arg_conv.inner = (void*)(arg & (~1));
27184 arg_conv.is_owned = false;
27185 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27186 int64_t ret_val = GossipTimestampFilter_clone_ptr(&arg_conv);
27190 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
27191 LDKGossipTimestampFilter orig_conv;
27192 orig_conv.inner = (void*)(orig & (~1));
27193 orig_conv.is_owned = false;
27194 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27195 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
27196 uint64_t ret_ref = 0;
27197 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27198 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27199 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27200 ret_ref = (uint64_t)ret_var.inner;
27201 if (ret_var.is_owned) {
27207 void __attribute__((visibility("default"))) TS_ErrorAction_free(uint32_t this_ptr) {
27208 if ((this_ptr & 1) != 0) return;
27209 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
27210 CHECK_ACCESS(this_ptr_ptr);
27211 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
27212 FREE((void*)this_ptr);
27213 ErrorAction_free(this_ptr_conv);
27216 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
27217 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
27218 *ret_copy = ErrorAction_clone(arg);
27219 uint64_t ret_ref = (uint64_t)ret_copy;
27222 int64_t __attribute__((visibility("default"))) TS_ErrorAction_clone_ptr(uint32_t arg) {
27223 LDKErrorAction* arg_conv = (LDKErrorAction*)arg;
27224 int64_t ret_val = ErrorAction_clone_ptr(arg_conv);
27228 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_clone(uint32_t orig) {
27229 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
27230 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
27231 *ret_copy = ErrorAction_clone(orig_conv);
27232 uint64_t ret_ref = (uint64_t)ret_copy;
27236 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_disconnect_peer(uint32_t msg) {
27237 LDKErrorMessage msg_conv;
27238 msg_conv.inner = (void*)(msg & (~1));
27239 msg_conv.is_owned = (msg & 1) || (msg == 0);
27240 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
27241 msg_conv = ErrorMessage_clone(&msg_conv);
27242 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
27243 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
27244 uint64_t ret_ref = (uint64_t)ret_copy;
27248 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_error() {
27249 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
27250 *ret_copy = ErrorAction_ignore_error();
27251 uint64_t ret_ref = (uint64_t)ret_copy;
27255 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
27256 LDKLevel a_conv = LDKLevel_from_js(a);
27257 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
27258 *ret_copy = ErrorAction_ignore_and_log(a_conv);
27259 uint64_t ret_ref = (uint64_t)ret_copy;
27263 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_duplicate_gossip() {
27264 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
27265 *ret_copy = ErrorAction_ignore_duplicate_gossip();
27266 uint64_t ret_ref = (uint64_t)ret_copy;
27270 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_send_error_message(uint32_t msg) {
27271 LDKErrorMessage msg_conv;
27272 msg_conv.inner = (void*)(msg & (~1));
27273 msg_conv.is_owned = (msg & 1) || (msg == 0);
27274 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
27275 msg_conv = ErrorMessage_clone(&msg_conv);
27276 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
27277 *ret_copy = ErrorAction_send_error_message(msg_conv);
27278 uint64_t ret_ref = (uint64_t)ret_copy;
27282 void __attribute__((visibility("default"))) TS_LightningError_free(uint32_t this_obj) {
27283 LDKLightningError this_obj_conv;
27284 this_obj_conv.inner = (void*)(this_obj & (~1));
27285 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27286 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27287 LightningError_free(this_obj_conv);
27290 jstring __attribute__((visibility("default"))) TS_LightningError_get_err(uint32_t this_ptr) {
27291 LDKLightningError this_ptr_conv;
27292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27293 this_ptr_conv.is_owned = false;
27294 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27295 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
27296 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
27301 void __attribute__((visibility("default"))) TS_LightningError_set_err(uint32_t this_ptr, jstring val) {
27302 LDKLightningError this_ptr_conv;
27303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27304 this_ptr_conv.is_owned = false;
27305 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27306 LDKStr val_conv = str_ref_to_owned_c(val);
27307 LightningError_set_err(&this_ptr_conv, val_conv);
27310 uint32_t __attribute__((visibility("default"))) TS_LightningError_get_action(uint32_t this_ptr) {
27311 LDKLightningError this_ptr_conv;
27312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27313 this_ptr_conv.is_owned = false;
27314 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27315 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
27316 *ret_copy = LightningError_get_action(&this_ptr_conv);
27317 uint64_t ret_ref = (uint64_t)ret_copy;
27321 void __attribute__((visibility("default"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
27322 LDKLightningError this_ptr_conv;
27323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27324 this_ptr_conv.is_owned = false;
27325 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27326 void* val_ptr = (void*)(((uint64_t)val) & ~1);
27327 CHECK_ACCESS(val_ptr);
27328 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
27329 val_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)val) & ~1));
27330 LightningError_set_action(&this_ptr_conv, val_conv);
27333 uint32_t __attribute__((visibility("default"))) TS_LightningError_new(jstring err_arg, uint32_t action_arg) {
27334 LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
27335 void* action_arg_ptr = (void*)(((uint64_t)action_arg) & ~1);
27336 CHECK_ACCESS(action_arg_ptr);
27337 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
27338 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action_arg) & ~1));
27339 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
27340 uint64_t ret_ref = 0;
27341 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27342 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27343 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27344 ret_ref = (uint64_t)ret_var.inner;
27345 if (ret_var.is_owned) {
27351 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
27352 LDKLightningError ret_var = LightningError_clone(arg);
27353 uint64_t ret_ref = 0;
27354 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27355 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27356 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27357 ret_ref = (uint64_t)ret_var.inner;
27358 if (ret_var.is_owned) {
27363 int64_t __attribute__((visibility("default"))) TS_LightningError_clone_ptr(uint32_t arg) {
27364 LDKLightningError arg_conv;
27365 arg_conv.inner = (void*)(arg & (~1));
27366 arg_conv.is_owned = false;
27367 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27368 int64_t ret_val = LightningError_clone_ptr(&arg_conv);
27372 uint32_t __attribute__((visibility("default"))) TS_LightningError_clone(uint32_t orig) {
27373 LDKLightningError orig_conv;
27374 orig_conv.inner = (void*)(orig & (~1));
27375 orig_conv.is_owned = false;
27376 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27377 LDKLightningError ret_var = LightningError_clone(&orig_conv);
27378 uint64_t ret_ref = 0;
27379 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27380 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27381 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27382 ret_ref = (uint64_t)ret_var.inner;
27383 if (ret_var.is_owned) {
27389 void __attribute__((visibility("default"))) TS_CommitmentUpdate_free(uint32_t this_obj) {
27390 LDKCommitmentUpdate this_obj_conv;
27391 this_obj_conv.inner = (void*)(this_obj & (~1));
27392 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27393 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27394 CommitmentUpdate_free(this_obj_conv);
27397 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_add_htlcs(uint32_t this_ptr) {
27398 LDKCommitmentUpdate this_ptr_conv;
27399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27400 this_ptr_conv.is_owned = false;
27401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27402 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
27403 uint32_tArray ret_arr = NULL;
27404 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
27405 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
27406 for (size_t p = 0; p < ret_var.datalen; p++) {
27407 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
27408 uint64_t ret_conv_15_ref = 0;
27409 CHECK((((uint64_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27410 CHECK((((uint64_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27411 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
27412 ret_conv_15_ref = (uint64_t)ret_conv_15_var.inner;
27413 if (ret_conv_15_var.is_owned) {
27414 ret_conv_15_ref |= 1;
27416 ret_arr_ptr[p] = ret_conv_15_ref;
27419 FREE(ret_var.data);
27423 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
27424 LDKCommitmentUpdate this_ptr_conv;
27425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27426 this_ptr_conv.is_owned = false;
27427 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27428 LDKCVec_UpdateAddHTLCZ val_constr;
27429 val_constr.datalen = *((uint32_t*)val);
27430 if (val_constr.datalen > 0)
27431 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
27433 val_constr.data = NULL;
27434 uint32_t* val_vals = (uint32_t*)(val + 4);
27435 for (size_t p = 0; p < val_constr.datalen; p++) {
27436 uint32_t val_conv_15 = val_vals[p];
27437 LDKUpdateAddHTLC val_conv_15_conv;
27438 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
27439 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
27440 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
27441 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
27442 val_constr.data[p] = val_conv_15_conv;
27444 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
27447 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint32_t this_ptr) {
27448 LDKCommitmentUpdate this_ptr_conv;
27449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27450 this_ptr_conv.is_owned = false;
27451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27452 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
27453 uint32_tArray ret_arr = NULL;
27454 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
27455 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
27456 for (size_t t = 0; t < ret_var.datalen; t++) {
27457 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
27458 uint64_t ret_conv_19_ref = 0;
27459 CHECK((((uint64_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27460 CHECK((((uint64_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27461 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
27462 ret_conv_19_ref = (uint64_t)ret_conv_19_var.inner;
27463 if (ret_conv_19_var.is_owned) {
27464 ret_conv_19_ref |= 1;
27466 ret_arr_ptr[t] = ret_conv_19_ref;
27469 FREE(ret_var.data);
27473 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
27474 LDKCommitmentUpdate this_ptr_conv;
27475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27476 this_ptr_conv.is_owned = false;
27477 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27478 LDKCVec_UpdateFulfillHTLCZ val_constr;
27479 val_constr.datalen = *((uint32_t*)val);
27480 if (val_constr.datalen > 0)
27481 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
27483 val_constr.data = NULL;
27484 uint32_t* val_vals = (uint32_t*)(val + 4);
27485 for (size_t t = 0; t < val_constr.datalen; t++) {
27486 uint32_t val_conv_19 = val_vals[t];
27487 LDKUpdateFulfillHTLC val_conv_19_conv;
27488 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
27489 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
27490 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
27491 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
27492 val_constr.data[t] = val_conv_19_conv;
27494 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
27497 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint32_t this_ptr) {
27498 LDKCommitmentUpdate this_ptr_conv;
27499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27500 this_ptr_conv.is_owned = false;
27501 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27502 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
27503 uint32_tArray ret_arr = NULL;
27504 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
27505 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
27506 for (size_t q = 0; q < ret_var.datalen; q++) {
27507 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
27508 uint64_t ret_conv_16_ref = 0;
27509 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27510 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27511 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
27512 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
27513 if (ret_conv_16_var.is_owned) {
27514 ret_conv_16_ref |= 1;
27516 ret_arr_ptr[q] = ret_conv_16_ref;
27519 FREE(ret_var.data);
27523 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
27524 LDKCommitmentUpdate this_ptr_conv;
27525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27526 this_ptr_conv.is_owned = false;
27527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27528 LDKCVec_UpdateFailHTLCZ val_constr;
27529 val_constr.datalen = *((uint32_t*)val);
27530 if (val_constr.datalen > 0)
27531 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
27533 val_constr.data = NULL;
27534 uint32_t* val_vals = (uint32_t*)(val + 4);
27535 for (size_t q = 0; q < val_constr.datalen; q++) {
27536 uint32_t val_conv_16 = val_vals[q];
27537 LDKUpdateFailHTLC val_conv_16_conv;
27538 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
27539 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
27540 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
27541 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
27542 val_constr.data[q] = val_conv_16_conv;
27544 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
27547 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint32_t this_ptr) {
27548 LDKCommitmentUpdate this_ptr_conv;
27549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27550 this_ptr_conv.is_owned = false;
27551 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27552 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
27553 uint32_tArray ret_arr = NULL;
27554 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
27555 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
27556 for (size_t z = 0; z < ret_var.datalen; z++) {
27557 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
27558 uint64_t ret_conv_25_ref = 0;
27559 CHECK((((uint64_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27560 CHECK((((uint64_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27561 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
27562 ret_conv_25_ref = (uint64_t)ret_conv_25_var.inner;
27563 if (ret_conv_25_var.is_owned) {
27564 ret_conv_25_ref |= 1;
27566 ret_arr_ptr[z] = ret_conv_25_ref;
27569 FREE(ret_var.data);
27573 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_malformed_htlcs(uint32_t this_ptr, uint32_tArray val) {
27574 LDKCommitmentUpdate this_ptr_conv;
27575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27576 this_ptr_conv.is_owned = false;
27577 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27578 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
27579 val_constr.datalen = *((uint32_t*)val);
27580 if (val_constr.datalen > 0)
27581 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
27583 val_constr.data = NULL;
27584 uint32_t* val_vals = (uint32_t*)(val + 4);
27585 for (size_t z = 0; z < val_constr.datalen; z++) {
27586 uint32_t val_conv_25 = val_vals[z];
27587 LDKUpdateFailMalformedHTLC val_conv_25_conv;
27588 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
27589 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
27590 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
27591 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
27592 val_constr.data[z] = val_conv_25_conv;
27594 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
27597 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
27598 LDKCommitmentUpdate this_ptr_conv;
27599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27600 this_ptr_conv.is_owned = false;
27601 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27602 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
27603 uint64_t ret_ref = 0;
27604 if ((uint64_t)ret_var.inner > 4096) {
27605 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27606 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27607 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27608 ret_ref = (uint64_t)ret_var.inner;
27609 if (ret_var.is_owned) {
27616 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
27617 LDKCommitmentUpdate this_ptr_conv;
27618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27619 this_ptr_conv.is_owned = false;
27620 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27621 LDKUpdateFee val_conv;
27622 val_conv.inner = (void*)(val & (~1));
27623 val_conv.is_owned = (val & 1) || (val == 0);
27624 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27625 val_conv = UpdateFee_clone(&val_conv);
27626 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
27629 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
27630 LDKCommitmentUpdate this_ptr_conv;
27631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27632 this_ptr_conv.is_owned = false;
27633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27634 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
27635 uint64_t ret_ref = 0;
27636 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27637 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27638 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27639 ret_ref = (uint64_t)ret_var.inner;
27640 if (ret_var.is_owned) {
27646 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
27647 LDKCommitmentUpdate this_ptr_conv;
27648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27649 this_ptr_conv.is_owned = false;
27650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27651 LDKCommitmentSigned val_conv;
27652 val_conv.inner = (void*)(val & (~1));
27653 val_conv.is_owned = (val & 1) || (val == 0);
27654 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27655 val_conv = CommitmentSigned_clone(&val_conv);
27656 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
27659 uint32_t __attribute__((visibility("default"))) 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) {
27660 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
27661 update_add_htlcs_arg_constr.datalen = *((uint32_t*)update_add_htlcs_arg);
27662 if (update_add_htlcs_arg_constr.datalen > 0)
27663 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
27665 update_add_htlcs_arg_constr.data = NULL;
27666 uint32_t* update_add_htlcs_arg_vals = (uint32_t*)(update_add_htlcs_arg + 4);
27667 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
27668 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
27669 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
27670 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
27671 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
27672 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
27673 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
27674 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
27676 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
27677 update_fulfill_htlcs_arg_constr.datalen = *((uint32_t*)update_fulfill_htlcs_arg);
27678 if (update_fulfill_htlcs_arg_constr.datalen > 0)
27679 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
27681 update_fulfill_htlcs_arg_constr.data = NULL;
27682 uint32_t* update_fulfill_htlcs_arg_vals = (uint32_t*)(update_fulfill_htlcs_arg + 4);
27683 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
27684 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
27685 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
27686 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
27687 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
27688 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
27689 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
27690 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
27692 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
27693 update_fail_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_htlcs_arg);
27694 if (update_fail_htlcs_arg_constr.datalen > 0)
27695 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
27697 update_fail_htlcs_arg_constr.data = NULL;
27698 uint32_t* update_fail_htlcs_arg_vals = (uint32_t*)(update_fail_htlcs_arg + 4);
27699 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
27700 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
27701 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
27702 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
27703 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
27704 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
27705 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
27706 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
27708 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
27709 update_fail_malformed_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_malformed_htlcs_arg);
27710 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
27711 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
27713 update_fail_malformed_htlcs_arg_constr.data = NULL;
27714 uint32_t* update_fail_malformed_htlcs_arg_vals = (uint32_t*)(update_fail_malformed_htlcs_arg + 4);
27715 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
27716 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
27717 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
27718 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
27719 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);
27720 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
27721 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
27722 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
27724 LDKUpdateFee update_fee_arg_conv;
27725 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
27726 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
27727 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
27728 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
27729 LDKCommitmentSigned commitment_signed_arg_conv;
27730 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
27731 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
27732 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
27733 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
27734 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);
27735 uint64_t ret_ref = 0;
27736 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27737 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27738 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27739 ret_ref = (uint64_t)ret_var.inner;
27740 if (ret_var.is_owned) {
27746 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
27747 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
27748 uint64_t ret_ref = 0;
27749 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27750 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27751 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27752 ret_ref = (uint64_t)ret_var.inner;
27753 if (ret_var.is_owned) {
27758 int64_t __attribute__((visibility("default"))) TS_CommitmentUpdate_clone_ptr(uint32_t arg) {
27759 LDKCommitmentUpdate arg_conv;
27760 arg_conv.inner = (void*)(arg & (~1));
27761 arg_conv.is_owned = false;
27762 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27763 int64_t ret_val = CommitmentUpdate_clone_ptr(&arg_conv);
27767 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_clone(uint32_t orig) {
27768 LDKCommitmentUpdate orig_conv;
27769 orig_conv.inner = (void*)(orig & (~1));
27770 orig_conv.is_owned = false;
27771 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27772 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
27773 uint64_t ret_ref = 0;
27774 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27775 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27776 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27777 ret_ref = (uint64_t)ret_var.inner;
27778 if (ret_var.is_owned) {
27784 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
27785 if ((this_ptr & 1) != 0) return;
27786 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
27787 CHECK_ACCESS(this_ptr_ptr);
27788 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
27789 FREE((void*)this_ptr);
27790 ChannelMessageHandler_free(this_ptr_conv);
27793 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
27794 if ((this_ptr & 1) != 0) return;
27795 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
27796 CHECK_ACCESS(this_ptr_ptr);
27797 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
27798 FREE((void*)this_ptr);
27799 RoutingMessageHandler_free(this_ptr_conv);
27802 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_write(uint32_t obj) {
27803 LDKAcceptChannel obj_conv;
27804 obj_conv.inner = (void*)(obj & (~1));
27805 obj_conv.is_owned = false;
27806 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27807 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
27808 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27809 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27810 CVec_u8Z_free(ret_var);
27814 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_read(int8_tArray ser) {
27815 LDKu8slice ser_ref;
27816 ser_ref.datalen = *((uint32_t*)ser);
27817 ser_ref.data = (int8_t*)(ser + 4);
27818 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
27819 *ret_conv = AcceptChannel_read(ser_ref);
27820 return (uint64_t)ret_conv;
27823 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_write(uint32_t obj) {
27824 LDKAnnouncementSignatures obj_conv;
27825 obj_conv.inner = (void*)(obj & (~1));
27826 obj_conv.is_owned = false;
27827 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27828 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
27829 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27830 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27831 CVec_u8Z_free(ret_var);
27835 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
27836 LDKu8slice ser_ref;
27837 ser_ref.datalen = *((uint32_t*)ser);
27838 ser_ref.data = (int8_t*)(ser + 4);
27839 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
27840 *ret_conv = AnnouncementSignatures_read(ser_ref);
27841 return (uint64_t)ret_conv;
27844 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_write(uint32_t obj) {
27845 LDKChannelReestablish obj_conv;
27846 obj_conv.inner = (void*)(obj & (~1));
27847 obj_conv.is_owned = false;
27848 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27849 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
27850 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27851 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27852 CVec_u8Z_free(ret_var);
27856 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_read(int8_tArray ser) {
27857 LDKu8slice ser_ref;
27858 ser_ref.datalen = *((uint32_t*)ser);
27859 ser_ref.data = (int8_t*)(ser + 4);
27860 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
27861 *ret_conv = ChannelReestablish_read(ser_ref);
27862 return (uint64_t)ret_conv;
27865 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_write(uint32_t obj) {
27866 LDKClosingSigned obj_conv;
27867 obj_conv.inner = (void*)(obj & (~1));
27868 obj_conv.is_owned = false;
27869 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27870 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
27871 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27872 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27873 CVec_u8Z_free(ret_var);
27877 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_read(int8_tArray ser) {
27878 LDKu8slice ser_ref;
27879 ser_ref.datalen = *((uint32_t*)ser);
27880 ser_ref.data = (int8_t*)(ser + 4);
27881 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
27882 *ret_conv = ClosingSigned_read(ser_ref);
27883 return (uint64_t)ret_conv;
27886 int8_tArray __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_write(uint32_t obj) {
27887 LDKClosingSignedFeeRange obj_conv;
27888 obj_conv.inner = (void*)(obj & (~1));
27889 obj_conv.is_owned = false;
27890 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27891 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
27892 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27893 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27894 CVec_u8Z_free(ret_var);
27898 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
27899 LDKu8slice ser_ref;
27900 ser_ref.datalen = *((uint32_t*)ser);
27901 ser_ref.data = (int8_t*)(ser + 4);
27902 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
27903 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
27904 return (uint64_t)ret_conv;
27907 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_write(uint32_t obj) {
27908 LDKCommitmentSigned obj_conv;
27909 obj_conv.inner = (void*)(obj & (~1));
27910 obj_conv.is_owned = false;
27911 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27912 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
27913 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27914 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27915 CVec_u8Z_free(ret_var);
27919 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_read(int8_tArray ser) {
27920 LDKu8slice ser_ref;
27921 ser_ref.datalen = *((uint32_t*)ser);
27922 ser_ref.data = (int8_t*)(ser + 4);
27923 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
27924 *ret_conv = CommitmentSigned_read(ser_ref);
27925 return (uint64_t)ret_conv;
27928 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_write(uint32_t obj) {
27929 LDKFundingCreated obj_conv;
27930 obj_conv.inner = (void*)(obj & (~1));
27931 obj_conv.is_owned = false;
27932 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27933 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
27934 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27935 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27936 CVec_u8Z_free(ret_var);
27940 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_read(int8_tArray ser) {
27941 LDKu8slice ser_ref;
27942 ser_ref.datalen = *((uint32_t*)ser);
27943 ser_ref.data = (int8_t*)(ser + 4);
27944 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
27945 *ret_conv = FundingCreated_read(ser_ref);
27946 return (uint64_t)ret_conv;
27949 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_write(uint32_t obj) {
27950 LDKFundingSigned obj_conv;
27951 obj_conv.inner = (void*)(obj & (~1));
27952 obj_conv.is_owned = false;
27953 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27954 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
27955 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27956 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27957 CVec_u8Z_free(ret_var);
27961 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_read(int8_tArray ser) {
27962 LDKu8slice ser_ref;
27963 ser_ref.datalen = *((uint32_t*)ser);
27964 ser_ref.data = (int8_t*)(ser + 4);
27965 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
27966 *ret_conv = FundingSigned_read(ser_ref);
27967 return (uint64_t)ret_conv;
27970 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_write(uint32_t obj) {
27971 LDKFundingLocked obj_conv;
27972 obj_conv.inner = (void*)(obj & (~1));
27973 obj_conv.is_owned = false;
27974 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27975 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
27976 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27977 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27978 CVec_u8Z_free(ret_var);
27982 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_read(int8_tArray ser) {
27983 LDKu8slice ser_ref;
27984 ser_ref.datalen = *((uint32_t*)ser);
27985 ser_ref.data = (int8_t*)(ser + 4);
27986 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
27987 *ret_conv = FundingLocked_read(ser_ref);
27988 return (uint64_t)ret_conv;
27991 int8_tArray __attribute__((visibility("default"))) TS_Init_write(uint32_t obj) {
27993 obj_conv.inner = (void*)(obj & (~1));
27994 obj_conv.is_owned = false;
27995 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27996 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
27997 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27998 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27999 CVec_u8Z_free(ret_var);
28003 uint32_t __attribute__((visibility("default"))) TS_Init_read(int8_tArray ser) {
28004 LDKu8slice ser_ref;
28005 ser_ref.datalen = *((uint32_t*)ser);
28006 ser_ref.data = (int8_t*)(ser + 4);
28007 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
28008 *ret_conv = Init_read(ser_ref);
28009 return (uint64_t)ret_conv;
28012 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_write(uint32_t obj) {
28013 LDKOpenChannel obj_conv;
28014 obj_conv.inner = (void*)(obj & (~1));
28015 obj_conv.is_owned = false;
28016 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28017 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
28018 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28019 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28020 CVec_u8Z_free(ret_var);
28024 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_read(int8_tArray ser) {
28025 LDKu8slice ser_ref;
28026 ser_ref.datalen = *((uint32_t*)ser);
28027 ser_ref.data = (int8_t*)(ser + 4);
28028 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
28029 *ret_conv = OpenChannel_read(ser_ref);
28030 return (uint64_t)ret_conv;
28033 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_write(uint32_t obj) {
28034 LDKRevokeAndACK obj_conv;
28035 obj_conv.inner = (void*)(obj & (~1));
28036 obj_conv.is_owned = false;
28037 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28038 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
28039 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28040 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28041 CVec_u8Z_free(ret_var);
28045 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_read(int8_tArray ser) {
28046 LDKu8slice ser_ref;
28047 ser_ref.datalen = *((uint32_t*)ser);
28048 ser_ref.data = (int8_t*)(ser + 4);
28049 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
28050 *ret_conv = RevokeAndACK_read(ser_ref);
28051 return (uint64_t)ret_conv;
28054 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_write(uint32_t obj) {
28055 LDKShutdown obj_conv;
28056 obj_conv.inner = (void*)(obj & (~1));
28057 obj_conv.is_owned = false;
28058 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28059 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
28060 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28061 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28062 CVec_u8Z_free(ret_var);
28066 uint32_t __attribute__((visibility("default"))) TS_Shutdown_read(int8_tArray ser) {
28067 LDKu8slice ser_ref;
28068 ser_ref.datalen = *((uint32_t*)ser);
28069 ser_ref.data = (int8_t*)(ser + 4);
28070 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
28071 *ret_conv = Shutdown_read(ser_ref);
28072 return (uint64_t)ret_conv;
28075 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_write(uint32_t obj) {
28076 LDKUpdateFailHTLC obj_conv;
28077 obj_conv.inner = (void*)(obj & (~1));
28078 obj_conv.is_owned = false;
28079 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28080 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
28081 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28082 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28083 CVec_u8Z_free(ret_var);
28087 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
28088 LDKu8slice ser_ref;
28089 ser_ref.datalen = *((uint32_t*)ser);
28090 ser_ref.data = (int8_t*)(ser + 4);
28091 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
28092 *ret_conv = UpdateFailHTLC_read(ser_ref);
28093 return (uint64_t)ret_conv;
28096 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
28097 LDKUpdateFailMalformedHTLC obj_conv;
28098 obj_conv.inner = (void*)(obj & (~1));
28099 obj_conv.is_owned = false;
28100 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28101 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
28102 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28103 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28104 CVec_u8Z_free(ret_var);
28108 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
28109 LDKu8slice ser_ref;
28110 ser_ref.datalen = *((uint32_t*)ser);
28111 ser_ref.data = (int8_t*)(ser + 4);
28112 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
28113 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
28114 return (uint64_t)ret_conv;
28117 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_write(uint32_t obj) {
28118 LDKUpdateFee obj_conv;
28119 obj_conv.inner = (void*)(obj & (~1));
28120 obj_conv.is_owned = false;
28121 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28122 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
28123 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28124 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28125 CVec_u8Z_free(ret_var);
28129 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_read(int8_tArray ser) {
28130 LDKu8slice ser_ref;
28131 ser_ref.datalen = *((uint32_t*)ser);
28132 ser_ref.data = (int8_t*)(ser + 4);
28133 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
28134 *ret_conv = UpdateFee_read(ser_ref);
28135 return (uint64_t)ret_conv;
28138 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
28139 LDKUpdateFulfillHTLC obj_conv;
28140 obj_conv.inner = (void*)(obj & (~1));
28141 obj_conv.is_owned = false;
28142 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28143 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
28144 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28145 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28146 CVec_u8Z_free(ret_var);
28150 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
28151 LDKu8slice ser_ref;
28152 ser_ref.datalen = *((uint32_t*)ser);
28153 ser_ref.data = (int8_t*)(ser + 4);
28154 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
28155 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
28156 return (uint64_t)ret_conv;
28159 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_write(uint32_t obj) {
28160 LDKUpdateAddHTLC obj_conv;
28161 obj_conv.inner = (void*)(obj & (~1));
28162 obj_conv.is_owned = false;
28163 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28164 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
28165 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28166 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28167 CVec_u8Z_free(ret_var);
28171 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
28172 LDKu8slice ser_ref;
28173 ser_ref.datalen = *((uint32_t*)ser);
28174 ser_ref.data = (int8_t*)(ser + 4);
28175 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
28176 *ret_conv = UpdateAddHTLC_read(ser_ref);
28177 return (uint64_t)ret_conv;
28180 int8_tArray __attribute__((visibility("default"))) TS_Ping_write(uint32_t obj) {
28182 obj_conv.inner = (void*)(obj & (~1));
28183 obj_conv.is_owned = false;
28184 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28185 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
28186 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28187 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28188 CVec_u8Z_free(ret_var);
28192 uint32_t __attribute__((visibility("default"))) TS_Ping_read(int8_tArray ser) {
28193 LDKu8slice ser_ref;
28194 ser_ref.datalen = *((uint32_t*)ser);
28195 ser_ref.data = (int8_t*)(ser + 4);
28196 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
28197 *ret_conv = Ping_read(ser_ref);
28198 return (uint64_t)ret_conv;
28201 int8_tArray __attribute__((visibility("default"))) TS_Pong_write(uint32_t obj) {
28203 obj_conv.inner = (void*)(obj & (~1));
28204 obj_conv.is_owned = false;
28205 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28206 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
28207 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28208 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28209 CVec_u8Z_free(ret_var);
28213 uint32_t __attribute__((visibility("default"))) TS_Pong_read(int8_tArray ser) {
28214 LDKu8slice ser_ref;
28215 ser_ref.datalen = *((uint32_t*)ser);
28216 ser_ref.data = (int8_t*)(ser + 4);
28217 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
28218 *ret_conv = Pong_read(ser_ref);
28219 return (uint64_t)ret_conv;
28222 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
28223 LDKUnsignedChannelAnnouncement obj_conv;
28224 obj_conv.inner = (void*)(obj & (~1));
28225 obj_conv.is_owned = false;
28226 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28227 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
28228 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28229 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28230 CVec_u8Z_free(ret_var);
28234 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
28235 LDKu8slice ser_ref;
28236 ser_ref.datalen = *((uint32_t*)ser);
28237 ser_ref.data = (int8_t*)(ser + 4);
28238 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
28239 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
28240 return (uint64_t)ret_conv;
28243 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_write(uint32_t obj) {
28244 LDKChannelAnnouncement obj_conv;
28245 obj_conv.inner = (void*)(obj & (~1));
28246 obj_conv.is_owned = false;
28247 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28248 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
28249 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28250 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28251 CVec_u8Z_free(ret_var);
28255 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
28256 LDKu8slice ser_ref;
28257 ser_ref.datalen = *((uint32_t*)ser);
28258 ser_ref.data = (int8_t*)(ser + 4);
28259 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
28260 *ret_conv = ChannelAnnouncement_read(ser_ref);
28261 return (uint64_t)ret_conv;
28264 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
28265 LDKUnsignedChannelUpdate obj_conv;
28266 obj_conv.inner = (void*)(obj & (~1));
28267 obj_conv.is_owned = false;
28268 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28269 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
28270 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28271 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28272 CVec_u8Z_free(ret_var);
28276 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
28277 LDKu8slice ser_ref;
28278 ser_ref.datalen = *((uint32_t*)ser);
28279 ser_ref.data = (int8_t*)(ser + 4);
28280 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
28281 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
28282 return (uint64_t)ret_conv;
28285 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_write(uint32_t obj) {
28286 LDKChannelUpdate obj_conv;
28287 obj_conv.inner = (void*)(obj & (~1));
28288 obj_conv.is_owned = false;
28289 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28290 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
28291 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28292 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28293 CVec_u8Z_free(ret_var);
28297 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_read(int8_tArray ser) {
28298 LDKu8slice ser_ref;
28299 ser_ref.datalen = *((uint32_t*)ser);
28300 ser_ref.data = (int8_t*)(ser + 4);
28301 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
28302 *ret_conv = ChannelUpdate_read(ser_ref);
28303 return (uint64_t)ret_conv;
28306 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_write(uint32_t obj) {
28307 LDKErrorMessage obj_conv;
28308 obj_conv.inner = (void*)(obj & (~1));
28309 obj_conv.is_owned = false;
28310 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28311 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
28312 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28313 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28314 CVec_u8Z_free(ret_var);
28318 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_read(int8_tArray ser) {
28319 LDKu8slice ser_ref;
28320 ser_ref.datalen = *((uint32_t*)ser);
28321 ser_ref.data = (int8_t*)(ser + 4);
28322 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
28323 *ret_conv = ErrorMessage_read(ser_ref);
28324 return (uint64_t)ret_conv;
28327 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
28328 LDKUnsignedNodeAnnouncement obj_conv;
28329 obj_conv.inner = (void*)(obj & (~1));
28330 obj_conv.is_owned = false;
28331 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28332 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
28333 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28334 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28335 CVec_u8Z_free(ret_var);
28339 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
28340 LDKu8slice ser_ref;
28341 ser_ref.datalen = *((uint32_t*)ser);
28342 ser_ref.data = (int8_t*)(ser + 4);
28343 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
28344 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
28345 return (uint64_t)ret_conv;
28348 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_write(uint32_t obj) {
28349 LDKNodeAnnouncement obj_conv;
28350 obj_conv.inner = (void*)(obj & (~1));
28351 obj_conv.is_owned = false;
28352 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28353 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
28354 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28355 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28356 CVec_u8Z_free(ret_var);
28360 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_read(int8_tArray ser) {
28361 LDKu8slice ser_ref;
28362 ser_ref.datalen = *((uint32_t*)ser);
28363 ser_ref.data = (int8_t*)(ser + 4);
28364 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
28365 *ret_conv = NodeAnnouncement_read(ser_ref);
28366 return (uint64_t)ret_conv;
28369 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
28370 LDKu8slice ser_ref;
28371 ser_ref.datalen = *((uint32_t*)ser);
28372 ser_ref.data = (int8_t*)(ser + 4);
28373 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
28374 *ret_conv = QueryShortChannelIds_read(ser_ref);
28375 return (uint64_t)ret_conv;
28378 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_write(uint32_t obj) {
28379 LDKQueryShortChannelIds obj_conv;
28380 obj_conv.inner = (void*)(obj & (~1));
28381 obj_conv.is_owned = false;
28382 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28383 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
28384 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28385 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28386 CVec_u8Z_free(ret_var);
28390 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
28391 LDKReplyShortChannelIdsEnd obj_conv;
28392 obj_conv.inner = (void*)(obj & (~1));
28393 obj_conv.is_owned = false;
28394 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28395 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
28396 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28397 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28398 CVec_u8Z_free(ret_var);
28402 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
28403 LDKu8slice ser_ref;
28404 ser_ref.datalen = *((uint32_t*)ser);
28405 ser_ref.data = (int8_t*)(ser + 4);
28406 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
28407 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
28408 return (uint64_t)ret_conv;
28411 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
28412 LDKQueryChannelRange this_arg_conv;
28413 this_arg_conv.inner = (void*)(this_arg & (~1));
28414 this_arg_conv.is_owned = false;
28415 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28416 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
28420 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_write(uint32_t obj) {
28421 LDKQueryChannelRange obj_conv;
28422 obj_conv.inner = (void*)(obj & (~1));
28423 obj_conv.is_owned = false;
28424 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28425 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
28426 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28427 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28428 CVec_u8Z_free(ret_var);
28432 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_read(int8_tArray ser) {
28433 LDKu8slice ser_ref;
28434 ser_ref.datalen = *((uint32_t*)ser);
28435 ser_ref.data = (int8_t*)(ser + 4);
28436 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
28437 *ret_conv = QueryChannelRange_read(ser_ref);
28438 return (uint64_t)ret_conv;
28441 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_read(int8_tArray ser) {
28442 LDKu8slice ser_ref;
28443 ser_ref.datalen = *((uint32_t*)ser);
28444 ser_ref.data = (int8_t*)(ser + 4);
28445 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
28446 *ret_conv = ReplyChannelRange_read(ser_ref);
28447 return (uint64_t)ret_conv;
28450 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_write(uint32_t obj) {
28451 LDKReplyChannelRange obj_conv;
28452 obj_conv.inner = (void*)(obj & (~1));
28453 obj_conv.is_owned = false;
28454 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28455 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
28456 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28457 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28458 CVec_u8Z_free(ret_var);
28462 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_write(uint32_t obj) {
28463 LDKGossipTimestampFilter obj_conv;
28464 obj_conv.inner = (void*)(obj & (~1));
28465 obj_conv.is_owned = false;
28466 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28467 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
28468 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28469 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28470 CVec_u8Z_free(ret_var);
28474 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
28475 LDKu8slice ser_ref;
28476 ser_ref.datalen = *((uint32_t*)ser);
28477 ser_ref.data = (int8_t*)(ser + 4);
28478 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
28479 *ret_conv = GossipTimestampFilter_read(ser_ref);
28480 return (uint64_t)ret_conv;
28483 void __attribute__((visibility("default"))) TS_CustomMessageHandler_free(uint32_t this_ptr) {
28484 if ((this_ptr & 1) != 0) return;
28485 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
28486 CHECK_ACCESS(this_ptr_ptr);
28487 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
28488 FREE((void*)this_ptr);
28489 CustomMessageHandler_free(this_ptr_conv);
28492 void __attribute__((visibility("default"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
28493 LDKIgnoringMessageHandler this_obj_conv;
28494 this_obj_conv.inner = (void*)(this_obj & (~1));
28495 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28496 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28497 IgnoringMessageHandler_free(this_obj_conv);
28500 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_new() {
28501 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
28502 uint64_t ret_ref = 0;
28503 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28504 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28505 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28506 ret_ref = (uint64_t)ret_var.inner;
28507 if (ret_var.is_owned) {
28513 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
28514 LDKIgnoringMessageHandler this_arg_conv;
28515 this_arg_conv.inner = (void*)(this_arg & (~1));
28516 this_arg_conv.is_owned = false;
28517 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28518 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
28519 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
28520 return (uint64_t)ret_ret;
28523 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
28524 LDKIgnoringMessageHandler this_arg_conv;
28525 this_arg_conv.inner = (void*)(this_arg & (~1));
28526 this_arg_conv.is_owned = false;
28527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28528 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
28529 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
28530 return (uint64_t)ret_ret;
28533 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint32_t this_arg) {
28534 LDKIgnoringMessageHandler this_arg_conv;
28535 this_arg_conv.inner = (void*)(this_arg & (~1));
28536 this_arg_conv.is_owned = false;
28537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28538 LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
28539 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
28540 return (uint64_t)ret_ret;
28543 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint32_t this_arg) {
28544 LDKIgnoringMessageHandler this_arg_conv;
28545 this_arg_conv.inner = (void*)(this_arg & (~1));
28546 this_arg_conv.is_owned = false;
28547 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28548 LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
28549 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
28550 return (uint64_t)ret_ret;
28553 void __attribute__((visibility("default"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
28554 LDKErroringMessageHandler this_obj_conv;
28555 this_obj_conv.inner = (void*)(this_obj & (~1));
28556 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28557 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28558 ErroringMessageHandler_free(this_obj_conv);
28561 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_new() {
28562 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
28563 uint64_t ret_ref = 0;
28564 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28565 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28566 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28567 ret_ref = (uint64_t)ret_var.inner;
28568 if (ret_var.is_owned) {
28574 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
28575 LDKErroringMessageHandler this_arg_conv;
28576 this_arg_conv.inner = (void*)(this_arg & (~1));
28577 this_arg_conv.is_owned = false;
28578 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28579 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
28580 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
28581 return (uint64_t)ret_ret;
28584 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
28585 LDKErroringMessageHandler this_arg_conv;
28586 this_arg_conv.inner = (void*)(this_arg & (~1));
28587 this_arg_conv.is_owned = false;
28588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28589 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
28590 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
28591 return (uint64_t)ret_ret;
28594 void __attribute__((visibility("default"))) TS_MessageHandler_free(uint32_t this_obj) {
28595 LDKMessageHandler this_obj_conv;
28596 this_obj_conv.inner = (void*)(this_obj & (~1));
28597 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28598 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28599 MessageHandler_free(this_obj_conv);
28602 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
28603 LDKMessageHandler this_ptr_conv;
28604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28605 this_ptr_conv.is_owned = false;
28606 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28607 // WARNING: This object doesn't live past this scope, needs clone!
28608 uint64_t ret_ret = ((uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv)) | 1;
28612 void __attribute__((visibility("default"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
28613 LDKMessageHandler this_ptr_conv;
28614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28615 this_ptr_conv.is_owned = false;
28616 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28617 void* val_ptr = (void*)(((uint64_t)val) & ~1);
28618 CHECK_ACCESS(val_ptr);
28619 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
28620 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
28623 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
28624 LDKMessageHandler this_ptr_conv;
28625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28626 this_ptr_conv.is_owned = false;
28627 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28628 // WARNING: This object doesn't live past this scope, needs clone!
28629 uint64_t ret_ret = ((uint64_t)MessageHandler_get_route_handler(&this_ptr_conv)) | 1;
28633 void __attribute__((visibility("default"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
28634 LDKMessageHandler this_ptr_conv;
28635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28636 this_ptr_conv.is_owned = false;
28637 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28638 void* val_ptr = (void*)(((uint64_t)val) & ~1);
28639 CHECK_ACCESS(val_ptr);
28640 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
28641 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
28644 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
28645 void* chan_handler_arg_ptr = (void*)(((uint64_t)chan_handler_arg) & ~1);
28646 CHECK_ACCESS(chan_handler_arg_ptr);
28647 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
28648 void* route_handler_arg_ptr = (void*)(((uint64_t)route_handler_arg) & ~1);
28649 CHECK_ACCESS(route_handler_arg_ptr);
28650 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
28651 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
28652 uint64_t ret_ref = 0;
28653 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28654 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28655 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28656 ret_ref = (uint64_t)ret_var.inner;
28657 if (ret_var.is_owned) {
28663 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
28664 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
28665 *ret_ret = SocketDescriptor_clone(arg);
28666 return (uint64_t)ret_ret;
28668 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone_ptr(uint32_t arg) {
28669 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
28670 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
28671 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
28672 int64_t ret_val = SocketDescriptor_clone_ptr(arg_conv);
28676 uint32_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone(uint32_t orig) {
28677 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
28678 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
28679 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
28680 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
28681 *ret_ret = SocketDescriptor_clone(orig_conv);
28682 return (uint64_t)ret_ret;
28685 void __attribute__((visibility("default"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
28686 if ((this_ptr & 1) != 0) return;
28687 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
28688 CHECK_ACCESS(this_ptr_ptr);
28689 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
28690 FREE((void*)this_ptr);
28691 SocketDescriptor_free(this_ptr_conv);
28694 void __attribute__((visibility("default"))) TS_PeerHandleError_free(uint32_t this_obj) {
28695 LDKPeerHandleError this_obj_conv;
28696 this_obj_conv.inner = (void*)(this_obj & (~1));
28697 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28698 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28699 PeerHandleError_free(this_obj_conv);
28702 jboolean __attribute__((visibility("default"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
28703 LDKPeerHandleError this_ptr_conv;
28704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28705 this_ptr_conv.is_owned = false;
28706 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28707 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
28711 void __attribute__((visibility("default"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
28712 LDKPeerHandleError this_ptr_conv;
28713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28714 this_ptr_conv.is_owned = false;
28715 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28716 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
28719 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
28720 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
28721 uint64_t ret_ref = 0;
28722 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28723 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28724 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28725 ret_ref = (uint64_t)ret_var.inner;
28726 if (ret_var.is_owned) {
28732 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
28733 LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
28734 uint64_t ret_ref = 0;
28735 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28736 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28737 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28738 ret_ref = (uint64_t)ret_var.inner;
28739 if (ret_var.is_owned) {
28744 int64_t __attribute__((visibility("default"))) TS_PeerHandleError_clone_ptr(uint32_t arg) {
28745 LDKPeerHandleError arg_conv;
28746 arg_conv.inner = (void*)(arg & (~1));
28747 arg_conv.is_owned = false;
28748 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28749 int64_t ret_val = PeerHandleError_clone_ptr(&arg_conv);
28753 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_clone(uint32_t orig) {
28754 LDKPeerHandleError orig_conv;
28755 orig_conv.inner = (void*)(orig & (~1));
28756 orig_conv.is_owned = false;
28757 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28758 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
28759 uint64_t ret_ref = 0;
28760 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28761 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28762 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28763 ret_ref = (uint64_t)ret_var.inner;
28764 if (ret_var.is_owned) {
28770 void __attribute__((visibility("default"))) TS_PeerManager_free(uint32_t this_obj) {
28771 LDKPeerManager this_obj_conv;
28772 this_obj_conv.inner = (void*)(this_obj & (~1));
28773 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28774 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28775 PeerManager_free(this_obj_conv);
28778 uint32_t __attribute__((visibility("default"))) 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) {
28779 LDKMessageHandler message_handler_conv;
28780 message_handler_conv.inner = (void*)(message_handler & (~1));
28781 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
28782 CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
28783 // Warning: we need a move here but no clone is available for LDKMessageHandler
28784 LDKSecretKey our_node_secret_ref;
28785 CHECK(*((uint32_t*)our_node_secret) == 32);
28786 memcpy(our_node_secret_ref.bytes, (uint8_t*)(our_node_secret + 4), 32);
28787 unsigned char ephemeral_random_data_arr[32];
28788 CHECK(*((uint32_t*)ephemeral_random_data) == 32);
28789 memcpy(ephemeral_random_data_arr, (uint8_t*)(ephemeral_random_data + 4), 32);
28790 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
28791 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
28792 CHECK_ACCESS(logger_ptr);
28793 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28794 void* custom_message_handler_ptr = (void*)(((uint64_t)custom_message_handler) & ~1);
28795 CHECK_ACCESS(custom_message_handler_ptr);
28796 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
28797 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
28798 uint64_t ret_ref = 0;
28799 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28800 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28801 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28802 ret_ref = (uint64_t)ret_var.inner;
28803 if (ret_var.is_owned) {
28809 ptrArray __attribute__((visibility("default"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
28810 LDKPeerManager this_arg_conv;
28811 this_arg_conv.inner = (void*)(this_arg & (~1));
28812 this_arg_conv.is_owned = false;
28813 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28814 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
28815 ptrArray ret_arr = NULL;
28816 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
28817 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
28818 for (size_t m = 0; m < ret_var.datalen; m++) {
28819 int8_tArray ret_conv_12_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
28820 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].compressed_form, 33);
28821 ret_arr_ptr[m] = ret_conv_12_arr;
28824 FREE(ret_var.data);
28828 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_outbound_connection(uint32_t this_arg, int8_tArray their_node_id, uint32_t descriptor) {
28829 LDKPeerManager this_arg_conv;
28830 this_arg_conv.inner = (void*)(this_arg & (~1));
28831 this_arg_conv.is_owned = false;
28832 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28833 LDKPublicKey their_node_id_ref;
28834 CHECK(*((uint32_t*)their_node_id) == 33);
28835 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
28836 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28837 CHECK_ACCESS(descriptor_ptr);
28838 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
28839 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
28840 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
28841 return (uint64_t)ret_conv;
28844 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_inbound_connection(uint32_t this_arg, uint32_t descriptor) {
28845 LDKPeerManager this_arg_conv;
28846 this_arg_conv.inner = (void*)(this_arg & (~1));
28847 this_arg_conv.is_owned = false;
28848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28849 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28850 CHECK_ACCESS(descriptor_ptr);
28851 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
28852 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
28853 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
28854 return (uint64_t)ret_conv;
28857 uint32_t __attribute__((visibility("default"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
28858 LDKPeerManager this_arg_conv;
28859 this_arg_conv.inner = (void*)(this_arg & (~1));
28860 this_arg_conv.is_owned = false;
28861 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28862 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28863 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
28864 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
28865 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
28866 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
28867 return (uint64_t)ret_conv;
28870 uint32_t __attribute__((visibility("default"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
28871 LDKPeerManager this_arg_conv;
28872 this_arg_conv.inner = (void*)(this_arg & (~1));
28873 this_arg_conv.is_owned = false;
28874 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28875 void* peer_descriptor_ptr = (void*)(((uint64_t)peer_descriptor) & ~1);
28876 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
28877 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
28878 LDKu8slice data_ref;
28879 data_ref.datalen = *((uint32_t*)data);
28880 data_ref.data = (int8_t*)(data + 4);
28881 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
28882 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
28883 return (uint64_t)ret_conv;
28886 void __attribute__((visibility("default"))) TS_PeerManager_process_events(uint32_t this_arg) {
28887 LDKPeerManager this_arg_conv;
28888 this_arg_conv.inner = (void*)(this_arg & (~1));
28889 this_arg_conv.is_owned = false;
28890 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28891 PeerManager_process_events(&this_arg_conv);
28894 void __attribute__((visibility("default"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
28895 LDKPeerManager this_arg_conv;
28896 this_arg_conv.inner = (void*)(this_arg & (~1));
28897 this_arg_conv.is_owned = false;
28898 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28899 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28900 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
28901 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
28902 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
28905 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_by_node_id(uint32_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
28906 LDKPeerManager this_arg_conv;
28907 this_arg_conv.inner = (void*)(this_arg & (~1));
28908 this_arg_conv.is_owned = false;
28909 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28910 LDKPublicKey node_id_ref;
28911 CHECK(*((uint32_t*)node_id) == 33);
28912 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
28913 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
28916 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_all_peers(uint32_t this_arg) {
28917 LDKPeerManager this_arg_conv;
28918 this_arg_conv.inner = (void*)(this_arg & (~1));
28919 this_arg_conv.is_owned = false;
28920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28921 PeerManager_disconnect_all_peers(&this_arg_conv);
28924 void __attribute__((visibility("default"))) TS_PeerManager_timer_tick_occurred(uint32_t this_arg) {
28925 LDKPeerManager this_arg_conv;
28926 this_arg_conv.inner = (void*)(this_arg & (~1));
28927 this_arg_conv.is_owned = false;
28928 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28929 PeerManager_timer_tick_occurred(&this_arg_conv);
28932 int64_t __attribute__((visibility("default"))) TS_htlc_success_tx_weight(jboolean opt_anchors) {
28933 int64_t ret_val = htlc_success_tx_weight(opt_anchors);
28937 int64_t __attribute__((visibility("default"))) TS_htlc_timeout_tx_weight(jboolean opt_anchors) {
28938 int64_t ret_val = htlc_timeout_tx_weight(opt_anchors);
28942 int8_tArray __attribute__((visibility("default"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
28943 unsigned char commitment_seed_arr[32];
28944 CHECK(*((uint32_t*)commitment_seed) == 32);
28945 memcpy(commitment_seed_arr, (uint8_t*)(commitment_seed + 4), 32);
28946 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
28947 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
28948 memcpy((uint8_t*)(ret_arr + 4), build_commitment_secret(commitment_seed_ref, idx).data, 32);
28952 int8_tArray __attribute__((visibility("default"))) 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) {
28953 LDKCVec_u8Z to_holder_script_ref;
28954 to_holder_script_ref.datalen = *((uint32_t*)to_holder_script);
28955 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
28956 memcpy(to_holder_script_ref.data, (uint8_t*)(to_holder_script + 4), to_holder_script_ref.datalen);
28957 LDKCVec_u8Z to_counterparty_script_ref;
28958 to_counterparty_script_ref.datalen = *((uint32_t*)to_counterparty_script);
28959 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
28960 memcpy(to_counterparty_script_ref.data, (uint8_t*)(to_counterparty_script + 4), to_counterparty_script_ref.datalen);
28961 LDKOutPoint funding_outpoint_conv;
28962 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
28963 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
28964 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
28965 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
28966 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);
28967 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28968 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28969 Transaction_free(ret_var);
28973 uint32_t __attribute__((visibility("default"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
28974 LDKPublicKey per_commitment_point_ref;
28975 CHECK(*((uint32_t*)per_commitment_point) == 33);
28976 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
28977 unsigned char base_secret_arr[32];
28978 CHECK(*((uint32_t*)base_secret) == 32);
28979 memcpy(base_secret_arr, (uint8_t*)(base_secret + 4), 32);
28980 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
28981 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
28982 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
28983 return (uint64_t)ret_conv;
28986 uint32_t __attribute__((visibility("default"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
28987 LDKPublicKey per_commitment_point_ref;
28988 CHECK(*((uint32_t*)per_commitment_point) == 33);
28989 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
28990 LDKPublicKey base_point_ref;
28991 CHECK(*((uint32_t*)base_point) == 33);
28992 memcpy(base_point_ref.compressed_form, (uint8_t*)(base_point + 4), 33);
28993 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
28994 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
28995 return (uint64_t)ret_conv;
28998 uint32_t __attribute__((visibility("default"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
28999 unsigned char per_commitment_secret_arr[32];
29000 CHECK(*((uint32_t*)per_commitment_secret) == 32);
29001 memcpy(per_commitment_secret_arr, (uint8_t*)(per_commitment_secret + 4), 32);
29002 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
29003 unsigned char countersignatory_revocation_base_secret_arr[32];
29004 CHECK(*((uint32_t*)countersignatory_revocation_base_secret) == 32);
29005 memcpy(countersignatory_revocation_base_secret_arr, (uint8_t*)(countersignatory_revocation_base_secret + 4), 32);
29006 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
29007 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
29008 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
29009 return (uint64_t)ret_conv;
29012 uint32_t __attribute__((visibility("default"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
29013 LDKPublicKey per_commitment_point_ref;
29014 CHECK(*((uint32_t*)per_commitment_point) == 33);
29015 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
29016 LDKPublicKey countersignatory_revocation_base_point_ref;
29017 CHECK(*((uint32_t*)countersignatory_revocation_base_point) == 33);
29018 memcpy(countersignatory_revocation_base_point_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base_point + 4), 33);
29019 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
29020 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
29021 return (uint64_t)ret_conv;
29024 void __attribute__((visibility("default"))) TS_TxCreationKeys_free(uint32_t this_obj) {
29025 LDKTxCreationKeys this_obj_conv;
29026 this_obj_conv.inner = (void*)(this_obj & (~1));
29027 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29028 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29029 TxCreationKeys_free(this_obj_conv);
29032 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
29033 LDKTxCreationKeys this_ptr_conv;
29034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29035 this_ptr_conv.is_owned = false;
29036 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29037 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
29038 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
29042 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
29043 LDKTxCreationKeys this_ptr_conv;
29044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29045 this_ptr_conv.is_owned = false;
29046 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29047 LDKPublicKey val_ref;
29048 CHECK(*((uint32_t*)val) == 33);
29049 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
29050 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
29053 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
29054 LDKTxCreationKeys this_ptr_conv;
29055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29056 this_ptr_conv.is_owned = false;
29057 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29058 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
29059 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
29063 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
29064 LDKTxCreationKeys this_ptr_conv;
29065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29066 this_ptr_conv.is_owned = false;
29067 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29068 LDKPublicKey val_ref;
29069 CHECK(*((uint32_t*)val) == 33);
29070 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
29071 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
29074 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
29075 LDKTxCreationKeys this_ptr_conv;
29076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29077 this_ptr_conv.is_owned = false;
29078 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29079 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
29080 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
29084 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
29085 LDKTxCreationKeys this_ptr_conv;
29086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29087 this_ptr_conv.is_owned = false;
29088 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29089 LDKPublicKey val_ref;
29090 CHECK(*((uint32_t*)val) == 33);
29091 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
29092 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
29095 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
29096 LDKTxCreationKeys this_ptr_conv;
29097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29098 this_ptr_conv.is_owned = false;
29099 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29100 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
29101 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
29105 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
29106 LDKTxCreationKeys this_ptr_conv;
29107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29108 this_ptr_conv.is_owned = false;
29109 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29110 LDKPublicKey val_ref;
29111 CHECK(*((uint32_t*)val) == 33);
29112 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
29113 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
29116 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
29117 LDKTxCreationKeys this_ptr_conv;
29118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29119 this_ptr_conv.is_owned = false;
29120 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29121 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
29122 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
29126 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint32_t this_ptr, int8_tArray val) {
29127 LDKTxCreationKeys this_ptr_conv;
29128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29129 this_ptr_conv.is_owned = false;
29130 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29131 LDKPublicKey val_ref;
29132 CHECK(*((uint32_t*)val) == 33);
29133 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
29134 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
29137 uint32_t __attribute__((visibility("default"))) 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) {
29138 LDKPublicKey per_commitment_point_arg_ref;
29139 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
29140 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
29141 LDKPublicKey revocation_key_arg_ref;
29142 CHECK(*((uint32_t*)revocation_key_arg) == 33);
29143 memcpy(revocation_key_arg_ref.compressed_form, (uint8_t*)(revocation_key_arg + 4), 33);
29144 LDKPublicKey broadcaster_htlc_key_arg_ref;
29145 CHECK(*((uint32_t*)broadcaster_htlc_key_arg) == 33);
29146 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_htlc_key_arg + 4), 33);
29147 LDKPublicKey countersignatory_htlc_key_arg_ref;
29148 CHECK(*((uint32_t*)countersignatory_htlc_key_arg) == 33);
29149 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, (uint8_t*)(countersignatory_htlc_key_arg + 4), 33);
29150 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
29151 CHECK(*((uint32_t*)broadcaster_delayed_payment_key_arg) == 33);
29152 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key_arg + 4), 33);
29153 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);
29154 uint64_t ret_ref = 0;
29155 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29156 CHECK((((uint64_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 = (uint64_t)ret_var.inner;
29159 if (ret_var.is_owned) {
29165 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
29166 LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
29167 uint64_t ret_ref = 0;
29168 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29169 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29170 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29171 ret_ref = (uint64_t)ret_var.inner;
29172 if (ret_var.is_owned) {
29177 int64_t __attribute__((visibility("default"))) TS_TxCreationKeys_clone_ptr(uint32_t arg) {
29178 LDKTxCreationKeys arg_conv;
29179 arg_conv.inner = (void*)(arg & (~1));
29180 arg_conv.is_owned = false;
29181 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29182 int64_t ret_val = TxCreationKeys_clone_ptr(&arg_conv);
29186 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_clone(uint32_t orig) {
29187 LDKTxCreationKeys orig_conv;
29188 orig_conv.inner = (void*)(orig & (~1));
29189 orig_conv.is_owned = false;
29190 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29191 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
29192 uint64_t ret_ref = 0;
29193 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29194 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29195 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29196 ret_ref = (uint64_t)ret_var.inner;
29197 if (ret_var.is_owned) {
29203 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_write(uint32_t obj) {
29204 LDKTxCreationKeys obj_conv;
29205 obj_conv.inner = (void*)(obj & (~1));
29206 obj_conv.is_owned = false;
29207 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29208 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
29209 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
29210 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
29211 CVec_u8Z_free(ret_var);
29215 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_read(int8_tArray ser) {
29216 LDKu8slice ser_ref;
29217 ser_ref.datalen = *((uint32_t*)ser);
29218 ser_ref.data = (int8_t*)(ser + 4);
29219 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
29220 *ret_conv = TxCreationKeys_read(ser_ref);
29221 return (uint64_t)ret_conv;
29224 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_free(uint32_t this_obj) {
29225 LDKChannelPublicKeys this_obj_conv;
29226 this_obj_conv.inner = (void*)(this_obj & (~1));
29227 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29228 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29229 ChannelPublicKeys_free(this_obj_conv);
29232 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
29233 LDKChannelPublicKeys this_ptr_conv;
29234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29235 this_ptr_conv.is_owned = false;
29236 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29237 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
29238 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
29242 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
29243 LDKChannelPublicKeys this_ptr_conv;
29244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29245 this_ptr_conv.is_owned = false;
29246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29247 LDKPublicKey val_ref;
29248 CHECK(*((uint32_t*)val) == 33);
29249 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
29250 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
29253 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
29254 LDKChannelPublicKeys 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_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
29259 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
29263 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
29264 LDKChannelPublicKeys 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 LDKPublicKey val_ref;
29269 CHECK(*((uint32_t*)val) == 33);
29270 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
29271 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
29274 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
29275 LDKChannelPublicKeys 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 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
29280 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
29284 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
29285 LDKChannelPublicKeys this_ptr_conv;
29286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29287 this_ptr_conv.is_owned = false;
29288 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29289 LDKPublicKey val_ref;
29290 CHECK(*((uint32_t*)val) == 33);
29291 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
29292 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
29295 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
29296 LDKChannelPublicKeys this_ptr_conv;
29297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29298 this_ptr_conv.is_owned = false;
29299 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29300 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
29301 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
29305 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
29306 LDKChannelPublicKeys this_ptr_conv;
29307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29308 this_ptr_conv.is_owned = false;
29309 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29310 LDKPublicKey val_ref;
29311 CHECK(*((uint32_t*)val) == 33);
29312 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
29313 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
29316 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
29317 LDKChannelPublicKeys this_ptr_conv;
29318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29319 this_ptr_conv.is_owned = false;
29320 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29321 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
29322 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
29326 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
29327 LDKChannelPublicKeys this_ptr_conv;
29328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29329 this_ptr_conv.is_owned = false;
29330 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29331 LDKPublicKey val_ref;
29332 CHECK(*((uint32_t*)val) == 33);
29333 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
29334 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
29337 uint32_t __attribute__((visibility("default"))) 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) {
29338 LDKPublicKey funding_pubkey_arg_ref;
29339 CHECK(*((uint32_t*)funding_pubkey_arg) == 33);
29340 memcpy(funding_pubkey_arg_ref.compressed_form, (uint8_t*)(funding_pubkey_arg + 4), 33);
29341 LDKPublicKey revocation_basepoint_arg_ref;
29342 CHECK(*((uint32_t*)revocation_basepoint_arg) == 33);
29343 memcpy(revocation_basepoint_arg_ref.compressed_form, (uint8_t*)(revocation_basepoint_arg + 4), 33);
29344 LDKPublicKey payment_point_arg_ref;
29345 CHECK(*((uint32_t*)payment_point_arg) == 33);
29346 memcpy(payment_point_arg_ref.compressed_form, (uint8_t*)(payment_point_arg + 4), 33);
29347 LDKPublicKey delayed_payment_basepoint_arg_ref;
29348 CHECK(*((uint32_t*)delayed_payment_basepoint_arg) == 33);
29349 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, (uint8_t*)(delayed_payment_basepoint_arg + 4), 33);
29350 LDKPublicKey htlc_basepoint_arg_ref;
29351 CHECK(*((uint32_t*)htlc_basepoint_arg) == 33);
29352 memcpy(htlc_basepoint_arg_ref.compressed_form, (uint8_t*)(htlc_basepoint_arg + 4), 33);
29353 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);
29354 uint64_t ret_ref = 0;
29355 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29356 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29357 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29358 ret_ref = (uint64_t)ret_var.inner;
29359 if (ret_var.is_owned) {
29365 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
29366 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
29367 uint64_t ret_ref = 0;
29368 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29369 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29370 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29371 ret_ref = (uint64_t)ret_var.inner;
29372 if (ret_var.is_owned) {
29377 int64_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_clone_ptr(uint32_t arg) {
29378 LDKChannelPublicKeys arg_conv;
29379 arg_conv.inner = (void*)(arg & (~1));
29380 arg_conv.is_owned = false;
29381 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29382 int64_t ret_val = ChannelPublicKeys_clone_ptr(&arg_conv);
29386 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
29387 LDKChannelPublicKeys orig_conv;
29388 orig_conv.inner = (void*)(orig & (~1));
29389 orig_conv.is_owned = false;
29390 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29391 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
29392 uint64_t ret_ref = 0;
29393 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29394 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29395 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29396 ret_ref = (uint64_t)ret_var.inner;
29397 if (ret_var.is_owned) {
29403 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_write(uint32_t obj) {
29404 LDKChannelPublicKeys obj_conv;
29405 obj_conv.inner = (void*)(obj & (~1));
29406 obj_conv.is_owned = false;
29407 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29408 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
29409 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
29410 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
29411 CVec_u8Z_free(ret_var);
29415 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
29416 LDKu8slice ser_ref;
29417 ser_ref.datalen = *((uint32_t*)ser);
29418 ser_ref.data = (int8_t*)(ser + 4);
29419 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
29420 *ret_conv = ChannelPublicKeys_read(ser_ref);
29421 return (uint64_t)ret_conv;
29424 uint32_t __attribute__((visibility("default"))) 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) {
29425 LDKPublicKey per_commitment_point_ref;
29426 CHECK(*((uint32_t*)per_commitment_point) == 33);
29427 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
29428 LDKPublicKey broadcaster_delayed_payment_base_ref;
29429 CHECK(*((uint32_t*)broadcaster_delayed_payment_base) == 33);
29430 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_base + 4), 33);
29431 LDKPublicKey broadcaster_htlc_base_ref;
29432 CHECK(*((uint32_t*)broadcaster_htlc_base) == 33);
29433 memcpy(broadcaster_htlc_base_ref.compressed_form, (uint8_t*)(broadcaster_htlc_base + 4), 33);
29434 LDKPublicKey countersignatory_revocation_base_ref;
29435 CHECK(*((uint32_t*)countersignatory_revocation_base) == 33);
29436 memcpy(countersignatory_revocation_base_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base + 4), 33);
29437 LDKPublicKey countersignatory_htlc_base_ref;
29438 CHECK(*((uint32_t*)countersignatory_htlc_base) == 33);
29439 memcpy(countersignatory_htlc_base_ref.compressed_form, (uint8_t*)(countersignatory_htlc_base + 4), 33);
29440 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
29441 *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);
29442 return (uint64_t)ret_conv;
29445 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
29446 LDKPublicKey per_commitment_point_ref;
29447 CHECK(*((uint32_t*)per_commitment_point) == 33);
29448 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
29449 LDKChannelPublicKeys broadcaster_keys_conv;
29450 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
29451 broadcaster_keys_conv.is_owned = false;
29452 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
29453 LDKChannelPublicKeys countersignatory_keys_conv;
29454 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
29455 countersignatory_keys_conv.is_owned = false;
29456 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
29457 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
29458 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
29459 return (uint64_t)ret_conv;
29462 int8_tArray __attribute__((visibility("default"))) TS_get_revokeable_redeemscript(int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
29463 LDKPublicKey revocation_key_ref;
29464 CHECK(*((uint32_t*)revocation_key) == 33);
29465 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
29466 LDKPublicKey broadcaster_delayed_payment_key_ref;
29467 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
29468 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
29469 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
29470 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
29471 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
29472 CVec_u8Z_free(ret_var);
29476 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_free(uint32_t this_obj) {
29477 LDKHTLCOutputInCommitment this_obj_conv;
29478 this_obj_conv.inner = (void*)(this_obj & (~1));
29479 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29481 HTLCOutputInCommitment_free(this_obj_conv);
29484 jboolean __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
29485 LDKHTLCOutputInCommitment this_ptr_conv;
29486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29487 this_ptr_conv.is_owned = false;
29488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29489 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
29493 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
29494 LDKHTLCOutputInCommitment this_ptr_conv;
29495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29496 this_ptr_conv.is_owned = false;
29497 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29498 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
29501 int64_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
29502 LDKHTLCOutputInCommitment this_ptr_conv;
29503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29504 this_ptr_conv.is_owned = false;
29505 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29506 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
29510 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
29511 LDKHTLCOutputInCommitment this_ptr_conv;
29512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29513 this_ptr_conv.is_owned = false;
29514 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29515 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
29518 int32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
29519 LDKHTLCOutputInCommitment this_ptr_conv;
29520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29521 this_ptr_conv.is_owned = false;
29522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29523 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
29527 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
29528 LDKHTLCOutputInCommitment this_ptr_conv;
29529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29530 this_ptr_conv.is_owned = false;
29531 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29532 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
29535 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
29536 LDKHTLCOutputInCommitment this_ptr_conv;
29537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29538 this_ptr_conv.is_owned = false;
29539 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29540 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
29541 memcpy((uint8_t*)(ret_arr + 4), *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
29545 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
29546 LDKHTLCOutputInCommitment 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 LDKThirtyTwoBytes val_ref;
29551 CHECK(*((uint32_t*)val) == 32);
29552 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
29553 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
29556 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint32_t this_ptr) {
29557 LDKHTLCOutputInCommitment this_ptr_conv;
29558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29559 this_ptr_conv.is_owned = false;
29560 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29561 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
29562 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
29563 uint64_t ret_ref = (uint64_t)ret_copy;
29567 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint32_t this_ptr, uint32_t val) {
29568 LDKHTLCOutputInCommitment this_ptr_conv;
29569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29570 this_ptr_conv.is_owned = false;
29571 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29572 void* val_ptr = (void*)(((uint64_t)val) & ~1);
29573 CHECK_ACCESS(val_ptr);
29574 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
29575 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
29576 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
29579 uint32_t __attribute__((visibility("default"))) 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) {
29580 LDKThirtyTwoBytes payment_hash_arg_ref;
29581 CHECK(*((uint32_t*)payment_hash_arg) == 32);
29582 memcpy(payment_hash_arg_ref.data, (uint8_t*)(payment_hash_arg + 4), 32);
29583 void* transaction_output_index_arg_ptr = (void*)(((uint64_t)transaction_output_index_arg) & ~1);
29584 CHECK_ACCESS(transaction_output_index_arg_ptr);
29585 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
29586 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1));
29587 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
29588 uint64_t ret_ref = 0;
29589 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29590 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29591 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29592 ret_ref = (uint64_t)ret_var.inner;
29593 if (ret_var.is_owned) {
29599 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
29600 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
29601 uint64_t ret_ref = 0;
29602 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29603 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29604 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29605 ret_ref = (uint64_t)ret_var.inner;
29606 if (ret_var.is_owned) {
29611 int64_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_clone_ptr(uint32_t arg) {
29612 LDKHTLCOutputInCommitment arg_conv;
29613 arg_conv.inner = (void*)(arg & (~1));
29614 arg_conv.is_owned = false;
29615 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29616 int64_t ret_val = HTLCOutputInCommitment_clone_ptr(&arg_conv);
29620 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
29621 LDKHTLCOutputInCommitment orig_conv;
29622 orig_conv.inner = (void*)(orig & (~1));
29623 orig_conv.is_owned = false;
29624 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29625 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
29626 uint64_t ret_ref = 0;
29627 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29628 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29629 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29630 ret_ref = (uint64_t)ret_var.inner;
29631 if (ret_var.is_owned) {
29637 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
29638 LDKHTLCOutputInCommitment obj_conv;
29639 obj_conv.inner = (void*)(obj & (~1));
29640 obj_conv.is_owned = false;
29641 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29642 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
29643 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
29644 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
29645 CVec_u8Z_free(ret_var);
29649 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
29650 LDKu8slice ser_ref;
29651 ser_ref.datalen = *((uint32_t*)ser);
29652 ser_ref.data = (int8_t*)(ser + 4);
29653 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
29654 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
29655 return (uint64_t)ret_conv;
29658 int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uint32_t htlc, jboolean opt_anchors, uint32_t keys) {
29659 LDKHTLCOutputInCommitment htlc_conv;
29660 htlc_conv.inner = (void*)(htlc & (~1));
29661 htlc_conv.is_owned = false;
29662 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
29663 LDKTxCreationKeys keys_conv;
29664 keys_conv.inner = (void*)(keys & (~1));
29665 keys_conv.is_owned = false;
29666 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
29667 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
29668 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
29669 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
29670 CVec_u8Z_free(ret_var);
29674 int8_tArray __attribute__((visibility("default"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
29675 LDKPublicKey broadcaster_ref;
29676 CHECK(*((uint32_t*)broadcaster) == 33);
29677 memcpy(broadcaster_ref.compressed_form, (uint8_t*)(broadcaster + 4), 33);
29678 LDKPublicKey countersignatory_ref;
29679 CHECK(*((uint32_t*)countersignatory) == 33);
29680 memcpy(countersignatory_ref.compressed_form, (uint8_t*)(countersignatory + 4), 33);
29681 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
29682 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
29683 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
29684 CVec_u8Z_free(ret_var);
29688 int8_tArray __attribute__((visibility("default"))) 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) {
29689 unsigned char commitment_txid_arr[32];
29690 CHECK(*((uint32_t*)commitment_txid) == 32);
29691 memcpy(commitment_txid_arr, (uint8_t*)(commitment_txid + 4), 32);
29692 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
29693 LDKHTLCOutputInCommitment htlc_conv;
29694 htlc_conv.inner = (void*)(htlc & (~1));
29695 htlc_conv.is_owned = false;
29696 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
29697 LDKPublicKey broadcaster_delayed_payment_key_ref;
29698 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
29699 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
29700 LDKPublicKey revocation_key_ref;
29701 CHECK(*((uint32_t*)revocation_key) == 33);
29702 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
29703 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);
29704 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
29705 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
29706 Transaction_free(ret_var);
29710 int8_tArray __attribute__((visibility("default"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
29711 LDKPublicKey funding_pubkey_ref;
29712 CHECK(*((uint32_t*)funding_pubkey) == 33);
29713 memcpy(funding_pubkey_ref.compressed_form, (uint8_t*)(funding_pubkey + 4), 33);
29714 LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
29715 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
29716 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
29717 CVec_u8Z_free(ret_var);
29721 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) {
29722 LDKChannelTransactionParameters this_obj_conv;
29723 this_obj_conv.inner = (void*)(this_obj & (~1));
29724 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29725 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29726 ChannelTransactionParameters_free(this_obj_conv);
29729 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
29730 LDKChannelTransactionParameters this_ptr_conv;
29731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29732 this_ptr_conv.is_owned = false;
29733 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29734 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
29735 uint64_t ret_ref = 0;
29736 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29737 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29738 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29739 ret_ref = (uint64_t)ret_var.inner;
29740 if (ret_var.is_owned) {
29746 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
29747 LDKChannelTransactionParameters this_ptr_conv;
29748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29749 this_ptr_conv.is_owned = false;
29750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29751 LDKChannelPublicKeys val_conv;
29752 val_conv.inner = (void*)(val & (~1));
29753 val_conv.is_owned = (val & 1) || (val == 0);
29754 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29755 val_conv = ChannelPublicKeys_clone(&val_conv);
29756 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
29759 int16_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
29760 LDKChannelTransactionParameters this_ptr_conv;
29761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29762 this_ptr_conv.is_owned = false;
29763 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29764 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
29768 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_selected_contest_delay(uint32_t this_ptr, int16_t val) {
29769 LDKChannelTransactionParameters this_ptr_conv;
29770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29771 this_ptr_conv.is_owned = false;
29772 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29773 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
29776 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
29777 LDKChannelTransactionParameters this_ptr_conv;
29778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29779 this_ptr_conv.is_owned = false;
29780 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29781 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
29785 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
29786 LDKChannelTransactionParameters this_ptr_conv;
29787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29788 this_ptr_conv.is_owned = false;
29789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29790 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
29793 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
29794 LDKChannelTransactionParameters this_ptr_conv;
29795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29796 this_ptr_conv.is_owned = false;
29797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29798 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
29799 uint64_t ret_ref = 0;
29800 if ((uint64_t)ret_var.inner > 4096) {
29801 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29802 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29803 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29804 ret_ref = (uint64_t)ret_var.inner;
29805 if (ret_var.is_owned) {
29812 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
29813 LDKChannelTransactionParameters 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 LDKCounterpartyChannelTransactionParameters val_conv;
29818 val_conv.inner = (void*)(val & (~1));
29819 val_conv.is_owned = (val & 1) || (val == 0);
29820 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29821 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
29822 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
29825 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
29826 LDKChannelTransactionParameters this_ptr_conv;
29827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29828 this_ptr_conv.is_owned = false;
29829 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29830 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
29831 uint64_t ret_ref = 0;
29832 if ((uint64_t)ret_var.inner > 4096) {
29833 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29834 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29835 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29836 ret_ref = (uint64_t)ret_var.inner;
29837 if (ret_var.is_owned) {
29844 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
29845 LDKChannelTransactionParameters this_ptr_conv;
29846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29847 this_ptr_conv.is_owned = false;
29848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29849 LDKOutPoint val_conv;
29850 val_conv.inner = (void*)(val & (~1));
29851 val_conv.is_owned = (val & 1) || (val == 0);
29852 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29853 val_conv = OutPoint_clone(&val_conv);
29854 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
29857 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_opt_anchors(uint32_t this_ptr) {
29858 LDKChannelTransactionParameters this_ptr_conv;
29859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29860 this_ptr_conv.is_owned = false;
29861 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29862 uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
29866 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_opt_anchors(uint32_t this_ptr, uint32_t val) {
29867 LDKChannelTransactionParameters this_ptr_conv;
29868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29869 this_ptr_conv.is_owned = false;
29870 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29871 LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
29872 ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
29875 uint32_t __attribute__((visibility("default"))) 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) {
29876 LDKChannelPublicKeys holder_pubkeys_arg_conv;
29877 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
29878 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
29879 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
29880 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
29881 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
29882 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
29883 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
29884 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
29885 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
29886 LDKOutPoint funding_outpoint_arg_conv;
29887 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
29888 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
29889 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
29890 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
29891 LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg);
29892 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);
29893 uint64_t ret_ref = 0;
29894 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29895 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29896 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29897 ret_ref = (uint64_t)ret_var.inner;
29898 if (ret_var.is_owned) {
29904 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
29905 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
29906 uint64_t ret_ref = 0;
29907 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29908 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29909 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29910 ret_ref = (uint64_t)ret_var.inner;
29911 if (ret_var.is_owned) {
29916 int64_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_clone_ptr(uint32_t arg) {
29917 LDKChannelTransactionParameters arg_conv;
29918 arg_conv.inner = (void*)(arg & (~1));
29919 arg_conv.is_owned = false;
29920 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29921 int64_t ret_val = ChannelTransactionParameters_clone_ptr(&arg_conv);
29925 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
29926 LDKChannelTransactionParameters orig_conv;
29927 orig_conv.inner = (void*)(orig & (~1));
29928 orig_conv.is_owned = false;
29929 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29930 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
29931 uint64_t ret_ref = 0;
29932 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29933 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29934 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29935 ret_ref = (uint64_t)ret_var.inner;
29936 if (ret_var.is_owned) {
29942 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_obj) {
29943 LDKCounterpartyChannelTransactionParameters this_obj_conv;
29944 this_obj_conv.inner = (void*)(this_obj & (~1));
29945 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29946 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29947 CounterpartyChannelTransactionParameters_free(this_obj_conv);
29950 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
29951 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29953 this_ptr_conv.is_owned = false;
29954 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29955 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
29956 uint64_t ret_ref = 0;
29957 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29958 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29959 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29960 ret_ref = (uint64_t)ret_var.inner;
29961 if (ret_var.is_owned) {
29967 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
29968 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29970 this_ptr_conv.is_owned = false;
29971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29972 LDKChannelPublicKeys val_conv;
29973 val_conv.inner = (void*)(val & (~1));
29974 val_conv.is_owned = (val & 1) || (val == 0);
29975 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29976 val_conv = ChannelPublicKeys_clone(&val_conv);
29977 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
29980 int16_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
29981 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29983 this_ptr_conv.is_owned = false;
29984 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29985 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
29989 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
29990 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29992 this_ptr_conv.is_owned = false;
29993 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29994 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
29997 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
29998 LDKChannelPublicKeys pubkeys_arg_conv;
29999 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
30000 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
30001 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
30002 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
30003 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
30004 uint64_t ret_ref = 0;
30005 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30006 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30007 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30008 ret_ref = (uint64_t)ret_var.inner;
30009 if (ret_var.is_owned) {
30015 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
30016 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
30017 uint64_t ret_ref = 0;
30018 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30019 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30020 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30021 ret_ref = (uint64_t)ret_var.inner;
30022 if (ret_var.is_owned) {
30027 int64_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint32_t arg) {
30028 LDKCounterpartyChannelTransactionParameters arg_conv;
30029 arg_conv.inner = (void*)(arg & (~1));
30030 arg_conv.is_owned = false;
30031 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30032 int64_t ret_val = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
30036 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
30037 LDKCounterpartyChannelTransactionParameters orig_conv;
30038 orig_conv.inner = (void*)(orig & (~1));
30039 orig_conv.is_owned = false;
30040 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30041 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
30042 uint64_t ret_ref = 0;
30043 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30044 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30045 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30046 ret_ref = (uint64_t)ret_var.inner;
30047 if (ret_var.is_owned) {
30053 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
30054 LDKChannelTransactionParameters this_arg_conv;
30055 this_arg_conv.inner = (void*)(this_arg & (~1));
30056 this_arg_conv.is_owned = false;
30057 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30058 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
30062 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
30063 LDKChannelTransactionParameters this_arg_conv;
30064 this_arg_conv.inner = (void*)(this_arg & (~1));
30065 this_arg_conv.is_owned = false;
30066 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30067 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
30068 uint64_t ret_ref = 0;
30069 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30070 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30071 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30072 ret_ref = (uint64_t)ret_var.inner;
30073 if (ret_var.is_owned) {
30079 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
30080 LDKChannelTransactionParameters this_arg_conv;
30081 this_arg_conv.inner = (void*)(this_arg & (~1));
30082 this_arg_conv.is_owned = false;
30083 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30084 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
30085 uint64_t ret_ref = 0;
30086 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30087 CHECK((((uint64_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 = (uint64_t)ret_var.inner;
30090 if (ret_var.is_owned) {
30096 int8_tArray __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
30097 LDKCounterpartyChannelTransactionParameters obj_conv;
30098 obj_conv.inner = (void*)(obj & (~1));
30099 obj_conv.is_owned = false;
30100 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30101 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
30102 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30103 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30104 CVec_u8Z_free(ret_var);
30108 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
30109 LDKu8slice ser_ref;
30110 ser_ref.datalen = *((uint32_t*)ser);
30111 ser_ref.data = (int8_t*)(ser + 4);
30112 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
30113 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
30114 return (uint64_t)ret_conv;
30117 int8_tArray __attribute__((visibility("default"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
30118 LDKChannelTransactionParameters obj_conv;
30119 obj_conv.inner = (void*)(obj & (~1));
30120 obj_conv.is_owned = false;
30121 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30122 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
30123 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30124 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30125 CVec_u8Z_free(ret_var);
30129 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
30130 LDKu8slice ser_ref;
30131 ser_ref.datalen = *((uint32_t*)ser);
30132 ser_ref.data = (int8_t*)(ser + 4);
30133 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
30134 *ret_conv = ChannelTransactionParameters_read(ser_ref);
30135 return (uint64_t)ret_conv;
30138 void __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_obj) {
30139 LDKDirectedChannelTransactionParameters this_obj_conv;
30140 this_obj_conv.inner = (void*)(this_obj & (~1));
30141 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30142 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30143 DirectedChannelTransactionParameters_free(this_obj_conv);
30146 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
30147 LDKDirectedChannelTransactionParameters this_arg_conv;
30148 this_arg_conv.inner = (void*)(this_arg & (~1));
30149 this_arg_conv.is_owned = false;
30150 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30151 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
30152 uint64_t ret_ref = 0;
30153 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30154 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30155 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30156 ret_ref = (uint64_t)ret_var.inner;
30157 if (ret_var.is_owned) {
30163 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
30164 LDKDirectedChannelTransactionParameters this_arg_conv;
30165 this_arg_conv.inner = (void*)(this_arg & (~1));
30166 this_arg_conv.is_owned = false;
30167 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30168 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
30169 uint64_t ret_ref = 0;
30170 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30171 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30172 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30173 ret_ref = (uint64_t)ret_var.inner;
30174 if (ret_var.is_owned) {
30180 int16_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
30181 LDKDirectedChannelTransactionParameters this_arg_conv;
30182 this_arg_conv.inner = (void*)(this_arg & (~1));
30183 this_arg_conv.is_owned = false;
30184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30185 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
30189 jboolean __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
30190 LDKDirectedChannelTransactionParameters this_arg_conv;
30191 this_arg_conv.inner = (void*)(this_arg & (~1));
30192 this_arg_conv.is_owned = false;
30193 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30194 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
30198 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
30199 LDKDirectedChannelTransactionParameters this_arg_conv;
30200 this_arg_conv.inner = (void*)(this_arg & (~1));
30201 this_arg_conv.is_owned = false;
30202 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30203 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
30204 uint64_t ret_ref = 0;
30205 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30206 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30207 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30208 ret_ref = (uint64_t)ret_var.inner;
30209 if (ret_var.is_owned) {
30215 jboolean __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_opt_anchors(uint32_t this_arg) {
30216 LDKDirectedChannelTransactionParameters this_arg_conv;
30217 this_arg_conv.inner = (void*)(this_arg & (~1));
30218 this_arg_conv.is_owned = false;
30219 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30220 jboolean ret_val = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
30224 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) {
30225 LDKHolderCommitmentTransaction this_obj_conv;
30226 this_obj_conv.inner = (void*)(this_obj & (~1));
30227 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30228 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30229 HolderCommitmentTransaction_free(this_obj_conv);
30232 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
30233 LDKHolderCommitmentTransaction this_ptr_conv;
30234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30235 this_ptr_conv.is_owned = false;
30236 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30237 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
30238 memcpy((uint8_t*)(ret_arr + 4), HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
30242 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
30243 LDKHolderCommitmentTransaction this_ptr_conv;
30244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30245 this_ptr_conv.is_owned = false;
30246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30247 LDKSignature val_ref;
30248 CHECK(*((uint32_t*)val) == 64);
30249 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
30250 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
30253 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
30254 LDKHolderCommitmentTransaction this_ptr_conv;
30255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30256 this_ptr_conv.is_owned = false;
30257 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30258 LDKCVec_SignatureZ val_constr;
30259 val_constr.datalen = *((uint32_t*)val);
30260 if (val_constr.datalen > 0)
30261 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
30263 val_constr.data = NULL;
30264 int8_tArray* val_vals = (int8_tArray*)(val + 4);
30265 for (size_t m = 0; m < val_constr.datalen; m++) {
30266 int8_tArray val_conv_12 = val_vals[m];
30267 LDKSignature val_conv_12_ref;
30268 CHECK(*((uint32_t*)val_conv_12) == 64);
30269 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
30270 val_constr.data[m] = val_conv_12_ref;
30272 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
30275 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
30276 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
30277 uint64_t ret_ref = 0;
30278 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30279 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30280 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30281 ret_ref = (uint64_t)ret_var.inner;
30282 if (ret_var.is_owned) {
30287 int64_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_clone_ptr(uint32_t arg) {
30288 LDKHolderCommitmentTransaction arg_conv;
30289 arg_conv.inner = (void*)(arg & (~1));
30290 arg_conv.is_owned = false;
30291 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30292 int64_t ret_val = HolderCommitmentTransaction_clone_ptr(&arg_conv);
30296 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
30297 LDKHolderCommitmentTransaction orig_conv;
30298 orig_conv.inner = (void*)(orig & (~1));
30299 orig_conv.is_owned = false;
30300 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30301 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
30302 uint64_t ret_ref = 0;
30303 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30304 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30305 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30306 ret_ref = (uint64_t)ret_var.inner;
30307 if (ret_var.is_owned) {
30313 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
30314 LDKHolderCommitmentTransaction obj_conv;
30315 obj_conv.inner = (void*)(obj & (~1));
30316 obj_conv.is_owned = false;
30317 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30318 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
30319 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30320 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30321 CVec_u8Z_free(ret_var);
30325 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
30326 LDKu8slice ser_ref;
30327 ser_ref.datalen = *((uint32_t*)ser);
30328 ser_ref.data = (int8_t*)(ser + 4);
30329 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
30330 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
30331 return (uint64_t)ret_conv;
30334 uint32_t __attribute__((visibility("default"))) 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) {
30335 LDKCommitmentTransaction commitment_tx_conv;
30336 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
30337 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
30338 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
30339 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
30340 LDKSignature counterparty_sig_ref;
30341 CHECK(*((uint32_t*)counterparty_sig) == 64);
30342 memcpy(counterparty_sig_ref.compact_form, (uint8_t*)(counterparty_sig + 4), 64);
30343 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
30344 counterparty_htlc_sigs_constr.datalen = *((uint32_t*)counterparty_htlc_sigs);
30345 if (counterparty_htlc_sigs_constr.datalen > 0)
30346 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
30348 counterparty_htlc_sigs_constr.data = NULL;
30349 int8_tArray* counterparty_htlc_sigs_vals = (int8_tArray*)(counterparty_htlc_sigs + 4);
30350 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
30351 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
30352 LDKSignature counterparty_htlc_sigs_conv_12_ref;
30353 CHECK(*((uint32_t*)counterparty_htlc_sigs_conv_12) == 64);
30354 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, (uint8_t*)(counterparty_htlc_sigs_conv_12 + 4), 64);
30355 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
30357 LDKPublicKey holder_funding_key_ref;
30358 CHECK(*((uint32_t*)holder_funding_key) == 33);
30359 memcpy(holder_funding_key_ref.compressed_form, (uint8_t*)(holder_funding_key + 4), 33);
30360 LDKPublicKey counterparty_funding_key_ref;
30361 CHECK(*((uint32_t*)counterparty_funding_key) == 33);
30362 memcpy(counterparty_funding_key_ref.compressed_form, (uint8_t*)(counterparty_funding_key + 4), 33);
30363 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
30364 uint64_t ret_ref = 0;
30365 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30366 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30367 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30368 ret_ref = (uint64_t)ret_var.inner;
30369 if (ret_var.is_owned) {
30375 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_free(uint32_t this_obj) {
30376 LDKBuiltCommitmentTransaction this_obj_conv;
30377 this_obj_conv.inner = (void*)(this_obj & (~1));
30378 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30379 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30380 BuiltCommitmentTransaction_free(this_obj_conv);
30383 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
30384 LDKBuiltCommitmentTransaction this_ptr_conv;
30385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30386 this_ptr_conv.is_owned = false;
30387 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30388 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
30389 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30390 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30391 Transaction_free(ret_var);
30395 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
30396 LDKBuiltCommitmentTransaction this_ptr_conv;
30397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30398 this_ptr_conv.is_owned = false;
30399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30400 LDKTransaction val_ref;
30401 val_ref.datalen = *((uint32_t*)val);
30402 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
30403 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
30404 val_ref.data_is_owned = true;
30405 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
30408 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
30409 LDKBuiltCommitmentTransaction this_ptr_conv;
30410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30411 this_ptr_conv.is_owned = false;
30412 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30413 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
30414 memcpy((uint8_t*)(ret_arr + 4), *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
30418 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
30419 LDKBuiltCommitmentTransaction this_ptr_conv;
30420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30421 this_ptr_conv.is_owned = false;
30422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30423 LDKThirtyTwoBytes val_ref;
30424 CHECK(*((uint32_t*)val) == 32);
30425 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
30426 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
30429 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
30430 LDKTransaction transaction_arg_ref;
30431 transaction_arg_ref.datalen = *((uint32_t*)transaction_arg);
30432 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
30433 memcpy(transaction_arg_ref.data, (uint8_t*)(transaction_arg + 4), transaction_arg_ref.datalen);
30434 transaction_arg_ref.data_is_owned = true;
30435 LDKThirtyTwoBytes txid_arg_ref;
30436 CHECK(*((uint32_t*)txid_arg) == 32);
30437 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
30438 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
30439 uint64_t ret_ref = 0;
30440 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30441 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30442 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30443 ret_ref = (uint64_t)ret_var.inner;
30444 if (ret_var.is_owned) {
30450 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
30451 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
30452 uint64_t ret_ref = 0;
30453 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30454 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30455 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30456 ret_ref = (uint64_t)ret_var.inner;
30457 if (ret_var.is_owned) {
30462 int64_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_clone_ptr(uint32_t arg) {
30463 LDKBuiltCommitmentTransaction arg_conv;
30464 arg_conv.inner = (void*)(arg & (~1));
30465 arg_conv.is_owned = false;
30466 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30467 int64_t ret_val = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
30471 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
30472 LDKBuiltCommitmentTransaction orig_conv;
30473 orig_conv.inner = (void*)(orig & (~1));
30474 orig_conv.is_owned = false;
30475 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30476 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
30477 uint64_t ret_ref = 0;
30478 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30479 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30480 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30481 ret_ref = (uint64_t)ret_var.inner;
30482 if (ret_var.is_owned) {
30488 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
30489 LDKBuiltCommitmentTransaction obj_conv;
30490 obj_conv.inner = (void*)(obj & (~1));
30491 obj_conv.is_owned = false;
30492 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30493 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
30494 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30495 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30496 CVec_u8Z_free(ret_var);
30500 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
30501 LDKu8slice ser_ref;
30502 ser_ref.datalen = *((uint32_t*)ser);
30503 ser_ref.data = (int8_t*)(ser + 4);
30504 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
30505 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
30506 return (uint64_t)ret_conv;
30509 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
30510 LDKBuiltCommitmentTransaction this_arg_conv;
30511 this_arg_conv.inner = (void*)(this_arg & (~1));
30512 this_arg_conv.is_owned = false;
30513 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30514 LDKu8slice funding_redeemscript_ref;
30515 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
30516 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
30517 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
30518 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
30522 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_sign(uint32_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
30523 LDKBuiltCommitmentTransaction this_arg_conv;
30524 this_arg_conv.inner = (void*)(this_arg & (~1));
30525 this_arg_conv.is_owned = false;
30526 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30527 unsigned char funding_key_arr[32];
30528 CHECK(*((uint32_t*)funding_key) == 32);
30529 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
30530 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
30531 LDKu8slice funding_redeemscript_ref;
30532 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
30533 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
30534 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
30535 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
30539 void __attribute__((visibility("default"))) TS_ClosingTransaction_free(uint32_t this_obj) {
30540 LDKClosingTransaction this_obj_conv;
30541 this_obj_conv.inner = (void*)(this_obj & (~1));
30542 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30543 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30544 ClosingTransaction_free(this_obj_conv);
30547 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
30548 LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
30549 uint64_t ret_ref = 0;
30550 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30551 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30552 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30553 ret_ref = (uint64_t)ret_var.inner;
30554 if (ret_var.is_owned) {
30559 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_clone_ptr(uint32_t arg) {
30560 LDKClosingTransaction arg_conv;
30561 arg_conv.inner = (void*)(arg & (~1));
30562 arg_conv.is_owned = false;
30563 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30564 int64_t ret_val = ClosingTransaction_clone_ptr(&arg_conv);
30568 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_clone(uint32_t orig) {
30569 LDKClosingTransaction orig_conv;
30570 orig_conv.inner = (void*)(orig & (~1));
30571 orig_conv.is_owned = false;
30572 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30573 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
30574 uint64_t ret_ref = 0;
30575 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30576 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30577 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30578 ret_ref = (uint64_t)ret_var.inner;
30579 if (ret_var.is_owned) {
30585 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_hash(uint32_t o) {
30586 LDKClosingTransaction o_conv;
30587 o_conv.inner = (void*)(o & (~1));
30588 o_conv.is_owned = false;
30589 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30590 int64_t ret_val = ClosingTransaction_hash(&o_conv);
30594 uint32_t __attribute__((visibility("default"))) 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) {
30595 LDKCVec_u8Z to_holder_script_ref;
30596 to_holder_script_ref.datalen = *((uint32_t*)to_holder_script);
30597 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
30598 memcpy(to_holder_script_ref.data, (uint8_t*)(to_holder_script + 4), to_holder_script_ref.datalen);
30599 LDKCVec_u8Z to_counterparty_script_ref;
30600 to_counterparty_script_ref.datalen = *((uint32_t*)to_counterparty_script);
30601 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
30602 memcpy(to_counterparty_script_ref.data, (uint8_t*)(to_counterparty_script + 4), to_counterparty_script_ref.datalen);
30603 LDKOutPoint funding_outpoint_conv;
30604 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
30605 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
30606 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
30607 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
30608 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
30609 uint64_t ret_ref = 0;
30610 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30611 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30612 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30613 ret_ref = (uint64_t)ret_var.inner;
30614 if (ret_var.is_owned) {
30620 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_trust(uint32_t this_arg) {
30621 LDKClosingTransaction this_arg_conv;
30622 this_arg_conv.inner = (void*)(this_arg & (~1));
30623 this_arg_conv.is_owned = false;
30624 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30625 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
30626 uint64_t ret_ref = 0;
30627 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30628 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30629 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30630 ret_ref = (uint64_t)ret_var.inner;
30631 if (ret_var.is_owned) {
30637 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_verify(uint32_t this_arg, uint32_t funding_outpoint) {
30638 LDKClosingTransaction this_arg_conv;
30639 this_arg_conv.inner = (void*)(this_arg & (~1));
30640 this_arg_conv.is_owned = false;
30641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30642 LDKOutPoint funding_outpoint_conv;
30643 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
30644 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
30645 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
30646 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
30647 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
30648 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
30649 return (uint64_t)ret_conv;
30652 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_value_sat(uint32_t this_arg) {
30653 LDKClosingTransaction this_arg_conv;
30654 this_arg_conv.inner = (void*)(this_arg & (~1));
30655 this_arg_conv.is_owned = false;
30656 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30657 int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
30661 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_value_sat(uint32_t this_arg) {
30662 LDKClosingTransaction this_arg_conv;
30663 this_arg_conv.inner = (void*)(this_arg & (~1));
30664 this_arg_conv.is_owned = false;
30665 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30666 int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
30670 int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_script(uint32_t this_arg) {
30671 LDKClosingTransaction this_arg_conv;
30672 this_arg_conv.inner = (void*)(this_arg & (~1));
30673 this_arg_conv.is_owned = false;
30674 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30675 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
30676 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30677 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30681 int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_script(uint32_t this_arg) {
30682 LDKClosingTransaction this_arg_conv;
30683 this_arg_conv.inner = (void*)(this_arg & (~1));
30684 this_arg_conv.is_owned = false;
30685 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30686 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
30687 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30688 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30692 void __attribute__((visibility("default"))) TS_TrustedClosingTransaction_free(uint32_t this_obj) {
30693 LDKTrustedClosingTransaction this_obj_conv;
30694 this_obj_conv.inner = (void*)(this_obj & (~1));
30695 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30696 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30697 TrustedClosingTransaction_free(this_obj_conv);
30700 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_built_transaction(uint32_t this_arg) {
30701 LDKTrustedClosingTransaction this_arg_conv;
30702 this_arg_conv.inner = (void*)(this_arg & (~1));
30703 this_arg_conv.is_owned = false;
30704 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30705 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
30706 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30707 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30708 Transaction_free(ret_var);
30712 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
30713 LDKTrustedClosingTransaction this_arg_conv;
30714 this_arg_conv.inner = (void*)(this_arg & (~1));
30715 this_arg_conv.is_owned = false;
30716 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30717 LDKu8slice funding_redeemscript_ref;
30718 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
30719 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
30720 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
30721 memcpy((uint8_t*)(ret_arr + 4), TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
30725 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_sign(uint32_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
30726 LDKTrustedClosingTransaction this_arg_conv;
30727 this_arg_conv.inner = (void*)(this_arg & (~1));
30728 this_arg_conv.is_owned = false;
30729 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30730 unsigned char funding_key_arr[32];
30731 CHECK(*((uint32_t*)funding_key) == 32);
30732 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
30733 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
30734 LDKu8slice funding_redeemscript_ref;
30735 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
30736 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
30737 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
30738 memcpy((uint8_t*)(ret_arr + 4), TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
30742 void __attribute__((visibility("default"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
30743 LDKCommitmentTransaction this_obj_conv;
30744 this_obj_conv.inner = (void*)(this_obj & (~1));
30745 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30746 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30747 CommitmentTransaction_free(this_obj_conv);
30750 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
30751 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
30752 uint64_t ret_ref = 0;
30753 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30754 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30755 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30756 ret_ref = (uint64_t)ret_var.inner;
30757 if (ret_var.is_owned) {
30762 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_clone_ptr(uint32_t arg) {
30763 LDKCommitmentTransaction arg_conv;
30764 arg_conv.inner = (void*)(arg & (~1));
30765 arg_conv.is_owned = false;
30766 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30767 int64_t ret_val = CommitmentTransaction_clone_ptr(&arg_conv);
30771 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_clone(uint32_t orig) {
30772 LDKCommitmentTransaction orig_conv;
30773 orig_conv.inner = (void*)(orig & (~1));
30774 orig_conv.is_owned = false;
30775 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30776 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
30777 uint64_t ret_ref = 0;
30778 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30779 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30780 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30781 ret_ref = (uint64_t)ret_var.inner;
30782 if (ret_var.is_owned) {
30788 int8_tArray __attribute__((visibility("default"))) TS_CommitmentTransaction_write(uint32_t obj) {
30789 LDKCommitmentTransaction obj_conv;
30790 obj_conv.inner = (void*)(obj & (~1));
30791 obj_conv.is_owned = false;
30792 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30793 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
30794 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30795 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30796 CVec_u8Z_free(ret_var);
30800 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_read(int8_tArray ser) {
30801 LDKu8slice ser_ref;
30802 ser_ref.datalen = *((uint32_t*)ser);
30803 ser_ref.data = (int8_t*)(ser + 4);
30804 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
30805 *ret_conv = CommitmentTransaction_read(ser_ref);
30806 return (uint64_t)ret_conv;
30809 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
30810 LDKCommitmentTransaction this_arg_conv;
30811 this_arg_conv.inner = (void*)(this_arg & (~1));
30812 this_arg_conv.is_owned = false;
30813 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30814 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
30818 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
30819 LDKCommitmentTransaction this_arg_conv;
30820 this_arg_conv.inner = (void*)(this_arg & (~1));
30821 this_arg_conv.is_owned = false;
30822 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30823 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
30827 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
30828 LDKCommitmentTransaction this_arg_conv;
30829 this_arg_conv.inner = (void*)(this_arg & (~1));
30830 this_arg_conv.is_owned = false;
30831 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30832 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
30836 int32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
30837 LDKCommitmentTransaction this_arg_conv;
30838 this_arg_conv.inner = (void*)(this_arg & (~1));
30839 this_arg_conv.is_owned = false;
30840 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30841 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
30845 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
30846 LDKCommitmentTransaction this_arg_conv;
30847 this_arg_conv.inner = (void*)(this_arg & (~1));
30848 this_arg_conv.is_owned = false;
30849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30850 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
30851 uint64_t ret_ref = 0;
30852 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30853 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30854 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30855 ret_ref = (uint64_t)ret_var.inner;
30856 if (ret_var.is_owned) {
30862 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_verify(uint32_t this_arg, uint32_t channel_parameters, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
30863 LDKCommitmentTransaction this_arg_conv;
30864 this_arg_conv.inner = (void*)(this_arg & (~1));
30865 this_arg_conv.is_owned = false;
30866 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30867 LDKDirectedChannelTransactionParameters channel_parameters_conv;
30868 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
30869 channel_parameters_conv.is_owned = false;
30870 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
30871 LDKChannelPublicKeys broadcaster_keys_conv;
30872 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
30873 broadcaster_keys_conv.is_owned = false;
30874 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
30875 LDKChannelPublicKeys countersignatory_keys_conv;
30876 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
30877 countersignatory_keys_conv.is_owned = false;
30878 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
30879 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
30880 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
30881 return (uint64_t)ret_conv;
30884 void __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_free(uint32_t this_obj) {
30885 LDKTrustedCommitmentTransaction this_obj_conv;
30886 this_obj_conv.inner = (void*)(this_obj & (~1));
30887 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30888 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30889 TrustedCommitmentTransaction_free(this_obj_conv);
30892 int8_tArray __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
30893 LDKTrustedCommitmentTransaction this_arg_conv;
30894 this_arg_conv.inner = (void*)(this_arg & (~1));
30895 this_arg_conv.is_owned = false;
30896 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30897 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
30898 memcpy((uint8_t*)(ret_arr + 4), TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
30902 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
30903 LDKTrustedCommitmentTransaction this_arg_conv;
30904 this_arg_conv.inner = (void*)(this_arg & (~1));
30905 this_arg_conv.is_owned = false;
30906 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30907 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
30908 uint64_t ret_ref = 0;
30909 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30910 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30911 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30912 ret_ref = (uint64_t)ret_var.inner;
30913 if (ret_var.is_owned) {
30919 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
30920 LDKTrustedCommitmentTransaction this_arg_conv;
30921 this_arg_conv.inner = (void*)(this_arg & (~1));
30922 this_arg_conv.is_owned = false;
30923 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30924 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
30925 uint64_t ret_ref = 0;
30926 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30927 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30928 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30929 ret_ref = (uint64_t)ret_var.inner;
30930 if (ret_var.is_owned) {
30936 jboolean __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_opt_anchors(uint32_t this_arg) {
30937 LDKTrustedCommitmentTransaction this_arg_conv;
30938 this_arg_conv.inner = (void*)(this_arg & (~1));
30939 this_arg_conv.is_owned = false;
30940 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30941 jboolean ret_val = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
30945 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) {
30946 LDKTrustedCommitmentTransaction this_arg_conv;
30947 this_arg_conv.inner = (void*)(this_arg & (~1));
30948 this_arg_conv.is_owned = false;
30949 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30950 unsigned char htlc_base_key_arr[32];
30951 CHECK(*((uint32_t*)htlc_base_key) == 32);
30952 memcpy(htlc_base_key_arr, (uint8_t*)(htlc_base_key + 4), 32);
30953 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
30954 LDKDirectedChannelTransactionParameters channel_parameters_conv;
30955 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
30956 channel_parameters_conv.is_owned = false;
30957 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
30958 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
30959 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
30960 return (uint64_t)ret_conv;
30963 int64_t __attribute__((visibility("default"))) TS_get_commitment_transaction_number_obscure_factor(int8_tArray broadcaster_payment_basepoint, int8_tArray countersignatory_payment_basepoint, jboolean outbound_from_broadcaster) {
30964 LDKPublicKey broadcaster_payment_basepoint_ref;
30965 CHECK(*((uint32_t*)broadcaster_payment_basepoint) == 33);
30966 memcpy(broadcaster_payment_basepoint_ref.compressed_form, (uint8_t*)(broadcaster_payment_basepoint + 4), 33);
30967 LDKPublicKey countersignatory_payment_basepoint_ref;
30968 CHECK(*((uint32_t*)countersignatory_payment_basepoint) == 33);
30969 memcpy(countersignatory_payment_basepoint_ref.compressed_form, (uint8_t*)(countersignatory_payment_basepoint + 4), 33);
30970 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
30974 jboolean __attribute__((visibility("default"))) TS_InitFeatures_eq(uint32_t a, uint32_t b) {
30975 LDKInitFeatures a_conv;
30976 a_conv.inner = (void*)(a & (~1));
30977 a_conv.is_owned = false;
30978 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30979 LDKInitFeatures b_conv;
30980 b_conv.inner = (void*)(b & (~1));
30981 b_conv.is_owned = false;
30982 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30983 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
30987 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_eq(uint32_t a, uint32_t b) {
30988 LDKNodeFeatures a_conv;
30989 a_conv.inner = (void*)(a & (~1));
30990 a_conv.is_owned = false;
30991 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30992 LDKNodeFeatures b_conv;
30993 b_conv.inner = (void*)(b & (~1));
30994 b_conv.is_owned = false;
30995 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30996 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
31000 jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_eq(uint32_t a, uint32_t b) {
31001 LDKChannelFeatures a_conv;
31002 a_conv.inner = (void*)(a & (~1));
31003 a_conv.is_owned = false;
31004 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31005 LDKChannelFeatures b_conv;
31006 b_conv.inner = (void*)(b & (~1));
31007 b_conv.is_owned = false;
31008 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31009 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
31013 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_eq(uint32_t a, uint32_t b) {
31014 LDKInvoiceFeatures a_conv;
31015 a_conv.inner = (void*)(a & (~1));
31016 a_conv.is_owned = false;
31017 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31018 LDKInvoiceFeatures b_conv;
31019 b_conv.inner = (void*)(b & (~1));
31020 b_conv.is_owned = false;
31021 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31022 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
31026 jboolean __attribute__((visibility("default"))) TS_ChannelTypeFeatures_eq(uint32_t a, uint32_t b) {
31027 LDKChannelTypeFeatures a_conv;
31028 a_conv.inner = (void*)(a & (~1));
31029 a_conv.is_owned = false;
31030 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31031 LDKChannelTypeFeatures b_conv;
31032 b_conv.inner = (void*)(b & (~1));
31033 b_conv.is_owned = false;
31034 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31035 jboolean ret_val = ChannelTypeFeatures_eq(&a_conv, &b_conv);
31039 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
31040 LDKInitFeatures ret_var = InitFeatures_clone(arg);
31041 uint64_t ret_ref = 0;
31042 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31043 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31044 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31045 ret_ref = (uint64_t)ret_var.inner;
31046 if (ret_var.is_owned) {
31051 int64_t __attribute__((visibility("default"))) TS_InitFeatures_clone_ptr(uint32_t arg) {
31052 LDKInitFeatures arg_conv;
31053 arg_conv.inner = (void*)(arg & (~1));
31054 arg_conv.is_owned = false;
31055 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31056 int64_t ret_val = InitFeatures_clone_ptr(&arg_conv);
31060 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_clone(uint32_t orig) {
31061 LDKInitFeatures orig_conv;
31062 orig_conv.inner = (void*)(orig & (~1));
31063 orig_conv.is_owned = false;
31064 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31065 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
31066 uint64_t ret_ref = 0;
31067 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31068 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31069 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31070 ret_ref = (uint64_t)ret_var.inner;
31071 if (ret_var.is_owned) {
31077 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
31078 LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
31079 uint64_t ret_ref = 0;
31080 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31081 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31082 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31083 ret_ref = (uint64_t)ret_var.inner;
31084 if (ret_var.is_owned) {
31089 int64_t __attribute__((visibility("default"))) TS_NodeFeatures_clone_ptr(uint32_t arg) {
31090 LDKNodeFeatures arg_conv;
31091 arg_conv.inner = (void*)(arg & (~1));
31092 arg_conv.is_owned = false;
31093 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31094 int64_t ret_val = NodeFeatures_clone_ptr(&arg_conv);
31098 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_clone(uint32_t orig) {
31099 LDKNodeFeatures orig_conv;
31100 orig_conv.inner = (void*)(orig & (~1));
31101 orig_conv.is_owned = false;
31102 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31103 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
31104 uint64_t ret_ref = 0;
31105 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31106 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31107 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31108 ret_ref = (uint64_t)ret_var.inner;
31109 if (ret_var.is_owned) {
31115 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
31116 LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
31117 uint64_t ret_ref = 0;
31118 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31119 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31120 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31121 ret_ref = (uint64_t)ret_var.inner;
31122 if (ret_var.is_owned) {
31127 int64_t __attribute__((visibility("default"))) TS_ChannelFeatures_clone_ptr(uint32_t arg) {
31128 LDKChannelFeatures arg_conv;
31129 arg_conv.inner = (void*)(arg & (~1));
31130 arg_conv.is_owned = false;
31131 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31132 int64_t ret_val = ChannelFeatures_clone_ptr(&arg_conv);
31136 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_clone(uint32_t orig) {
31137 LDKChannelFeatures orig_conv;
31138 orig_conv.inner = (void*)(orig & (~1));
31139 orig_conv.is_owned = false;
31140 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31141 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
31142 uint64_t ret_ref = 0;
31143 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31144 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31145 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31146 ret_ref = (uint64_t)ret_var.inner;
31147 if (ret_var.is_owned) {
31153 static inline uint64_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
31154 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
31155 uint64_t ret_ref = 0;
31156 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31157 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31158 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31159 ret_ref = (uint64_t)ret_var.inner;
31160 if (ret_var.is_owned) {
31165 int64_t __attribute__((visibility("default"))) TS_InvoiceFeatures_clone_ptr(uint32_t arg) {
31166 LDKInvoiceFeatures arg_conv;
31167 arg_conv.inner = (void*)(arg & (~1));
31168 arg_conv.is_owned = false;
31169 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31170 int64_t ret_val = InvoiceFeatures_clone_ptr(&arg_conv);
31174 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_clone(uint32_t orig) {
31175 LDKInvoiceFeatures orig_conv;
31176 orig_conv.inner = (void*)(orig & (~1));
31177 orig_conv.is_owned = false;
31178 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31179 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
31180 uint64_t ret_ref = 0;
31181 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31182 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31183 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31184 ret_ref = (uint64_t)ret_var.inner;
31185 if (ret_var.is_owned) {
31191 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
31192 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
31193 uint64_t ret_ref = 0;
31194 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31195 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31196 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31197 ret_ref = (uint64_t)ret_var.inner;
31198 if (ret_var.is_owned) {
31203 int64_t __attribute__((visibility("default"))) TS_ChannelTypeFeatures_clone_ptr(uint32_t arg) {
31204 LDKChannelTypeFeatures arg_conv;
31205 arg_conv.inner = (void*)(arg & (~1));
31206 arg_conv.is_owned = false;
31207 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31208 int64_t ret_val = ChannelTypeFeatures_clone_ptr(&arg_conv);
31212 uint32_t __attribute__((visibility("default"))) TS_ChannelTypeFeatures_clone(uint32_t orig) {
31213 LDKChannelTypeFeatures orig_conv;
31214 orig_conv.inner = (void*)(orig & (~1));
31215 orig_conv.is_owned = false;
31216 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31217 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
31218 uint64_t ret_ref = 0;
31219 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31220 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31221 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31222 ret_ref = (uint64_t)ret_var.inner;
31223 if (ret_var.is_owned) {
31229 void __attribute__((visibility("default"))) TS_InitFeatures_free(uint32_t this_obj) {
31230 LDKInitFeatures this_obj_conv;
31231 this_obj_conv.inner = (void*)(this_obj & (~1));
31232 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31233 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31234 InitFeatures_free(this_obj_conv);
31237 void __attribute__((visibility("default"))) TS_NodeFeatures_free(uint32_t this_obj) {
31238 LDKNodeFeatures this_obj_conv;
31239 this_obj_conv.inner = (void*)(this_obj & (~1));
31240 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31241 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31242 NodeFeatures_free(this_obj_conv);
31245 void __attribute__((visibility("default"))) TS_ChannelFeatures_free(uint32_t this_obj) {
31246 LDKChannelFeatures this_obj_conv;
31247 this_obj_conv.inner = (void*)(this_obj & (~1));
31248 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31249 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31250 ChannelFeatures_free(this_obj_conv);
31253 void __attribute__((visibility("default"))) TS_InvoiceFeatures_free(uint32_t this_obj) {
31254 LDKInvoiceFeatures this_obj_conv;
31255 this_obj_conv.inner = (void*)(this_obj & (~1));
31256 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31257 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31258 InvoiceFeatures_free(this_obj_conv);
31261 void __attribute__((visibility("default"))) TS_ChannelTypeFeatures_free(uint32_t this_obj) {
31262 LDKChannelTypeFeatures this_obj_conv;
31263 this_obj_conv.inner = (void*)(this_obj & (~1));
31264 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31265 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31266 ChannelTypeFeatures_free(this_obj_conv);
31269 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_empty() {
31270 LDKInitFeatures ret_var = InitFeatures_empty();
31271 uint64_t ret_ref = 0;
31272 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31273 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31274 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31275 ret_ref = (uint64_t)ret_var.inner;
31276 if (ret_var.is_owned) {
31282 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_known() {
31283 LDKInitFeatures ret_var = InitFeatures_known();
31284 uint64_t ret_ref = 0;
31285 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31286 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31287 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31288 ret_ref = (uint64_t)ret_var.inner;
31289 if (ret_var.is_owned) {
31295 jboolean __attribute__((visibility("default"))) TS_InitFeatures_requires_unknown_bits(uint32_t this_arg) {
31296 LDKInitFeatures this_arg_conv;
31297 this_arg_conv.inner = (void*)(this_arg & (~1));
31298 this_arg_conv.is_owned = false;
31299 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31300 jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
31304 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_empty() {
31305 LDKNodeFeatures ret_var = NodeFeatures_empty();
31306 uint64_t ret_ref = 0;
31307 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31308 CHECK((((uint64_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 = (uint64_t)ret_var.inner;
31311 if (ret_var.is_owned) {
31317 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_known() {
31318 LDKNodeFeatures ret_var = NodeFeatures_known();
31319 uint64_t ret_ref = 0;
31320 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31321 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31322 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31323 ret_ref = (uint64_t)ret_var.inner;
31324 if (ret_var.is_owned) {
31330 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_requires_unknown_bits(uint32_t this_arg) {
31331 LDKNodeFeatures this_arg_conv;
31332 this_arg_conv.inner = (void*)(this_arg & (~1));
31333 this_arg_conv.is_owned = false;
31334 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31335 jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
31339 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_empty() {
31340 LDKChannelFeatures ret_var = ChannelFeatures_empty();
31341 uint64_t ret_ref = 0;
31342 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31343 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31344 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31345 ret_ref = (uint64_t)ret_var.inner;
31346 if (ret_var.is_owned) {
31352 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_known() {
31353 LDKChannelFeatures ret_var = ChannelFeatures_known();
31354 uint64_t ret_ref = 0;
31355 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31356 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31357 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31358 ret_ref = (uint64_t)ret_var.inner;
31359 if (ret_var.is_owned) {
31365 jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_requires_unknown_bits(uint32_t this_arg) {
31366 LDKChannelFeatures this_arg_conv;
31367 this_arg_conv.inner = (void*)(this_arg & (~1));
31368 this_arg_conv.is_owned = false;
31369 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31370 jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
31374 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_empty() {
31375 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
31376 uint64_t ret_ref = 0;
31377 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31378 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31379 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31380 ret_ref = (uint64_t)ret_var.inner;
31381 if (ret_var.is_owned) {
31387 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_known() {
31388 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
31389 uint64_t ret_ref = 0;
31390 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31391 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31392 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31393 ret_ref = (uint64_t)ret_var.inner;
31394 if (ret_var.is_owned) {
31400 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_requires_unknown_bits(uint32_t this_arg) {
31401 LDKInvoiceFeatures this_arg_conv;
31402 this_arg_conv.inner = (void*)(this_arg & (~1));
31403 this_arg_conv.is_owned = false;
31404 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31405 jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
31409 uint32_t __attribute__((visibility("default"))) TS_ChannelTypeFeatures_empty() {
31410 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
31411 uint64_t ret_ref = 0;
31412 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31413 CHECK((((uint64_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 = (uint64_t)ret_var.inner;
31416 if (ret_var.is_owned) {
31422 uint32_t __attribute__((visibility("default"))) TS_ChannelTypeFeatures_known() {
31423 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
31424 uint64_t ret_ref = 0;
31425 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31426 CHECK((((uint64_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 = (uint64_t)ret_var.inner;
31429 if (ret_var.is_owned) {
31435 jboolean __attribute__((visibility("default"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint32_t this_arg) {
31436 LDKChannelTypeFeatures this_arg_conv;
31437 this_arg_conv.inner = (void*)(this_arg & (~1));
31438 this_arg_conv.is_owned = false;
31439 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31440 jboolean ret_val = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
31444 int8_tArray __attribute__((visibility("default"))) TS_InitFeatures_write(uint32_t obj) {
31445 LDKInitFeatures obj_conv;
31446 obj_conv.inner = (void*)(obj & (~1));
31447 obj_conv.is_owned = false;
31448 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31449 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
31450 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
31451 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
31452 CVec_u8Z_free(ret_var);
31456 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_read(int8_tArray ser) {
31457 LDKu8slice ser_ref;
31458 ser_ref.datalen = *((uint32_t*)ser);
31459 ser_ref.data = (int8_t*)(ser + 4);
31460 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
31461 *ret_conv = InitFeatures_read(ser_ref);
31462 return (uint64_t)ret_conv;
31465 int8_tArray __attribute__((visibility("default"))) TS_ChannelFeatures_write(uint32_t obj) {
31466 LDKChannelFeatures obj_conv;
31467 obj_conv.inner = (void*)(obj & (~1));
31468 obj_conv.is_owned = false;
31469 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31470 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
31471 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
31472 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
31473 CVec_u8Z_free(ret_var);
31477 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_read(int8_tArray ser) {
31478 LDKu8slice ser_ref;
31479 ser_ref.datalen = *((uint32_t*)ser);
31480 ser_ref.data = (int8_t*)(ser + 4);
31481 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
31482 *ret_conv = ChannelFeatures_read(ser_ref);
31483 return (uint64_t)ret_conv;
31486 int8_tArray __attribute__((visibility("default"))) TS_NodeFeatures_write(uint32_t obj) {
31487 LDKNodeFeatures obj_conv;
31488 obj_conv.inner = (void*)(obj & (~1));
31489 obj_conv.is_owned = false;
31490 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31491 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
31492 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
31493 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
31494 CVec_u8Z_free(ret_var);
31498 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_read(int8_tArray ser) {
31499 LDKu8slice ser_ref;
31500 ser_ref.datalen = *((uint32_t*)ser);
31501 ser_ref.data = (int8_t*)(ser + 4);
31502 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
31503 *ret_conv = NodeFeatures_read(ser_ref);
31504 return (uint64_t)ret_conv;
31507 int8_tArray __attribute__((visibility("default"))) TS_InvoiceFeatures_write(uint32_t obj) {
31508 LDKInvoiceFeatures obj_conv;
31509 obj_conv.inner = (void*)(obj & (~1));
31510 obj_conv.is_owned = false;
31511 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31512 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
31513 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
31514 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
31515 CVec_u8Z_free(ret_var);
31519 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_read(int8_tArray ser) {
31520 LDKu8slice ser_ref;
31521 ser_ref.datalen = *((uint32_t*)ser);
31522 ser_ref.data = (int8_t*)(ser + 4);
31523 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
31524 *ret_conv = InvoiceFeatures_read(ser_ref);
31525 return (uint64_t)ret_conv;
31528 int8_tArray __attribute__((visibility("default"))) TS_ChannelTypeFeatures_write(uint32_t obj) {
31529 LDKChannelTypeFeatures obj_conv;
31530 obj_conv.inner = (void*)(obj & (~1));
31531 obj_conv.is_owned = false;
31532 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31533 LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
31534 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
31535 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
31536 CVec_u8Z_free(ret_var);
31540 uint32_t __attribute__((visibility("default"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
31541 LDKu8slice ser_ref;
31542 ser_ref.datalen = *((uint32_t*)ser);
31543 ser_ref.data = (int8_t*)(ser + 4);
31544 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
31545 *ret_conv = ChannelTypeFeatures_read(ser_ref);
31546 return (uint64_t)ret_conv;
31549 void __attribute__((visibility("default"))) TS_ShutdownScript_free(uint32_t this_obj) {
31550 LDKShutdownScript this_obj_conv;
31551 this_obj_conv.inner = (void*)(this_obj & (~1));
31552 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31553 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31554 ShutdownScript_free(this_obj_conv);
31557 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
31558 LDKShutdownScript ret_var = ShutdownScript_clone(arg);
31559 uint64_t ret_ref = 0;
31560 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31561 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31562 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31563 ret_ref = (uint64_t)ret_var.inner;
31564 if (ret_var.is_owned) {
31569 int64_t __attribute__((visibility("default"))) TS_ShutdownScript_clone_ptr(uint32_t arg) {
31570 LDKShutdownScript arg_conv;
31571 arg_conv.inner = (void*)(arg & (~1));
31572 arg_conv.is_owned = false;
31573 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31574 int64_t ret_val = ShutdownScript_clone_ptr(&arg_conv);
31578 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_clone(uint32_t orig) {
31579 LDKShutdownScript orig_conv;
31580 orig_conv.inner = (void*)(orig & (~1));
31581 orig_conv.is_owned = false;
31582 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31583 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
31584 uint64_t ret_ref = 0;
31585 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31586 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31587 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31588 ret_ref = (uint64_t)ret_var.inner;
31589 if (ret_var.is_owned) {
31595 void __attribute__((visibility("default"))) TS_InvalidShutdownScript_free(uint32_t this_obj) {
31596 LDKInvalidShutdownScript this_obj_conv;
31597 this_obj_conv.inner = (void*)(this_obj & (~1));
31598 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31599 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31600 InvalidShutdownScript_free(this_obj_conv);
31603 int8_tArray __attribute__((visibility("default"))) TS_InvalidShutdownScript_get_script(uint32_t this_ptr) {
31604 LDKInvalidShutdownScript this_ptr_conv;
31605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31606 this_ptr_conv.is_owned = false;
31607 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31608 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
31609 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
31610 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
31614 void __attribute__((visibility("default"))) TS_InvalidShutdownScript_set_script(uint32_t this_ptr, int8_tArray val) {
31615 LDKInvalidShutdownScript this_ptr_conv;
31616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31617 this_ptr_conv.is_owned = false;
31618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31619 LDKCVec_u8Z val_ref;
31620 val_ref.datalen = *((uint32_t*)val);
31621 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
31622 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
31623 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
31626 uint32_t __attribute__((visibility("default"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
31627 LDKCVec_u8Z script_arg_ref;
31628 script_arg_ref.datalen = *((uint32_t*)script_arg);
31629 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
31630 memcpy(script_arg_ref.data, (uint8_t*)(script_arg + 4), script_arg_ref.datalen);
31631 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
31632 uint64_t ret_ref = 0;
31633 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31634 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31635 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31636 ret_ref = (uint64_t)ret_var.inner;
31637 if (ret_var.is_owned) {
31643 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
31644 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
31645 uint64_t ret_ref = 0;
31646 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31647 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31648 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31649 ret_ref = (uint64_t)ret_var.inner;
31650 if (ret_var.is_owned) {
31655 int64_t __attribute__((visibility("default"))) TS_InvalidShutdownScript_clone_ptr(uint32_t arg) {
31656 LDKInvalidShutdownScript arg_conv;
31657 arg_conv.inner = (void*)(arg & (~1));
31658 arg_conv.is_owned = false;
31659 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31660 int64_t ret_val = InvalidShutdownScript_clone_ptr(&arg_conv);
31664 uint32_t __attribute__((visibility("default"))) TS_InvalidShutdownScript_clone(uint32_t orig) {
31665 LDKInvalidShutdownScript orig_conv;
31666 orig_conv.inner = (void*)(orig & (~1));
31667 orig_conv.is_owned = false;
31668 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31669 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
31670 uint64_t ret_ref = 0;
31671 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31672 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31673 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31674 ret_ref = (uint64_t)ret_var.inner;
31675 if (ret_var.is_owned) {
31681 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_write(uint32_t obj) {
31682 LDKShutdownScript obj_conv;
31683 obj_conv.inner = (void*)(obj & (~1));
31684 obj_conv.is_owned = false;
31685 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31686 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
31687 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
31688 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
31689 CVec_u8Z_free(ret_var);
31693 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_read(int8_tArray ser) {
31694 LDKu8slice ser_ref;
31695 ser_ref.datalen = *((uint32_t*)ser);
31696 ser_ref.data = (int8_t*)(ser + 4);
31697 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31698 *ret_conv = ShutdownScript_read(ser_ref);
31699 return (uint64_t)ret_conv;
31702 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
31703 unsigned char pubkey_hash_arr[20];
31704 CHECK(*((uint32_t*)pubkey_hash) == 20);
31705 memcpy(pubkey_hash_arr, (uint8_t*)(pubkey_hash + 4), 20);
31706 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
31707 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
31708 uint64_t ret_ref = 0;
31709 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31710 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31711 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31712 ret_ref = (uint64_t)ret_var.inner;
31713 if (ret_var.is_owned) {
31719 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
31720 unsigned char script_hash_arr[32];
31721 CHECK(*((uint32_t*)script_hash) == 32);
31722 memcpy(script_hash_arr, (uint8_t*)(script_hash + 4), 32);
31723 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
31724 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
31725 uint64_t ret_ref = 0;
31726 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31727 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31728 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31729 ret_ref = (uint64_t)ret_var.inner;
31730 if (ret_var.is_owned) {
31736 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
31737 LDKu8slice program_ref;
31738 program_ref.datalen = *((uint32_t*)program);
31739 program_ref.data = (int8_t*)(program + 4);
31740 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31741 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
31742 return (uint64_t)ret_conv;
31745 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_into_inner(uint32_t this_arg) {
31746 LDKShutdownScript this_arg_conv;
31747 this_arg_conv.inner = (void*)(this_arg & (~1));
31748 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
31749 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31750 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
31751 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
31752 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
31753 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
31754 CVec_u8Z_free(ret_var);
31758 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_as_legacy_pubkey(uint32_t this_arg) {
31759 LDKShutdownScript this_arg_conv;
31760 this_arg_conv.inner = (void*)(this_arg & (~1));
31761 this_arg_conv.is_owned = false;
31762 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31763 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
31764 memcpy((uint8_t*)(ret_arr + 4), ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
31768 jboolean __attribute__((visibility("default"))) TS_ShutdownScript_is_compatible(uint32_t this_arg, uint32_t features) {
31769 LDKShutdownScript this_arg_conv;
31770 this_arg_conv.inner = (void*)(this_arg & (~1));
31771 this_arg_conv.is_owned = false;
31772 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31773 LDKInitFeatures features_conv;
31774 features_conv.inner = (void*)(features & (~1));
31775 features_conv.is_owned = false;
31776 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
31777 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
31781 void __attribute__((visibility("default"))) TS_CustomMessageReader_free(uint32_t this_ptr) {
31782 if ((this_ptr & 1) != 0) return;
31783 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
31784 CHECK_ACCESS(this_ptr_ptr);
31785 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
31786 FREE((void*)this_ptr);
31787 CustomMessageReader_free(this_ptr_conv);
31790 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
31791 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
31792 *ret_ret = Type_clone(arg);
31793 return (uint64_t)ret_ret;
31795 int64_t __attribute__((visibility("default"))) TS_Type_clone_ptr(uint32_t arg) {
31796 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
31797 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
31798 LDKType* arg_conv = (LDKType*)arg_ptr;
31799 int64_t ret_val = Type_clone_ptr(arg_conv);
31803 uint32_t __attribute__((visibility("default"))) TS_Type_clone(uint32_t orig) {
31804 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
31805 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
31806 LDKType* orig_conv = (LDKType*)orig_ptr;
31807 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
31808 *ret_ret = Type_clone(orig_conv);
31809 return (uint64_t)ret_ret;
31812 void __attribute__((visibility("default"))) TS_Type_free(uint32_t this_ptr) {
31813 if ((this_ptr & 1) != 0) return;
31814 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
31815 CHECK_ACCESS(this_ptr_ptr);
31816 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
31817 FREE((void*)this_ptr);
31818 Type_free(this_ptr_conv);
31821 void __attribute__((visibility("default"))) TS_NodeId_free(uint32_t this_obj) {
31822 LDKNodeId this_obj_conv;
31823 this_obj_conv.inner = (void*)(this_obj & (~1));
31824 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31825 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31826 NodeId_free(this_obj_conv);
31829 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
31830 LDKNodeId ret_var = NodeId_clone(arg);
31831 uint64_t ret_ref = 0;
31832 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31833 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31834 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31835 ret_ref = (uint64_t)ret_var.inner;
31836 if (ret_var.is_owned) {
31841 int64_t __attribute__((visibility("default"))) TS_NodeId_clone_ptr(uint32_t arg) {
31842 LDKNodeId arg_conv;
31843 arg_conv.inner = (void*)(arg & (~1));
31844 arg_conv.is_owned = false;
31845 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31846 int64_t ret_val = NodeId_clone_ptr(&arg_conv);
31850 uint32_t __attribute__((visibility("default"))) TS_NodeId_clone(uint32_t orig) {
31851 LDKNodeId orig_conv;
31852 orig_conv.inner = (void*)(orig & (~1));
31853 orig_conv.is_owned = false;
31854 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31855 LDKNodeId ret_var = NodeId_clone(&orig_conv);
31856 uint64_t ret_ref = 0;
31857 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31858 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31859 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31860 ret_ref = (uint64_t)ret_var.inner;
31861 if (ret_var.is_owned) {
31867 uint32_t __attribute__((visibility("default"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
31868 LDKPublicKey pubkey_ref;
31869 CHECK(*((uint32_t*)pubkey) == 33);
31870 memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33);
31871 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
31872 uint64_t ret_ref = 0;
31873 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31874 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31875 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31876 ret_ref = (uint64_t)ret_var.inner;
31877 if (ret_var.is_owned) {
31883 int8_tArray __attribute__((visibility("default"))) TS_NodeId_as_slice(uint32_t this_arg) {
31884 LDKNodeId this_arg_conv;
31885 this_arg_conv.inner = (void*)(this_arg & (~1));
31886 this_arg_conv.is_owned = false;
31887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31888 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
31889 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
31890 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
31894 int64_t __attribute__((visibility("default"))) TS_NodeId_hash(uint32_t o) {
31896 o_conv.inner = (void*)(o & (~1));
31897 o_conv.is_owned = false;
31898 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31899 int64_t ret_val = NodeId_hash(&o_conv);
31903 int8_tArray __attribute__((visibility("default"))) TS_NodeId_write(uint32_t obj) {
31904 LDKNodeId obj_conv;
31905 obj_conv.inner = (void*)(obj & (~1));
31906 obj_conv.is_owned = false;
31907 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31908 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
31909 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
31910 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
31911 CVec_u8Z_free(ret_var);
31915 uint32_t __attribute__((visibility("default"))) TS_NodeId_read(int8_tArray ser) {
31916 LDKu8slice ser_ref;
31917 ser_ref.datalen = *((uint32_t*)ser);
31918 ser_ref.data = (int8_t*)(ser + 4);
31919 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
31920 *ret_conv = NodeId_read(ser_ref);
31921 return (uint64_t)ret_conv;
31924 void __attribute__((visibility("default"))) TS_NetworkGraph_free(uint32_t this_obj) {
31925 LDKNetworkGraph this_obj_conv;
31926 this_obj_conv.inner = (void*)(this_obj & (~1));
31927 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31928 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31929 NetworkGraph_free(this_obj_conv);
31932 static inline uint64_t NetworkGraph_clone_ptr(LDKNetworkGraph *NONNULL_PTR arg) {
31933 LDKNetworkGraph ret_var = NetworkGraph_clone(arg);
31934 uint64_t ret_ref = 0;
31935 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31936 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31937 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31938 ret_ref = (uint64_t)ret_var.inner;
31939 if (ret_var.is_owned) {
31944 int64_t __attribute__((visibility("default"))) TS_NetworkGraph_clone_ptr(uint32_t arg) {
31945 LDKNetworkGraph arg_conv;
31946 arg_conv.inner = (void*)(arg & (~1));
31947 arg_conv.is_owned = false;
31948 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31949 int64_t ret_val = NetworkGraph_clone_ptr(&arg_conv);
31953 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_clone(uint32_t orig) {
31954 LDKNetworkGraph orig_conv;
31955 orig_conv.inner = (void*)(orig & (~1));
31956 orig_conv.is_owned = false;
31957 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31958 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
31959 uint64_t ret_ref = 0;
31960 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31961 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31962 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31963 ret_ref = (uint64_t)ret_var.inner;
31964 if (ret_var.is_owned) {
31970 void __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_free(uint32_t this_obj) {
31971 LDKReadOnlyNetworkGraph this_obj_conv;
31972 this_obj_conv.inner = (void*)(this_obj & (~1));
31973 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31974 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31975 ReadOnlyNetworkGraph_free(this_obj_conv);
31978 void __attribute__((visibility("default"))) TS_NetworkUpdate_free(uint32_t this_ptr) {
31979 if ((this_ptr & 1) != 0) return;
31980 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
31981 CHECK_ACCESS(this_ptr_ptr);
31982 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
31983 FREE((void*)this_ptr);
31984 NetworkUpdate_free(this_ptr_conv);
31987 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
31988 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31989 *ret_copy = NetworkUpdate_clone(arg);
31990 uint64_t ret_ref = (uint64_t)ret_copy;
31993 int64_t __attribute__((visibility("default"))) TS_NetworkUpdate_clone_ptr(uint32_t arg) {
31994 LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)arg;
31995 int64_t ret_val = NetworkUpdate_clone_ptr(arg_conv);
31999 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_clone(uint32_t orig) {
32000 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
32001 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
32002 *ret_copy = NetworkUpdate_clone(orig_conv);
32003 uint64_t ret_ref = (uint64_t)ret_copy;
32007 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_update_message(uint32_t msg) {
32008 LDKChannelUpdate msg_conv;
32009 msg_conv.inner = (void*)(msg & (~1));
32010 msg_conv.is_owned = (msg & 1) || (msg == 0);
32011 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32012 msg_conv = ChannelUpdate_clone(&msg_conv);
32013 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
32014 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
32015 uint64_t ret_ref = (uint64_t)ret_copy;
32019 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_closed(int64_t short_channel_id, jboolean is_permanent) {
32020 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
32021 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
32022 uint64_t ret_ref = (uint64_t)ret_copy;
32026 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
32027 LDKPublicKey node_id_ref;
32028 CHECK(*((uint32_t*)node_id) == 33);
32029 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
32030 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
32031 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
32032 uint64_t ret_ref = (uint64_t)ret_copy;
32036 int8_tArray __attribute__((visibility("default"))) TS_NetworkUpdate_write(uint32_t obj) {
32037 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
32038 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
32039 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
32040 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
32041 CVec_u8Z_free(ret_var);
32045 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_read(int8_tArray ser) {
32046 LDKu8slice ser_ref;
32047 ser_ref.datalen = *((uint32_t*)ser);
32048 ser_ref.data = (int8_t*)(ser + 4);
32049 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
32050 *ret_conv = NetworkUpdate_read(ser_ref);
32051 return (uint64_t)ret_conv;
32054 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_EventHandler(uint32_t this_arg) {
32055 LDKNetGraphMsgHandler this_arg_conv;
32056 this_arg_conv.inner = (void*)(this_arg & (~1));
32057 this_arg_conv.is_owned = false;
32058 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32059 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
32060 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
32061 return (uint64_t)ret_ret;
32064 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) {
32065 LDKNetGraphMsgHandler this_obj_conv;
32066 this_obj_conv.inner = (void*)(this_obj & (~1));
32067 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32068 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32069 NetGraphMsgHandler_free(this_obj_conv);
32072 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(uint32_t network_graph, uint32_t chain_access, uint32_t logger) {
32073 LDKNetworkGraph network_graph_conv;
32074 network_graph_conv.inner = (void*)(network_graph & (~1));
32075 network_graph_conv.is_owned = false;
32076 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
32077 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
32078 CHECK_ACCESS(chain_access_ptr);
32079 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
32080 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
32081 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
32082 // Manually implement clone for Java trait instances
32084 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
32085 CHECK_ACCESS(logger_ptr);
32086 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
32087 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(&network_graph_conv, chain_access_conv, logger_conv);
32088 uint64_t ret_ref = 0;
32089 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32090 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32091 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32092 ret_ref = (uint64_t)ret_var.inner;
32093 if (ret_var.is_owned) {
32099 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
32100 LDKNetGraphMsgHandler this_arg_conv;
32101 this_arg_conv.inner = (void*)(this_arg & (~1));
32102 this_arg_conv.is_owned = false;
32103 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32104 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
32105 CHECK_ACCESS(chain_access_ptr);
32106 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
32107 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
32108 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
32109 // Manually implement clone for Java trait instances
32111 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
32114 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
32115 LDKNetGraphMsgHandler this_arg_conv;
32116 this_arg_conv.inner = (void*)(this_arg & (~1));
32117 this_arg_conv.is_owned = false;
32118 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32119 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
32120 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
32121 return (uint64_t)ret_ret;
32124 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
32125 LDKNetGraphMsgHandler this_arg_conv;
32126 this_arg_conv.inner = (void*)(this_arg & (~1));
32127 this_arg_conv.is_owned = false;
32128 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32129 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
32130 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
32131 return (uint64_t)ret_ret;
32134 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_obj) {
32135 LDKDirectionalChannelInfo this_obj_conv;
32136 this_obj_conv.inner = (void*)(this_obj & (~1));
32137 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32138 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32139 DirectionalChannelInfo_free(this_obj_conv);
32142 int32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) {
32143 LDKDirectionalChannelInfo this_ptr_conv;
32144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32145 this_ptr_conv.is_owned = false;
32146 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32147 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
32151 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) {
32152 LDKDirectionalChannelInfo this_ptr_conv;
32153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32154 this_ptr_conv.is_owned = false;
32155 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32156 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
32159 jboolean __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) {
32160 LDKDirectionalChannelInfo this_ptr_conv;
32161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32162 this_ptr_conv.is_owned = false;
32163 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32164 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
32168 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) {
32169 LDKDirectionalChannelInfo this_ptr_conv;
32170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32171 this_ptr_conv.is_owned = false;
32172 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32173 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
32176 int16_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
32177 LDKDirectionalChannelInfo this_ptr_conv;
32178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32179 this_ptr_conv.is_owned = false;
32180 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32181 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
32185 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
32186 LDKDirectionalChannelInfo this_ptr_conv;
32187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32188 this_ptr_conv.is_owned = false;
32189 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32190 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
32193 int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
32194 LDKDirectionalChannelInfo this_ptr_conv;
32195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32196 this_ptr_conv.is_owned = false;
32197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32198 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
32202 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
32203 LDKDirectionalChannelInfo 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 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
32210 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_maximum_msat(uint32_t this_ptr) {
32211 LDKDirectionalChannelInfo this_ptr_conv;
32212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32213 this_ptr_conv.is_owned = false;
32214 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32215 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32216 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
32217 uint64_t ret_ref = (uint64_t)ret_copy;
32221 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
32222 LDKDirectionalChannelInfo this_ptr_conv;
32223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32224 this_ptr_conv.is_owned = false;
32225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32226 void* val_ptr = (void*)(((uint64_t)val) & ~1);
32227 CHECK_ACCESS(val_ptr);
32228 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
32229 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
32230 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
32233 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) {
32234 LDKDirectionalChannelInfo this_ptr_conv;
32235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32236 this_ptr_conv.is_owned = false;
32237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32238 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
32239 uint64_t ret_ref = 0;
32240 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32241 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32242 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32243 ret_ref = (uint64_t)ret_var.inner;
32244 if (ret_var.is_owned) {
32250 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) {
32251 LDKDirectionalChannelInfo this_ptr_conv;
32252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32253 this_ptr_conv.is_owned = false;
32254 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32255 LDKRoutingFees val_conv;
32256 val_conv.inner = (void*)(val & (~1));
32257 val_conv.is_owned = (val & 1) || (val == 0);
32258 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32259 val_conv = RoutingFees_clone(&val_conv);
32260 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
32263 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) {
32264 LDKDirectionalChannelInfo this_ptr_conv;
32265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32266 this_ptr_conv.is_owned = false;
32267 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32268 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
32269 uint64_t ret_ref = 0;
32270 if ((uint64_t)ret_var.inner > 4096) {
32271 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32272 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32273 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32274 ret_ref = (uint64_t)ret_var.inner;
32275 if (ret_var.is_owned) {
32282 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
32283 LDKDirectionalChannelInfo this_ptr_conv;
32284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32285 this_ptr_conv.is_owned = false;
32286 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32287 LDKChannelUpdate val_conv;
32288 val_conv.inner = (void*)(val & (~1));
32289 val_conv.is_owned = (val & 1) || (val == 0);
32290 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32291 val_conv = ChannelUpdate_clone(&val_conv);
32292 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
32295 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_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) {
32296 void* htlc_maximum_msat_arg_ptr = (void*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
32297 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
32298 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
32299 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
32300 LDKRoutingFees fees_arg_conv;
32301 fees_arg_conv.inner = (void*)(fees_arg & (~1));
32302 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
32303 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
32304 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
32305 LDKChannelUpdate last_update_message_arg_conv;
32306 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
32307 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
32308 CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
32309 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
32310 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_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);
32311 uint64_t ret_ref = 0;
32312 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32313 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32314 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32315 ret_ref = (uint64_t)ret_var.inner;
32316 if (ret_var.is_owned) {
32322 static inline uint64_t DirectionalChannelInfo_clone_ptr(LDKDirectionalChannelInfo *NONNULL_PTR arg) {
32323 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(arg);
32324 uint64_t ret_ref = 0;
32325 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32326 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32327 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32328 ret_ref = (uint64_t)ret_var.inner;
32329 if (ret_var.is_owned) {
32334 int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone_ptr(uint32_t arg) {
32335 LDKDirectionalChannelInfo arg_conv;
32336 arg_conv.inner = (void*)(arg & (~1));
32337 arg_conv.is_owned = false;
32338 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32339 int64_t ret_val = DirectionalChannelInfo_clone_ptr(&arg_conv);
32343 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone(uint32_t orig) {
32344 LDKDirectionalChannelInfo orig_conv;
32345 orig_conv.inner = (void*)(orig & (~1));
32346 orig_conv.is_owned = false;
32347 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32348 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
32349 uint64_t ret_ref = 0;
32350 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32351 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32352 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32353 ret_ref = (uint64_t)ret_var.inner;
32354 if (ret_var.is_owned) {
32360 int8_tArray __attribute__((visibility("default"))) TS_DirectionalChannelInfo_write(uint32_t obj) {
32361 LDKDirectionalChannelInfo obj_conv;
32362 obj_conv.inner = (void*)(obj & (~1));
32363 obj_conv.is_owned = false;
32364 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32365 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
32366 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
32367 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
32368 CVec_u8Z_free(ret_var);
32372 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_read(int8_tArray ser) {
32373 LDKu8slice ser_ref;
32374 ser_ref.datalen = *((uint32_t*)ser);
32375 ser_ref.data = (int8_t*)(ser + 4);
32376 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
32377 *ret_conv = DirectionalChannelInfo_read(ser_ref);
32378 return (uint64_t)ret_conv;
32381 void __attribute__((visibility("default"))) TS_ChannelInfo_free(uint32_t this_obj) {
32382 LDKChannelInfo this_obj_conv;
32383 this_obj_conv.inner = (void*)(this_obj & (~1));
32384 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32385 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32386 ChannelInfo_free(this_obj_conv);
32389 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
32390 LDKChannelInfo this_ptr_conv;
32391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32392 this_ptr_conv.is_owned = false;
32393 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32394 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
32395 uint64_t ret_ref = 0;
32396 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32397 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32398 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32399 ret_ref = (uint64_t)ret_var.inner;
32400 if (ret_var.is_owned) {
32406 void __attribute__((visibility("default"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
32407 LDKChannelInfo 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 LDKChannelFeatures val_conv;
32412 val_conv.inner = (void*)(val & (~1));
32413 val_conv.is_owned = (val & 1) || (val == 0);
32414 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32415 val_conv = ChannelFeatures_clone(&val_conv);
32416 ChannelInfo_set_features(&this_ptr_conv, val_conv);
32419 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
32420 LDKChannelInfo this_ptr_conv;
32421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32422 this_ptr_conv.is_owned = false;
32423 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32424 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
32425 uint64_t ret_ref = 0;
32426 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32427 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32428 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32429 ret_ref = (uint64_t)ret_var.inner;
32430 if (ret_var.is_owned) {
32436 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, uint32_t val) {
32437 LDKChannelInfo this_ptr_conv;
32438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32439 this_ptr_conv.is_owned = false;
32440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32441 LDKNodeId val_conv;
32442 val_conv.inner = (void*)(val & (~1));
32443 val_conv.is_owned = (val & 1) || (val == 0);
32444 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32445 val_conv = NodeId_clone(&val_conv);
32446 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
32449 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
32450 LDKChannelInfo this_ptr_conv;
32451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32452 this_ptr_conv.is_owned = false;
32453 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32454 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
32455 uint64_t ret_ref = 0;
32456 if ((uint64_t)ret_var.inner > 4096) {
32457 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32458 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32459 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32460 ret_ref = (uint64_t)ret_var.inner;
32461 if (ret_var.is_owned) {
32468 void __attribute__((visibility("default"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
32469 LDKChannelInfo this_ptr_conv;
32470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32471 this_ptr_conv.is_owned = false;
32472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32473 LDKDirectionalChannelInfo val_conv;
32474 val_conv.inner = (void*)(val & (~1));
32475 val_conv.is_owned = (val & 1) || (val == 0);
32476 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32477 val_conv = DirectionalChannelInfo_clone(&val_conv);
32478 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
32481 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
32482 LDKChannelInfo this_ptr_conv;
32483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32484 this_ptr_conv.is_owned = false;
32485 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32486 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
32487 uint64_t ret_ref = 0;
32488 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32489 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32490 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32491 ret_ref = (uint64_t)ret_var.inner;
32492 if (ret_var.is_owned) {
32498 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, uint32_t val) {
32499 LDKChannelInfo this_ptr_conv;
32500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32501 this_ptr_conv.is_owned = false;
32502 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32503 LDKNodeId val_conv;
32504 val_conv.inner = (void*)(val & (~1));
32505 val_conv.is_owned = (val & 1) || (val == 0);
32506 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32507 val_conv = NodeId_clone(&val_conv);
32508 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
32511 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
32512 LDKChannelInfo this_ptr_conv;
32513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32514 this_ptr_conv.is_owned = false;
32515 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32516 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
32517 uint64_t ret_ref = 0;
32518 if ((uint64_t)ret_var.inner > 4096) {
32519 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32520 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32521 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32522 ret_ref = (uint64_t)ret_var.inner;
32523 if (ret_var.is_owned) {
32530 void __attribute__((visibility("default"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
32531 LDKChannelInfo this_ptr_conv;
32532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32533 this_ptr_conv.is_owned = false;
32534 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32535 LDKDirectionalChannelInfo val_conv;
32536 val_conv.inner = (void*)(val & (~1));
32537 val_conv.is_owned = (val & 1) || (val == 0);
32538 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32539 val_conv = DirectionalChannelInfo_clone(&val_conv);
32540 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
32543 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) {
32544 LDKChannelInfo this_ptr_conv;
32545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32546 this_ptr_conv.is_owned = false;
32547 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32548 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32549 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
32550 uint64_t ret_ref = (uint64_t)ret_copy;
32554 void __attribute__((visibility("default"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) {
32555 LDKChannelInfo this_ptr_conv;
32556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32557 this_ptr_conv.is_owned = false;
32558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32559 void* val_ptr = (void*)(((uint64_t)val) & ~1);
32560 CHECK_ACCESS(val_ptr);
32561 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
32562 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
32563 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
32566 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
32567 LDKChannelInfo this_ptr_conv;
32568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32569 this_ptr_conv.is_owned = false;
32570 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32571 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
32572 uint64_t ret_ref = 0;
32573 if ((uint64_t)ret_var.inner > 4096) {
32574 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32575 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32576 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32577 ret_ref = (uint64_t)ret_var.inner;
32578 if (ret_var.is_owned) {
32585 void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
32586 LDKChannelInfo this_ptr_conv;
32587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32588 this_ptr_conv.is_owned = false;
32589 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32590 LDKChannelAnnouncement val_conv;
32591 val_conv.inner = (void*)(val & (~1));
32592 val_conv.is_owned = (val & 1) || (val == 0);
32593 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32594 val_conv = ChannelAnnouncement_clone(&val_conv);
32595 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
32598 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
32599 LDKChannelInfo ret_var = ChannelInfo_clone(arg);
32600 uint64_t ret_ref = 0;
32601 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32602 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32603 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32604 ret_ref = (uint64_t)ret_var.inner;
32605 if (ret_var.is_owned) {
32610 int64_t __attribute__((visibility("default"))) TS_ChannelInfo_clone_ptr(uint32_t arg) {
32611 LDKChannelInfo arg_conv;
32612 arg_conv.inner = (void*)(arg & (~1));
32613 arg_conv.is_owned = false;
32614 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32615 int64_t ret_val = ChannelInfo_clone_ptr(&arg_conv);
32619 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_clone(uint32_t orig) {
32620 LDKChannelInfo orig_conv;
32621 orig_conv.inner = (void*)(orig & (~1));
32622 orig_conv.is_owned = false;
32623 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32624 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
32625 uint64_t ret_ref = 0;
32626 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32627 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32628 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32629 ret_ref = (uint64_t)ret_var.inner;
32630 if (ret_var.is_owned) {
32636 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_write(uint32_t obj) {
32637 LDKChannelInfo obj_conv;
32638 obj_conv.inner = (void*)(obj & (~1));
32639 obj_conv.is_owned = false;
32640 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32641 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
32642 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
32643 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
32644 CVec_u8Z_free(ret_var);
32648 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_read(int8_tArray ser) {
32649 LDKu8slice ser_ref;
32650 ser_ref.datalen = *((uint32_t*)ser);
32651 ser_ref.data = (int8_t*)(ser + 4);
32652 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
32653 *ret_conv = ChannelInfo_read(ser_ref);
32654 return (uint64_t)ret_conv;
32657 void __attribute__((visibility("default"))) TS_RoutingFees_free(uint32_t this_obj) {
32658 LDKRoutingFees this_obj_conv;
32659 this_obj_conv.inner = (void*)(this_obj & (~1));
32660 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32661 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32662 RoutingFees_free(this_obj_conv);
32665 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
32666 LDKRoutingFees this_ptr_conv;
32667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32668 this_ptr_conv.is_owned = false;
32669 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32670 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
32674 void __attribute__((visibility("default"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
32675 LDKRoutingFees this_ptr_conv;
32676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32677 this_ptr_conv.is_owned = false;
32678 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32679 RoutingFees_set_base_msat(&this_ptr_conv, val);
32682 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
32683 LDKRoutingFees this_ptr_conv;
32684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32685 this_ptr_conv.is_owned = false;
32686 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32687 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
32691 void __attribute__((visibility("default"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
32692 LDKRoutingFees this_ptr_conv;
32693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32694 this_ptr_conv.is_owned = false;
32695 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32696 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
32699 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
32700 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
32701 uint64_t ret_ref = 0;
32702 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32703 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32704 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32705 ret_ref = (uint64_t)ret_var.inner;
32706 if (ret_var.is_owned) {
32712 jboolean __attribute__((visibility("default"))) TS_RoutingFees_eq(uint32_t a, uint32_t b) {
32713 LDKRoutingFees a_conv;
32714 a_conv.inner = (void*)(a & (~1));
32715 a_conv.is_owned = false;
32716 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32717 LDKRoutingFees b_conv;
32718 b_conv.inner = (void*)(b & (~1));
32719 b_conv.is_owned = false;
32720 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32721 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
32725 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
32726 LDKRoutingFees ret_var = RoutingFees_clone(arg);
32727 uint64_t ret_ref = 0;
32728 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32729 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32730 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32731 ret_ref = (uint64_t)ret_var.inner;
32732 if (ret_var.is_owned) {
32737 int64_t __attribute__((visibility("default"))) TS_RoutingFees_clone_ptr(uint32_t arg) {
32738 LDKRoutingFees arg_conv;
32739 arg_conv.inner = (void*)(arg & (~1));
32740 arg_conv.is_owned = false;
32741 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32742 int64_t ret_val = RoutingFees_clone_ptr(&arg_conv);
32746 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t orig) {
32747 LDKRoutingFees orig_conv;
32748 orig_conv.inner = (void*)(orig & (~1));
32749 orig_conv.is_owned = false;
32750 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32751 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
32752 uint64_t ret_ref = 0;
32753 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32754 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32755 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32756 ret_ref = (uint64_t)ret_var.inner;
32757 if (ret_var.is_owned) {
32763 int64_t __attribute__((visibility("default"))) TS_RoutingFees_hash(uint32_t o) {
32764 LDKRoutingFees o_conv;
32765 o_conv.inner = (void*)(o & (~1));
32766 o_conv.is_owned = false;
32767 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32768 int64_t ret_val = RoutingFees_hash(&o_conv);
32772 int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) {
32773 LDKRoutingFees obj_conv;
32774 obj_conv.inner = (void*)(obj & (~1));
32775 obj_conv.is_owned = false;
32776 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32777 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
32778 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
32779 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
32780 CVec_u8Z_free(ret_var);
32784 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_read(int8_tArray ser) {
32785 LDKu8slice ser_ref;
32786 ser_ref.datalen = *((uint32_t*)ser);
32787 ser_ref.data = (int8_t*)(ser + 4);
32788 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
32789 *ret_conv = RoutingFees_read(ser_ref);
32790 return (uint64_t)ret_conv;
32793 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) {
32794 LDKNodeAnnouncementInfo this_obj_conv;
32795 this_obj_conv.inner = (void*)(this_obj & (~1));
32796 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32798 NodeAnnouncementInfo_free(this_obj_conv);
32801 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
32802 LDKNodeAnnouncementInfo this_ptr_conv;
32803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32804 this_ptr_conv.is_owned = false;
32805 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32806 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
32807 uint64_t ret_ref = 0;
32808 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32809 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32810 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32811 ret_ref = (uint64_t)ret_var.inner;
32812 if (ret_var.is_owned) {
32818 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
32819 LDKNodeAnnouncementInfo this_ptr_conv;
32820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32821 this_ptr_conv.is_owned = false;
32822 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32823 LDKNodeFeatures val_conv;
32824 val_conv.inner = (void*)(val & (~1));
32825 val_conv.is_owned = (val & 1) || (val == 0);
32826 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32827 val_conv = NodeFeatures_clone(&val_conv);
32828 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
32831 int32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
32832 LDKNodeAnnouncementInfo this_ptr_conv;
32833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32834 this_ptr_conv.is_owned = false;
32835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32836 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
32840 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
32841 LDKNodeAnnouncementInfo this_ptr_conv;
32842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32843 this_ptr_conv.is_owned = false;
32844 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32845 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
32848 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
32849 LDKNodeAnnouncementInfo this_ptr_conv;
32850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32851 this_ptr_conv.is_owned = false;
32852 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32853 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
32854 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
32858 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
32859 LDKNodeAnnouncementInfo this_ptr_conv;
32860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32861 this_ptr_conv.is_owned = false;
32862 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32863 LDKThreeBytes val_ref;
32864 CHECK(*((uint32_t*)val) == 3);
32865 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
32866 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
32869 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
32870 LDKNodeAnnouncementInfo this_ptr_conv;
32871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32872 this_ptr_conv.is_owned = false;
32873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32874 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
32875 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
32879 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
32880 LDKNodeAnnouncementInfo this_ptr_conv;
32881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32882 this_ptr_conv.is_owned = false;
32883 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32884 LDKThirtyTwoBytes val_ref;
32885 CHECK(*((uint32_t*)val) == 32);
32886 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
32887 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
32890 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
32891 LDKNodeAnnouncementInfo this_ptr_conv;
32892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32893 this_ptr_conv.is_owned = false;
32894 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32895 LDKCVec_NetAddressZ val_constr;
32896 val_constr.datalen = *((uint32_t*)val);
32897 if (val_constr.datalen > 0)
32898 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
32900 val_constr.data = NULL;
32901 uint32_t* val_vals = (uint32_t*)(val + 4);
32902 for (size_t m = 0; m < val_constr.datalen; m++) {
32903 uint32_t val_conv_12 = val_vals[m];
32904 void* val_conv_12_ptr = (void*)(((uint64_t)val_conv_12) & ~1);
32905 CHECK_ACCESS(val_conv_12_ptr);
32906 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
32907 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
32908 val_constr.data[m] = val_conv_12_conv;
32910 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
32913 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
32914 LDKNodeAnnouncementInfo this_ptr_conv;
32915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32916 this_ptr_conv.is_owned = false;
32917 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32918 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
32919 uint64_t ret_ref = 0;
32920 if ((uint64_t)ret_var.inner > 4096) {
32921 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32922 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32923 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32924 ret_ref = (uint64_t)ret_var.inner;
32925 if (ret_var.is_owned) {
32932 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
32933 LDKNodeAnnouncementInfo this_ptr_conv;
32934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32935 this_ptr_conv.is_owned = false;
32936 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32937 LDKNodeAnnouncement val_conv;
32938 val_conv.inner = (void*)(val & (~1));
32939 val_conv.is_owned = (val & 1) || (val == 0);
32940 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32941 val_conv = NodeAnnouncement_clone(&val_conv);
32942 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
32945 uint32_t __attribute__((visibility("default"))) 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) {
32946 LDKNodeFeatures features_arg_conv;
32947 features_arg_conv.inner = (void*)(features_arg & (~1));
32948 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
32949 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
32950 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
32951 LDKThreeBytes rgb_arg_ref;
32952 CHECK(*((uint32_t*)rgb_arg) == 3);
32953 memcpy(rgb_arg_ref.data, (uint8_t*)(rgb_arg + 4), 3);
32954 LDKThirtyTwoBytes alias_arg_ref;
32955 CHECK(*((uint32_t*)alias_arg) == 32);
32956 memcpy(alias_arg_ref.data, (uint8_t*)(alias_arg + 4), 32);
32957 LDKCVec_NetAddressZ addresses_arg_constr;
32958 addresses_arg_constr.datalen = *((uint32_t*)addresses_arg);
32959 if (addresses_arg_constr.datalen > 0)
32960 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
32962 addresses_arg_constr.data = NULL;
32963 uint32_t* addresses_arg_vals = (uint32_t*)(addresses_arg + 4);
32964 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
32965 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
32966 void* addresses_arg_conv_12_ptr = (void*)(((uint64_t)addresses_arg_conv_12) & ~1);
32967 CHECK_ACCESS(addresses_arg_conv_12_ptr);
32968 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
32969 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
32971 LDKNodeAnnouncement announcement_message_arg_conv;
32972 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
32973 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
32974 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
32975 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
32976 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
32977 uint64_t ret_ref = 0;
32978 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32979 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32980 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32981 ret_ref = (uint64_t)ret_var.inner;
32982 if (ret_var.is_owned) {
32988 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
32989 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
32990 uint64_t ret_ref = 0;
32991 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32992 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32993 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32994 ret_ref = (uint64_t)ret_var.inner;
32995 if (ret_var.is_owned) {
33000 int64_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone_ptr(uint32_t arg) {
33001 LDKNodeAnnouncementInfo arg_conv;
33002 arg_conv.inner = (void*)(arg & (~1));
33003 arg_conv.is_owned = false;
33004 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33005 int64_t ret_val = NodeAnnouncementInfo_clone_ptr(&arg_conv);
33009 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
33010 LDKNodeAnnouncementInfo orig_conv;
33011 orig_conv.inner = (void*)(orig & (~1));
33012 orig_conv.is_owned = false;
33013 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33014 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
33015 uint64_t ret_ref = 0;
33016 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33017 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33018 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33019 ret_ref = (uint64_t)ret_var.inner;
33020 if (ret_var.is_owned) {
33026 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
33027 LDKNodeAnnouncementInfo obj_conv;
33028 obj_conv.inner = (void*)(obj & (~1));
33029 obj_conv.is_owned = false;
33030 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33031 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
33032 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
33033 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
33034 CVec_u8Z_free(ret_var);
33038 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
33039 LDKu8slice ser_ref;
33040 ser_ref.datalen = *((uint32_t*)ser);
33041 ser_ref.data = (int8_t*)(ser + 4);
33042 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
33043 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
33044 return (uint64_t)ret_conv;
33047 void __attribute__((visibility("default"))) TS_NodeInfo_free(uint32_t this_obj) {
33048 LDKNodeInfo this_obj_conv;
33049 this_obj_conv.inner = (void*)(this_obj & (~1));
33050 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33051 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33052 NodeInfo_free(this_obj_conv);
33055 void __attribute__((visibility("default"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
33056 LDKNodeInfo this_ptr_conv;
33057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33058 this_ptr_conv.is_owned = false;
33059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33060 LDKCVec_u64Z val_constr;
33061 val_constr.datalen = *((uint32_t*)val);
33062 if (val_constr.datalen > 0)
33063 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
33065 val_constr.data = NULL;
33066 int64_t* val_vals = (int64_t*)(val + 4);
33067 for (size_t i = 0; i < val_constr.datalen; i++) {
33068 int64_t val_conv_8 = val_vals[i];
33069 val_constr.data[i] = val_conv_8;
33071 NodeInfo_set_channels(&this_ptr_conv, val_constr);
33074 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
33075 LDKNodeInfo this_ptr_conv;
33076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33077 this_ptr_conv.is_owned = false;
33078 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33079 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
33080 uint64_t ret_ref = 0;
33081 if ((uint64_t)ret_var.inner > 4096) {
33082 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33083 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33084 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33085 ret_ref = (uint64_t)ret_var.inner;
33086 if (ret_var.is_owned) {
33093 void __attribute__((visibility("default"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) {
33094 LDKNodeInfo this_ptr_conv;
33095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33096 this_ptr_conv.is_owned = false;
33097 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33098 LDKRoutingFees val_conv;
33099 val_conv.inner = (void*)(val & (~1));
33100 val_conv.is_owned = (val & 1) || (val == 0);
33101 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33102 val_conv = RoutingFees_clone(&val_conv);
33103 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
33106 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
33107 LDKNodeInfo this_ptr_conv;
33108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33109 this_ptr_conv.is_owned = false;
33110 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33111 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
33112 uint64_t ret_ref = 0;
33113 if ((uint64_t)ret_var.inner > 4096) {
33114 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33115 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33116 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33117 ret_ref = (uint64_t)ret_var.inner;
33118 if (ret_var.is_owned) {
33125 void __attribute__((visibility("default"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
33126 LDKNodeInfo this_ptr_conv;
33127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33128 this_ptr_conv.is_owned = false;
33129 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33130 LDKNodeAnnouncementInfo val_conv;
33131 val_conv.inner = (void*)(val & (~1));
33132 val_conv.is_owned = (val & 1) || (val == 0);
33133 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33134 val_conv = NodeAnnouncementInfo_clone(&val_conv);
33135 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
33138 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
33139 LDKCVec_u64Z channels_arg_constr;
33140 channels_arg_constr.datalen = *((uint32_t*)channels_arg);
33141 if (channels_arg_constr.datalen > 0)
33142 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
33144 channels_arg_constr.data = NULL;
33145 int64_t* channels_arg_vals = (int64_t*)(channels_arg + 4);
33146 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
33147 int64_t channels_arg_conv_8 = channels_arg_vals[i];
33148 channels_arg_constr.data[i] = channels_arg_conv_8;
33150 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
33151 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
33152 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
33153 CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
33154 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
33155 LDKNodeAnnouncementInfo announcement_info_arg_conv;
33156 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
33157 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
33158 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
33159 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
33160 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
33161 uint64_t ret_ref = 0;
33162 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33163 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33164 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33165 ret_ref = (uint64_t)ret_var.inner;
33166 if (ret_var.is_owned) {
33172 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
33173 LDKNodeInfo ret_var = NodeInfo_clone(arg);
33174 uint64_t ret_ref = 0;
33175 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33176 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33177 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33178 ret_ref = (uint64_t)ret_var.inner;
33179 if (ret_var.is_owned) {
33184 int64_t __attribute__((visibility("default"))) TS_NodeInfo_clone_ptr(uint32_t arg) {
33185 LDKNodeInfo arg_conv;
33186 arg_conv.inner = (void*)(arg & (~1));
33187 arg_conv.is_owned = false;
33188 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33189 int64_t ret_val = NodeInfo_clone_ptr(&arg_conv);
33193 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig) {
33194 LDKNodeInfo orig_conv;
33195 orig_conv.inner = (void*)(orig & (~1));
33196 orig_conv.is_owned = false;
33197 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33198 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
33199 uint64_t ret_ref = 0;
33200 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33201 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33202 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33203 ret_ref = (uint64_t)ret_var.inner;
33204 if (ret_var.is_owned) {
33210 int8_tArray __attribute__((visibility("default"))) TS_NodeInfo_write(uint32_t obj) {
33211 LDKNodeInfo obj_conv;
33212 obj_conv.inner = (void*)(obj & (~1));
33213 obj_conv.is_owned = false;
33214 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33215 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
33216 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
33217 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
33218 CVec_u8Z_free(ret_var);
33222 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_read(int8_tArray ser) {
33223 LDKu8slice ser_ref;
33224 ser_ref.datalen = *((uint32_t*)ser);
33225 ser_ref.data = (int8_t*)(ser + 4);
33226 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
33227 *ret_conv = NodeInfo_read(ser_ref);
33228 return (uint64_t)ret_conv;
33231 int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32_t obj) {
33232 LDKNetworkGraph obj_conv;
33233 obj_conv.inner = (void*)(obj & (~1));
33234 obj_conv.is_owned = false;
33235 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33236 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
33237 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
33238 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
33239 CVec_u8Z_free(ret_var);
33243 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read(int8_tArray ser) {
33244 LDKu8slice ser_ref;
33245 ser_ref.datalen = *((uint32_t*)ser);
33246 ser_ref.data = (int8_t*)(ser + 4);
33247 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
33248 *ret_conv = NetworkGraph_read(ser_ref);
33249 return (uint64_t)ret_conv;
33252 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray genesis_hash) {
33253 LDKThirtyTwoBytes genesis_hash_ref;
33254 CHECK(*((uint32_t*)genesis_hash) == 32);
33255 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
33256 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
33257 uint64_t ret_ref = 0;
33258 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33259 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33260 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33261 ret_ref = (uint64_t)ret_var.inner;
33262 if (ret_var.is_owned) {
33268 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read_only(uint32_t this_arg) {
33269 LDKNetworkGraph this_arg_conv;
33270 this_arg_conv.inner = (void*)(this_arg & (~1));
33271 this_arg_conv.is_owned = false;
33272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33273 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
33274 uint64_t ret_ref = 0;
33275 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33276 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33277 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33278 ret_ref = (uint64_t)ret_var.inner;
33279 if (ret_var.is_owned) {
33285 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
33286 LDKNetworkGraph this_arg_conv;
33287 this_arg_conv.inner = (void*)(this_arg & (~1));
33288 this_arg_conv.is_owned = false;
33289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33290 LDKNodeAnnouncement msg_conv;
33291 msg_conv.inner = (void*)(msg & (~1));
33292 msg_conv.is_owned = false;
33293 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
33294 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
33295 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
33296 return (uint64_t)ret_conv;
33299 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) {
33300 LDKNetworkGraph this_arg_conv;
33301 this_arg_conv.inner = (void*)(this_arg & (~1));
33302 this_arg_conv.is_owned = false;
33303 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33304 LDKUnsignedNodeAnnouncement msg_conv;
33305 msg_conv.inner = (void*)(msg & (~1));
33306 msg_conv.is_owned = false;
33307 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
33308 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
33309 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
33310 return (uint64_t)ret_conv;
33313 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
33314 LDKNetworkGraph this_arg_conv;
33315 this_arg_conv.inner = (void*)(this_arg & (~1));
33316 this_arg_conv.is_owned = false;
33317 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33318 LDKChannelAnnouncement msg_conv;
33319 msg_conv.inner = (void*)(msg & (~1));
33320 msg_conv.is_owned = false;
33321 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
33322 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
33323 CHECK_ACCESS(chain_access_ptr);
33324 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
33325 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
33326 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
33327 // Manually implement clone for Java trait instances
33329 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
33330 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
33331 return (uint64_t)ret_conv;
33334 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
33335 LDKNetworkGraph this_arg_conv;
33336 this_arg_conv.inner = (void*)(this_arg & (~1));
33337 this_arg_conv.is_owned = false;
33338 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33339 LDKUnsignedChannelAnnouncement msg_conv;
33340 msg_conv.inner = (void*)(msg & (~1));
33341 msg_conv.is_owned = false;
33342 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
33343 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
33344 CHECK_ACCESS(chain_access_ptr);
33345 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
33346 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
33347 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
33348 // Manually implement clone for Java trait instances
33350 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
33351 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
33352 return (uint64_t)ret_conv;
33355 void __attribute__((visibility("default"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
33356 LDKNetworkGraph this_arg_conv;
33357 this_arg_conv.inner = (void*)(this_arg & (~1));
33358 this_arg_conv.is_owned = false;
33359 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33360 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
33363 void __attribute__((visibility("default"))) TS_NetworkGraph_fail_node(uint32_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
33364 LDKNetworkGraph this_arg_conv;
33365 this_arg_conv.inner = (void*)(this_arg & (~1));
33366 this_arg_conv.is_owned = false;
33367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33368 LDKPublicKey _node_id_ref;
33369 CHECK(*((uint32_t*)_node_id) == 33);
33370 memcpy(_node_id_ref.compressed_form, (uint8_t*)(_node_id + 4), 33);
33371 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
33374 void __attribute__((visibility("default"))) TS_NetworkGraph_remove_stale_channels_with_time(uint32_t this_arg, int64_t current_time_unix) {
33375 LDKNetworkGraph this_arg_conv;
33376 this_arg_conv.inner = (void*)(this_arg & (~1));
33377 this_arg_conv.is_owned = false;
33378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33379 NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
33382 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
33383 LDKNetworkGraph this_arg_conv;
33384 this_arg_conv.inner = (void*)(this_arg & (~1));
33385 this_arg_conv.is_owned = false;
33386 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33387 LDKChannelUpdate msg_conv;
33388 msg_conv.inner = (void*)(msg & (~1));
33389 msg_conv.is_owned = false;
33390 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
33391 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
33392 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
33393 return (uint64_t)ret_conv;
33396 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
33397 LDKNetworkGraph this_arg_conv;
33398 this_arg_conv.inner = (void*)(this_arg & (~1));
33399 this_arg_conv.is_owned = false;
33400 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33401 LDKUnsignedChannelUpdate msg_conv;
33402 msg_conv.inner = (void*)(msg & (~1));
33403 msg_conv.is_owned = false;
33404 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
33405 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
33406 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
33407 return (uint64_t)ret_conv;
33410 uint32_t __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_get_addresses(uint32_t this_arg, int8_tArray pubkey) {
33411 LDKReadOnlyNetworkGraph this_arg_conv;
33412 this_arg_conv.inner = (void*)(this_arg & (~1));
33413 this_arg_conv.is_owned = false;
33414 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33415 LDKPublicKey pubkey_ref;
33416 CHECK(*((uint32_t*)pubkey) == 33);
33417 memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33);
33418 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
33419 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
33420 uint64_t ret_ref = (uint64_t)ret_copy;
33424 void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) {
33425 LDKRouteHop this_obj_conv;
33426 this_obj_conv.inner = (void*)(this_obj & (~1));
33427 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33428 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33429 RouteHop_free(this_obj_conv);
33432 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
33433 LDKRouteHop this_ptr_conv;
33434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33435 this_ptr_conv.is_owned = false;
33436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33437 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
33438 memcpy((uint8_t*)(ret_arr + 4), RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
33442 void __attribute__((visibility("default"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
33443 LDKRouteHop this_ptr_conv;
33444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33445 this_ptr_conv.is_owned = false;
33446 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33447 LDKPublicKey val_ref;
33448 CHECK(*((uint32_t*)val) == 33);
33449 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
33450 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
33453 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
33454 LDKRouteHop this_ptr_conv;
33455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33456 this_ptr_conv.is_owned = false;
33457 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33458 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
33459 uint64_t ret_ref = 0;
33460 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33461 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33462 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33463 ret_ref = (uint64_t)ret_var.inner;
33464 if (ret_var.is_owned) {
33470 void __attribute__((visibility("default"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
33471 LDKRouteHop this_ptr_conv;
33472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33473 this_ptr_conv.is_owned = false;
33474 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33475 LDKNodeFeatures val_conv;
33476 val_conv.inner = (void*)(val & (~1));
33477 val_conv.is_owned = (val & 1) || (val == 0);
33478 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33479 val_conv = NodeFeatures_clone(&val_conv);
33480 RouteHop_set_node_features(&this_ptr_conv, val_conv);
33483 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
33484 LDKRouteHop this_ptr_conv;
33485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33486 this_ptr_conv.is_owned = false;
33487 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33488 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
33492 void __attribute__((visibility("default"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
33493 LDKRouteHop this_ptr_conv;
33494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33495 this_ptr_conv.is_owned = false;
33496 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33497 RouteHop_set_short_channel_id(&this_ptr_conv, val);
33500 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
33501 LDKRouteHop this_ptr_conv;
33502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33503 this_ptr_conv.is_owned = false;
33504 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33505 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
33506 uint64_t ret_ref = 0;
33507 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33508 CHECK((((uint64_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 = (uint64_t)ret_var.inner;
33511 if (ret_var.is_owned) {
33517 void __attribute__((visibility("default"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
33518 LDKRouteHop this_ptr_conv;
33519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33520 this_ptr_conv.is_owned = false;
33521 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33522 LDKChannelFeatures val_conv;
33523 val_conv.inner = (void*)(val & (~1));
33524 val_conv.is_owned = (val & 1) || (val == 0);
33525 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33526 val_conv = ChannelFeatures_clone(&val_conv);
33527 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
33530 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
33531 LDKRouteHop this_ptr_conv;
33532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33533 this_ptr_conv.is_owned = false;
33534 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33535 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
33539 void __attribute__((visibility("default"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
33540 LDKRouteHop this_ptr_conv;
33541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33542 this_ptr_conv.is_owned = false;
33543 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33544 RouteHop_set_fee_msat(&this_ptr_conv, val);
33547 int32_t __attribute__((visibility("default"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
33548 LDKRouteHop this_ptr_conv;
33549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33550 this_ptr_conv.is_owned = false;
33551 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33552 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
33556 void __attribute__((visibility("default"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
33557 LDKRouteHop this_ptr_conv;
33558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33559 this_ptr_conv.is_owned = false;
33560 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33561 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
33564 uint32_t __attribute__((visibility("default"))) 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) {
33565 LDKPublicKey pubkey_arg_ref;
33566 CHECK(*((uint32_t*)pubkey_arg) == 33);
33567 memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33);
33568 LDKNodeFeatures node_features_arg_conv;
33569 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
33570 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
33571 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
33572 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
33573 LDKChannelFeatures channel_features_arg_conv;
33574 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
33575 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
33576 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
33577 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
33578 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);
33579 uint64_t ret_ref = 0;
33580 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33581 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33582 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33583 ret_ref = (uint64_t)ret_var.inner;
33584 if (ret_var.is_owned) {
33590 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
33591 LDKRouteHop ret_var = RouteHop_clone(arg);
33592 uint64_t ret_ref = 0;
33593 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33594 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33595 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33596 ret_ref = (uint64_t)ret_var.inner;
33597 if (ret_var.is_owned) {
33602 int64_t __attribute__((visibility("default"))) TS_RouteHop_clone_ptr(uint32_t arg) {
33603 LDKRouteHop arg_conv;
33604 arg_conv.inner = (void*)(arg & (~1));
33605 arg_conv.is_owned = false;
33606 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33607 int64_t ret_val = RouteHop_clone_ptr(&arg_conv);
33611 uint32_t __attribute__((visibility("default"))) TS_RouteHop_clone(uint32_t orig) {
33612 LDKRouteHop orig_conv;
33613 orig_conv.inner = (void*)(orig & (~1));
33614 orig_conv.is_owned = false;
33615 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33616 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
33617 uint64_t ret_ref = 0;
33618 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33619 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33620 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33621 ret_ref = (uint64_t)ret_var.inner;
33622 if (ret_var.is_owned) {
33628 int64_t __attribute__((visibility("default"))) TS_RouteHop_hash(uint32_t o) {
33629 LDKRouteHop o_conv;
33630 o_conv.inner = (void*)(o & (~1));
33631 o_conv.is_owned = false;
33632 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33633 int64_t ret_val = RouteHop_hash(&o_conv);
33637 jboolean __attribute__((visibility("default"))) TS_RouteHop_eq(uint32_t a, uint32_t b) {
33638 LDKRouteHop a_conv;
33639 a_conv.inner = (void*)(a & (~1));
33640 a_conv.is_owned = false;
33641 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33642 LDKRouteHop b_conv;
33643 b_conv.inner = (void*)(b & (~1));
33644 b_conv.is_owned = false;
33645 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33646 jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
33650 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_write(uint32_t obj) {
33651 LDKRouteHop obj_conv;
33652 obj_conv.inner = (void*)(obj & (~1));
33653 obj_conv.is_owned = false;
33654 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33655 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
33656 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
33657 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
33658 CVec_u8Z_free(ret_var);
33662 uint32_t __attribute__((visibility("default"))) TS_RouteHop_read(int8_tArray ser) {
33663 LDKu8slice ser_ref;
33664 ser_ref.datalen = *((uint32_t*)ser);
33665 ser_ref.data = (int8_t*)(ser + 4);
33666 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
33667 *ret_conv = RouteHop_read(ser_ref);
33668 return (uint64_t)ret_conv;
33671 void __attribute__((visibility("default"))) TS_Route_free(uint32_t this_obj) {
33672 LDKRoute this_obj_conv;
33673 this_obj_conv.inner = (void*)(this_obj & (~1));
33674 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33675 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33676 Route_free(this_obj_conv);
33679 ptrArray __attribute__((visibility("default"))) TS_Route_get_paths(uint32_t this_ptr) {
33680 LDKRoute this_ptr_conv;
33681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33682 this_ptr_conv.is_owned = false;
33683 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33684 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
33685 ptrArray ret_arr = NULL;
33686 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
33687 uint32_tArray *ret_arr_ptr = (uint32_tArray*)(ret_arr + 4);
33688 for (size_t m = 0; m < ret_var.datalen; m++) {
33689 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
33690 uint32_tArray ret_conv_12_arr = NULL;
33691 ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
33692 uint32_t *ret_conv_12_arr_ptr = (uint32_t*)(ret_conv_12_arr + 4);
33693 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
33694 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
33695 uint64_t ret_conv_12_conv_10_ref = 0;
33696 CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33697 CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33698 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
33699 ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner;
33700 if (ret_conv_12_conv_10_var.is_owned) {
33701 ret_conv_12_conv_10_ref |= 1;
33703 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
33706 FREE(ret_conv_12_var.data);
33707 ret_arr_ptr[m] = ret_conv_12_arr;
33710 FREE(ret_var.data);
33714 void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
33715 LDKRoute this_ptr_conv;
33716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33717 this_ptr_conv.is_owned = false;
33718 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33719 LDKCVec_CVec_RouteHopZZ val_constr;
33720 val_constr.datalen = *((uint32_t*)val);
33721 if (val_constr.datalen > 0)
33722 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
33724 val_constr.data = NULL;
33725 uint32_tArray* val_vals = (uint32_tArray*)(val + 4);
33726 for (size_t m = 0; m < val_constr.datalen; m++) {
33727 uint32_tArray val_conv_12 = val_vals[m];
33728 LDKCVec_RouteHopZ val_conv_12_constr;
33729 val_conv_12_constr.datalen = *((uint32_t*)val_conv_12);
33730 if (val_conv_12_constr.datalen > 0)
33731 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
33733 val_conv_12_constr.data = NULL;
33734 uint32_t* val_conv_12_vals = (uint32_t*)(val_conv_12 + 4);
33735 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
33736 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
33737 LDKRouteHop val_conv_12_conv_10_conv;
33738 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
33739 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
33740 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
33741 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
33742 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
33744 val_constr.data[m] = val_conv_12_constr;
33746 Route_set_paths(&this_ptr_conv, val_constr);
33749 uint32_t __attribute__((visibility("default"))) TS_Route_get_payee(uint32_t this_ptr) {
33750 LDKRoute this_ptr_conv;
33751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33752 this_ptr_conv.is_owned = false;
33753 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33754 LDKPayee ret_var = Route_get_payee(&this_ptr_conv);
33755 uint64_t ret_ref = 0;
33756 if ((uint64_t)ret_var.inner > 4096) {
33757 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33758 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33759 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33760 ret_ref = (uint64_t)ret_var.inner;
33761 if (ret_var.is_owned) {
33768 void __attribute__((visibility("default"))) TS_Route_set_payee(uint32_t this_ptr, uint32_t val) {
33769 LDKRoute this_ptr_conv;
33770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33771 this_ptr_conv.is_owned = false;
33772 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33774 val_conv.inner = (void*)(val & (~1));
33775 val_conv.is_owned = (val & 1) || (val == 0);
33776 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33777 val_conv = Payee_clone(&val_conv);
33778 Route_set_payee(&this_ptr_conv, val_conv);
33781 uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg, uint32_t payee_arg) {
33782 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
33783 paths_arg_constr.datalen = *((uint32_t*)paths_arg);
33784 if (paths_arg_constr.datalen > 0)
33785 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
33787 paths_arg_constr.data = NULL;
33788 uint32_tArray* paths_arg_vals = (uint32_tArray*)(paths_arg + 4);
33789 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
33790 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
33791 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
33792 paths_arg_conv_12_constr.datalen = *((uint32_t*)paths_arg_conv_12);
33793 if (paths_arg_conv_12_constr.datalen > 0)
33794 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
33796 paths_arg_conv_12_constr.data = NULL;
33797 uint32_t* paths_arg_conv_12_vals = (uint32_t*)(paths_arg_conv_12 + 4);
33798 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
33799 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
33800 LDKRouteHop paths_arg_conv_12_conv_10_conv;
33801 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
33802 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
33803 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
33804 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
33805 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
33807 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
33809 LDKPayee payee_arg_conv;
33810 payee_arg_conv.inner = (void*)(payee_arg & (~1));
33811 payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0);
33812 CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_arg_conv);
33813 payee_arg_conv = Payee_clone(&payee_arg_conv);
33814 LDKRoute ret_var = Route_new(paths_arg_constr, payee_arg_conv);
33815 uint64_t ret_ref = 0;
33816 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33817 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33818 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33819 ret_ref = (uint64_t)ret_var.inner;
33820 if (ret_var.is_owned) {
33826 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
33827 LDKRoute ret_var = Route_clone(arg);
33828 uint64_t ret_ref = 0;
33829 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33830 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33831 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33832 ret_ref = (uint64_t)ret_var.inner;
33833 if (ret_var.is_owned) {
33838 int64_t __attribute__((visibility("default"))) TS_Route_clone_ptr(uint32_t arg) {
33840 arg_conv.inner = (void*)(arg & (~1));
33841 arg_conv.is_owned = false;
33842 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33843 int64_t ret_val = Route_clone_ptr(&arg_conv);
33847 uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) {
33848 LDKRoute orig_conv;
33849 orig_conv.inner = (void*)(orig & (~1));
33850 orig_conv.is_owned = false;
33851 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33852 LDKRoute ret_var = Route_clone(&orig_conv);
33853 uint64_t ret_ref = 0;
33854 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33855 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33856 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33857 ret_ref = (uint64_t)ret_var.inner;
33858 if (ret_var.is_owned) {
33864 int64_t __attribute__((visibility("default"))) TS_Route_hash(uint32_t o) {
33866 o_conv.inner = (void*)(o & (~1));
33867 o_conv.is_owned = false;
33868 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33869 int64_t ret_val = Route_hash(&o_conv);
33873 jboolean __attribute__((visibility("default"))) TS_Route_eq(uint32_t a, uint32_t b) {
33875 a_conv.inner = (void*)(a & (~1));
33876 a_conv.is_owned = false;
33877 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33879 b_conv.inner = (void*)(b & (~1));
33880 b_conv.is_owned = false;
33881 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33882 jboolean ret_val = Route_eq(&a_conv, &b_conv);
33886 int64_t __attribute__((visibility("default"))) TS_Route_get_total_fees(uint32_t this_arg) {
33887 LDKRoute this_arg_conv;
33888 this_arg_conv.inner = (void*)(this_arg & (~1));
33889 this_arg_conv.is_owned = false;
33890 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33891 int64_t ret_val = Route_get_total_fees(&this_arg_conv);
33895 int64_t __attribute__((visibility("default"))) TS_Route_get_total_amount(uint32_t this_arg) {
33896 LDKRoute this_arg_conv;
33897 this_arg_conv.inner = (void*)(this_arg & (~1));
33898 this_arg_conv.is_owned = false;
33899 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33900 int64_t ret_val = Route_get_total_amount(&this_arg_conv);
33904 int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) {
33906 obj_conv.inner = (void*)(obj & (~1));
33907 obj_conv.is_owned = false;
33908 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33909 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
33910 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
33911 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
33912 CVec_u8Z_free(ret_var);
33916 uint32_t __attribute__((visibility("default"))) TS_Route_read(int8_tArray ser) {
33917 LDKu8slice ser_ref;
33918 ser_ref.datalen = *((uint32_t*)ser);
33919 ser_ref.data = (int8_t*)(ser + 4);
33920 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
33921 *ret_conv = Route_read(ser_ref);
33922 return (uint64_t)ret_conv;
33925 void __attribute__((visibility("default"))) TS_RouteParameters_free(uint32_t this_obj) {
33926 LDKRouteParameters this_obj_conv;
33927 this_obj_conv.inner = (void*)(this_obj & (~1));
33928 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33929 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33930 RouteParameters_free(this_obj_conv);
33933 uint32_t __attribute__((visibility("default"))) TS_RouteParameters_get_payee(uint32_t this_ptr) {
33934 LDKRouteParameters this_ptr_conv;
33935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33936 this_ptr_conv.is_owned = false;
33937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33938 LDKPayee ret_var = RouteParameters_get_payee(&this_ptr_conv);
33939 uint64_t ret_ref = 0;
33940 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33941 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33942 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33943 ret_ref = (uint64_t)ret_var.inner;
33944 if (ret_var.is_owned) {
33950 void __attribute__((visibility("default"))) TS_RouteParameters_set_payee(uint32_t this_ptr, uint32_t val) {
33951 LDKRouteParameters this_ptr_conv;
33952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33953 this_ptr_conv.is_owned = false;
33954 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33956 val_conv.inner = (void*)(val & (~1));
33957 val_conv.is_owned = (val & 1) || (val == 0);
33958 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33959 val_conv = Payee_clone(&val_conv);
33960 RouteParameters_set_payee(&this_ptr_conv, val_conv);
33963 int64_t __attribute__((visibility("default"))) TS_RouteParameters_get_final_value_msat(uint32_t this_ptr) {
33964 LDKRouteParameters this_ptr_conv;
33965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33966 this_ptr_conv.is_owned = false;
33967 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33968 int64_t ret_val = RouteParameters_get_final_value_msat(&this_ptr_conv);
33972 void __attribute__((visibility("default"))) TS_RouteParameters_set_final_value_msat(uint32_t this_ptr, int64_t val) {
33973 LDKRouteParameters this_ptr_conv;
33974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33975 this_ptr_conv.is_owned = false;
33976 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33977 RouteParameters_set_final_value_msat(&this_ptr_conv, val);
33980 int32_t __attribute__((visibility("default"))) TS_RouteParameters_get_final_cltv_expiry_delta(uint32_t this_ptr) {
33981 LDKRouteParameters this_ptr_conv;
33982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33983 this_ptr_conv.is_owned = false;
33984 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33985 int32_t ret_val = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
33989 void __attribute__((visibility("default"))) TS_RouteParameters_set_final_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
33990 LDKRouteParameters this_ptr_conv;
33991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33992 this_ptr_conv.is_owned = false;
33993 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33994 RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
33997 uint32_t __attribute__((visibility("default"))) TS_RouteParameters_new(uint32_t payee_arg, int64_t final_value_msat_arg, int32_t final_cltv_expiry_delta_arg) {
33998 LDKPayee payee_arg_conv;
33999 payee_arg_conv.inner = (void*)(payee_arg & (~1));
34000 payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0);
34001 CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_arg_conv);
34002 payee_arg_conv = Payee_clone(&payee_arg_conv);
34003 LDKRouteParameters ret_var = RouteParameters_new(payee_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
34004 uint64_t ret_ref = 0;
34005 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34006 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34007 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34008 ret_ref = (uint64_t)ret_var.inner;
34009 if (ret_var.is_owned) {
34015 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
34016 LDKRouteParameters ret_var = RouteParameters_clone(arg);
34017 uint64_t ret_ref = 0;
34018 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34019 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34020 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34021 ret_ref = (uint64_t)ret_var.inner;
34022 if (ret_var.is_owned) {
34027 int64_t __attribute__((visibility("default"))) TS_RouteParameters_clone_ptr(uint32_t arg) {
34028 LDKRouteParameters arg_conv;
34029 arg_conv.inner = (void*)(arg & (~1));
34030 arg_conv.is_owned = false;
34031 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34032 int64_t ret_val = RouteParameters_clone_ptr(&arg_conv);
34036 uint32_t __attribute__((visibility("default"))) TS_RouteParameters_clone(uint32_t orig) {
34037 LDKRouteParameters orig_conv;
34038 orig_conv.inner = (void*)(orig & (~1));
34039 orig_conv.is_owned = false;
34040 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34041 LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
34042 uint64_t ret_ref = 0;
34043 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34044 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34045 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34046 ret_ref = (uint64_t)ret_var.inner;
34047 if (ret_var.is_owned) {
34053 int8_tArray __attribute__((visibility("default"))) TS_RouteParameters_write(uint32_t obj) {
34054 LDKRouteParameters obj_conv;
34055 obj_conv.inner = (void*)(obj & (~1));
34056 obj_conv.is_owned = false;
34057 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34058 LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
34059 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
34060 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
34061 CVec_u8Z_free(ret_var);
34065 uint32_t __attribute__((visibility("default"))) TS_RouteParameters_read(int8_tArray ser) {
34066 LDKu8slice ser_ref;
34067 ser_ref.datalen = *((uint32_t*)ser);
34068 ser_ref.data = (int8_t*)(ser + 4);
34069 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
34070 *ret_conv = RouteParameters_read(ser_ref);
34071 return (uint64_t)ret_conv;
34074 void __attribute__((visibility("default"))) TS_Payee_free(uint32_t this_obj) {
34075 LDKPayee this_obj_conv;
34076 this_obj_conv.inner = (void*)(this_obj & (~1));
34077 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34078 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34079 Payee_free(this_obj_conv);
34082 int8_tArray __attribute__((visibility("default"))) TS_Payee_get_pubkey(uint32_t this_ptr) {
34083 LDKPayee this_ptr_conv;
34084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34085 this_ptr_conv.is_owned = false;
34086 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34087 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
34088 memcpy((uint8_t*)(ret_arr + 4), Payee_get_pubkey(&this_ptr_conv).compressed_form, 33);
34092 void __attribute__((visibility("default"))) TS_Payee_set_pubkey(uint32_t this_ptr, int8_tArray val) {
34093 LDKPayee this_ptr_conv;
34094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34095 this_ptr_conv.is_owned = false;
34096 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34097 LDKPublicKey val_ref;
34098 CHECK(*((uint32_t*)val) == 33);
34099 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
34100 Payee_set_pubkey(&this_ptr_conv, val_ref);
34103 uint32_t __attribute__((visibility("default"))) TS_Payee_get_features(uint32_t this_ptr) {
34104 LDKPayee this_ptr_conv;
34105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34106 this_ptr_conv.is_owned = false;
34107 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34108 LDKInvoiceFeatures ret_var = Payee_get_features(&this_ptr_conv);
34109 uint64_t ret_ref = 0;
34110 if ((uint64_t)ret_var.inner > 4096) {
34111 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34112 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34113 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34114 ret_ref = (uint64_t)ret_var.inner;
34115 if (ret_var.is_owned) {
34122 void __attribute__((visibility("default"))) TS_Payee_set_features(uint32_t this_ptr, uint32_t val) {
34123 LDKPayee this_ptr_conv;
34124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34125 this_ptr_conv.is_owned = false;
34126 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34127 LDKInvoiceFeatures val_conv;
34128 val_conv.inner = (void*)(val & (~1));
34129 val_conv.is_owned = (val & 1) || (val == 0);
34130 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34131 val_conv = InvoiceFeatures_clone(&val_conv);
34132 Payee_set_features(&this_ptr_conv, val_conv);
34135 uint32_tArray __attribute__((visibility("default"))) TS_Payee_get_route_hints(uint32_t this_ptr) {
34136 LDKPayee this_ptr_conv;
34137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34138 this_ptr_conv.is_owned = false;
34139 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34140 LDKCVec_RouteHintZ ret_var = Payee_get_route_hints(&this_ptr_conv);
34141 uint32_tArray ret_arr = NULL;
34142 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
34143 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
34144 for (size_t l = 0; l < ret_var.datalen; l++) {
34145 LDKRouteHint ret_conv_11_var = ret_var.data[l];
34146 uint64_t ret_conv_11_ref = 0;
34147 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34148 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34149 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
34150 ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
34151 if (ret_conv_11_var.is_owned) {
34152 ret_conv_11_ref |= 1;
34154 ret_arr_ptr[l] = ret_conv_11_ref;
34157 FREE(ret_var.data);
34161 void __attribute__((visibility("default"))) TS_Payee_set_route_hints(uint32_t this_ptr, uint32_tArray val) {
34162 LDKPayee this_ptr_conv;
34163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34164 this_ptr_conv.is_owned = false;
34165 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34166 LDKCVec_RouteHintZ val_constr;
34167 val_constr.datalen = *((uint32_t*)val);
34168 if (val_constr.datalen > 0)
34169 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
34171 val_constr.data = NULL;
34172 uint32_t* val_vals = (uint32_t*)(val + 4);
34173 for (size_t l = 0; l < val_constr.datalen; l++) {
34174 uint32_t val_conv_11 = val_vals[l];
34175 LDKRouteHint val_conv_11_conv;
34176 val_conv_11_conv.inner = (void*)(val_conv_11 & (~1));
34177 val_conv_11_conv.is_owned = (val_conv_11 & 1) || (val_conv_11 == 0);
34178 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
34179 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
34180 val_constr.data[l] = val_conv_11_conv;
34182 Payee_set_route_hints(&this_ptr_conv, val_constr);
34185 uint32_t __attribute__((visibility("default"))) TS_Payee_get_expiry_time(uint32_t this_ptr) {
34186 LDKPayee this_ptr_conv;
34187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34188 this_ptr_conv.is_owned = false;
34189 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34190 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34191 *ret_copy = Payee_get_expiry_time(&this_ptr_conv);
34192 uint64_t ret_ref = (uint64_t)ret_copy;
34196 void __attribute__((visibility("default"))) TS_Payee_set_expiry_time(uint32_t this_ptr, uint32_t val) {
34197 LDKPayee this_ptr_conv;
34198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34199 this_ptr_conv.is_owned = false;
34200 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34201 void* val_ptr = (void*)(((uint64_t)val) & ~1);
34202 CHECK_ACCESS(val_ptr);
34203 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34204 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
34205 Payee_set_expiry_time(&this_ptr_conv, val_conv);
34208 uint32_t __attribute__((visibility("default"))) TS_Payee_new(int8_tArray pubkey_arg, uint32_t features_arg, uint32_tArray route_hints_arg, uint32_t expiry_time_arg) {
34209 LDKPublicKey pubkey_arg_ref;
34210 CHECK(*((uint32_t*)pubkey_arg) == 33);
34211 memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33);
34212 LDKInvoiceFeatures features_arg_conv;
34213 features_arg_conv.inner = (void*)(features_arg & (~1));
34214 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
34215 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
34216 features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
34217 LDKCVec_RouteHintZ route_hints_arg_constr;
34218 route_hints_arg_constr.datalen = *((uint32_t*)route_hints_arg);
34219 if (route_hints_arg_constr.datalen > 0)
34220 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
34222 route_hints_arg_constr.data = NULL;
34223 uint32_t* route_hints_arg_vals = (uint32_t*)(route_hints_arg + 4);
34224 for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
34225 uint32_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
34226 LDKRouteHint route_hints_arg_conv_11_conv;
34227 route_hints_arg_conv_11_conv.inner = (void*)(route_hints_arg_conv_11 & (~1));
34228 route_hints_arg_conv_11_conv.is_owned = (route_hints_arg_conv_11 & 1) || (route_hints_arg_conv_11 == 0);
34229 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
34230 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
34231 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
34233 void* expiry_time_arg_ptr = (void*)(((uint64_t)expiry_time_arg) & ~1);
34234 CHECK_ACCESS(expiry_time_arg_ptr);
34235 LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
34236 expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)expiry_time_arg) & ~1));
34237 LDKPayee ret_var = Payee_new(pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, expiry_time_arg_conv);
34238 uint64_t ret_ref = 0;
34239 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34240 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34241 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34242 ret_ref = (uint64_t)ret_var.inner;
34243 if (ret_var.is_owned) {
34249 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
34250 LDKPayee ret_var = Payee_clone(arg);
34251 uint64_t ret_ref = 0;
34252 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34253 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34254 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34255 ret_ref = (uint64_t)ret_var.inner;
34256 if (ret_var.is_owned) {
34261 int64_t __attribute__((visibility("default"))) TS_Payee_clone_ptr(uint32_t arg) {
34263 arg_conv.inner = (void*)(arg & (~1));
34264 arg_conv.is_owned = false;
34265 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34266 int64_t ret_val = Payee_clone_ptr(&arg_conv);
34270 uint32_t __attribute__((visibility("default"))) TS_Payee_clone(uint32_t orig) {
34271 LDKPayee orig_conv;
34272 orig_conv.inner = (void*)(orig & (~1));
34273 orig_conv.is_owned = false;
34274 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34275 LDKPayee ret_var = Payee_clone(&orig_conv);
34276 uint64_t ret_ref = 0;
34277 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34278 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34279 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34280 ret_ref = (uint64_t)ret_var.inner;
34281 if (ret_var.is_owned) {
34287 int64_t __attribute__((visibility("default"))) TS_Payee_hash(uint32_t o) {
34289 o_conv.inner = (void*)(o & (~1));
34290 o_conv.is_owned = false;
34291 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34292 int64_t ret_val = Payee_hash(&o_conv);
34296 jboolean __attribute__((visibility("default"))) TS_Payee_eq(uint32_t a, uint32_t b) {
34298 a_conv.inner = (void*)(a & (~1));
34299 a_conv.is_owned = false;
34300 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34302 b_conv.inner = (void*)(b & (~1));
34303 b_conv.is_owned = false;
34304 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34305 jboolean ret_val = Payee_eq(&a_conv, &b_conv);
34309 int8_tArray __attribute__((visibility("default"))) TS_Payee_write(uint32_t obj) {
34311 obj_conv.inner = (void*)(obj & (~1));
34312 obj_conv.is_owned = false;
34313 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34314 LDKCVec_u8Z ret_var = Payee_write(&obj_conv);
34315 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
34316 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
34317 CVec_u8Z_free(ret_var);
34321 uint32_t __attribute__((visibility("default"))) TS_Payee_read(int8_tArray ser) {
34322 LDKu8slice ser_ref;
34323 ser_ref.datalen = *((uint32_t*)ser);
34324 ser_ref.data = (int8_t*)(ser + 4);
34325 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
34326 *ret_conv = Payee_read(ser_ref);
34327 return (uint64_t)ret_conv;
34330 uint32_t __attribute__((visibility("default"))) TS_Payee_from_node_id(int8_tArray pubkey) {
34331 LDKPublicKey pubkey_ref;
34332 CHECK(*((uint32_t*)pubkey) == 33);
34333 memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33);
34334 LDKPayee ret_var = Payee_from_node_id(pubkey_ref);
34335 uint64_t ret_ref = 0;
34336 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34337 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34338 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34339 ret_ref = (uint64_t)ret_var.inner;
34340 if (ret_var.is_owned) {
34346 uint32_t __attribute__((visibility("default"))) TS_Payee_for_keysend(int8_tArray pubkey) {
34347 LDKPublicKey pubkey_ref;
34348 CHECK(*((uint32_t*)pubkey) == 33);
34349 memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33);
34350 LDKPayee ret_var = Payee_for_keysend(pubkey_ref);
34351 uint64_t ret_ref = 0;
34352 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34353 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34354 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34355 ret_ref = (uint64_t)ret_var.inner;
34356 if (ret_var.is_owned) {
34362 void __attribute__((visibility("default"))) TS_RouteHint_free(uint32_t this_obj) {
34363 LDKRouteHint this_obj_conv;
34364 this_obj_conv.inner = (void*)(this_obj & (~1));
34365 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34366 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34367 RouteHint_free(this_obj_conv);
34370 uint32_tArray __attribute__((visibility("default"))) TS_RouteHint_get_a(uint32_t this_ptr) {
34371 LDKRouteHint 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 LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
34376 uint32_tArray ret_arr = NULL;
34377 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
34378 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
34379 for (size_t o = 0; o < ret_var.datalen; o++) {
34380 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
34381 uint64_t ret_conv_14_ref = 0;
34382 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34383 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34384 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
34385 ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
34386 if (ret_conv_14_var.is_owned) {
34387 ret_conv_14_ref |= 1;
34389 ret_arr_ptr[o] = ret_conv_14_ref;
34392 FREE(ret_var.data);
34396 void __attribute__((visibility("default"))) TS_RouteHint_set_a(uint32_t this_ptr, uint32_tArray val) {
34397 LDKRouteHint this_ptr_conv;
34398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34399 this_ptr_conv.is_owned = false;
34400 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34401 LDKCVec_RouteHintHopZ val_constr;
34402 val_constr.datalen = *((uint32_t*)val);
34403 if (val_constr.datalen > 0)
34404 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
34406 val_constr.data = NULL;
34407 uint32_t* val_vals = (uint32_t*)(val + 4);
34408 for (size_t o = 0; o < val_constr.datalen; o++) {
34409 uint32_t val_conv_14 = val_vals[o];
34410 LDKRouteHintHop val_conv_14_conv;
34411 val_conv_14_conv.inner = (void*)(val_conv_14 & (~1));
34412 val_conv_14_conv.is_owned = (val_conv_14 & 1) || (val_conv_14 == 0);
34413 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
34414 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
34415 val_constr.data[o] = val_conv_14_conv;
34417 RouteHint_set_a(&this_ptr_conv, val_constr);
34420 uint32_t __attribute__((visibility("default"))) TS_RouteHint_new(uint32_tArray a_arg) {
34421 LDKCVec_RouteHintHopZ a_arg_constr;
34422 a_arg_constr.datalen = *((uint32_t*)a_arg);
34423 if (a_arg_constr.datalen > 0)
34424 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
34426 a_arg_constr.data = NULL;
34427 uint32_t* a_arg_vals = (uint32_t*)(a_arg + 4);
34428 for (size_t o = 0; o < a_arg_constr.datalen; o++) {
34429 uint32_t a_arg_conv_14 = a_arg_vals[o];
34430 LDKRouteHintHop a_arg_conv_14_conv;
34431 a_arg_conv_14_conv.inner = (void*)(a_arg_conv_14 & (~1));
34432 a_arg_conv_14_conv.is_owned = (a_arg_conv_14 & 1) || (a_arg_conv_14 == 0);
34433 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
34434 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
34435 a_arg_constr.data[o] = a_arg_conv_14_conv;
34437 LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
34438 uint64_t ret_ref = 0;
34439 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34440 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34441 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34442 ret_ref = (uint64_t)ret_var.inner;
34443 if (ret_var.is_owned) {
34449 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
34450 LDKRouteHint ret_var = RouteHint_clone(arg);
34451 uint64_t ret_ref = 0;
34452 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34453 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34454 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34455 ret_ref = (uint64_t)ret_var.inner;
34456 if (ret_var.is_owned) {
34461 int64_t __attribute__((visibility("default"))) TS_RouteHint_clone_ptr(uint32_t arg) {
34462 LDKRouteHint arg_conv;
34463 arg_conv.inner = (void*)(arg & (~1));
34464 arg_conv.is_owned = false;
34465 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34466 int64_t ret_val = RouteHint_clone_ptr(&arg_conv);
34470 uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) {
34471 LDKRouteHint orig_conv;
34472 orig_conv.inner = (void*)(orig & (~1));
34473 orig_conv.is_owned = false;
34474 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34475 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
34476 uint64_t ret_ref = 0;
34477 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34478 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34479 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34480 ret_ref = (uint64_t)ret_var.inner;
34481 if (ret_var.is_owned) {
34487 int64_t __attribute__((visibility("default"))) TS_RouteHint_hash(uint32_t o) {
34488 LDKRouteHint o_conv;
34489 o_conv.inner = (void*)(o & (~1));
34490 o_conv.is_owned = false;
34491 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34492 int64_t ret_val = RouteHint_hash(&o_conv);
34496 jboolean __attribute__((visibility("default"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
34497 LDKRouteHint a_conv;
34498 a_conv.inner = (void*)(a & (~1));
34499 a_conv.is_owned = false;
34500 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34501 LDKRouteHint b_conv;
34502 b_conv.inner = (void*)(b & (~1));
34503 b_conv.is_owned = false;
34504 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34505 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
34509 int8_tArray __attribute__((visibility("default"))) TS_RouteHint_write(uint32_t obj) {
34510 LDKRouteHint obj_conv;
34511 obj_conv.inner = (void*)(obj & (~1));
34512 obj_conv.is_owned = false;
34513 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34514 LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
34515 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
34516 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
34517 CVec_u8Z_free(ret_var);
34521 uint32_t __attribute__((visibility("default"))) TS_RouteHint_read(int8_tArray ser) {
34522 LDKu8slice ser_ref;
34523 ser_ref.datalen = *((uint32_t*)ser);
34524 ser_ref.data = (int8_t*)(ser + 4);
34525 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
34526 *ret_conv = RouteHint_read(ser_ref);
34527 return (uint64_t)ret_conv;
34530 void __attribute__((visibility("default"))) TS_RouteHintHop_free(uint32_t this_obj) {
34531 LDKRouteHintHop this_obj_conv;
34532 this_obj_conv.inner = (void*)(this_obj & (~1));
34533 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34534 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34535 RouteHintHop_free(this_obj_conv);
34538 int8_tArray __attribute__((visibility("default"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) {
34539 LDKRouteHintHop this_ptr_conv;
34540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34541 this_ptr_conv.is_owned = false;
34542 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34543 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
34544 memcpy((uint8_t*)(ret_arr + 4), RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
34548 void __attribute__((visibility("default"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
34549 LDKRouteHintHop this_ptr_conv;
34550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34551 this_ptr_conv.is_owned = false;
34552 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34553 LDKPublicKey val_ref;
34554 CHECK(*((uint32_t*)val) == 33);
34555 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
34556 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
34559 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) {
34560 LDKRouteHintHop this_ptr_conv;
34561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34562 this_ptr_conv.is_owned = false;
34563 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34564 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
34568 void __attribute__((visibility("default"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
34569 LDKRouteHintHop this_ptr_conv;
34570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34571 this_ptr_conv.is_owned = false;
34572 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34573 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
34576 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) {
34577 LDKRouteHintHop this_ptr_conv;
34578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34579 this_ptr_conv.is_owned = false;
34580 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34581 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
34582 uint64_t ret_ref = 0;
34583 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34584 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34585 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34586 ret_ref = (uint64_t)ret_var.inner;
34587 if (ret_var.is_owned) {
34593 void __attribute__((visibility("default"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) {
34594 LDKRouteHintHop this_ptr_conv;
34595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34596 this_ptr_conv.is_owned = false;
34597 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34598 LDKRoutingFees val_conv;
34599 val_conv.inner = (void*)(val & (~1));
34600 val_conv.is_owned = (val & 1) || (val == 0);
34601 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34602 val_conv = RoutingFees_clone(&val_conv);
34603 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
34606 int16_t __attribute__((visibility("default"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) {
34607 LDKRouteHintHop this_ptr_conv;
34608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34609 this_ptr_conv.is_owned = false;
34610 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34611 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
34615 void __attribute__((visibility("default"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
34616 LDKRouteHintHop 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 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
34623 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) {
34624 LDKRouteHintHop this_ptr_conv;
34625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34626 this_ptr_conv.is_owned = false;
34627 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34628 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34629 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
34630 uint64_t ret_ref = (uint64_t)ret_copy;
34634 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
34635 LDKRouteHintHop this_ptr_conv;
34636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34637 this_ptr_conv.is_owned = false;
34638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34639 void* val_ptr = (void*)(((uint64_t)val) & ~1);
34640 CHECK_ACCESS(val_ptr);
34641 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34642 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
34643 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
34646 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) {
34647 LDKRouteHintHop this_ptr_conv;
34648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34649 this_ptr_conv.is_owned = false;
34650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34651 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34652 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
34653 uint64_t ret_ref = (uint64_t)ret_copy;
34657 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
34658 LDKRouteHintHop this_ptr_conv;
34659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34660 this_ptr_conv.is_owned = false;
34661 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34662 void* val_ptr = (void*)(((uint64_t)val) & ~1);
34663 CHECK_ACCESS(val_ptr);
34664 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34665 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
34666 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
34669 uint32_t __attribute__((visibility("default"))) 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) {
34670 LDKPublicKey src_node_id_arg_ref;
34671 CHECK(*((uint32_t*)src_node_id_arg) == 33);
34672 memcpy(src_node_id_arg_ref.compressed_form, (uint8_t*)(src_node_id_arg + 4), 33);
34673 LDKRoutingFees fees_arg_conv;
34674 fees_arg_conv.inner = (void*)(fees_arg & (~1));
34675 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
34676 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
34677 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
34678 void* htlc_minimum_msat_arg_ptr = (void*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
34679 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
34680 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
34681 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1));
34682 void* htlc_maximum_msat_arg_ptr = (void*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
34683 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
34684 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
34685 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
34686 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);
34687 uint64_t ret_ref = 0;
34688 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34689 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34690 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34691 ret_ref = (uint64_t)ret_var.inner;
34692 if (ret_var.is_owned) {
34698 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
34699 LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
34700 uint64_t ret_ref = 0;
34701 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34702 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34703 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34704 ret_ref = (uint64_t)ret_var.inner;
34705 if (ret_var.is_owned) {
34710 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_clone_ptr(uint32_t arg) {
34711 LDKRouteHintHop arg_conv;
34712 arg_conv.inner = (void*)(arg & (~1));
34713 arg_conv.is_owned = false;
34714 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34715 int64_t ret_val = RouteHintHop_clone_ptr(&arg_conv);
34719 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_clone(uint32_t orig) {
34720 LDKRouteHintHop orig_conv;
34721 orig_conv.inner = (void*)(orig & (~1));
34722 orig_conv.is_owned = false;
34723 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34724 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
34725 uint64_t ret_ref = 0;
34726 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34727 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34728 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34729 ret_ref = (uint64_t)ret_var.inner;
34730 if (ret_var.is_owned) {
34736 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_hash(uint32_t o) {
34737 LDKRouteHintHop o_conv;
34738 o_conv.inner = (void*)(o & (~1));
34739 o_conv.is_owned = false;
34740 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34741 int64_t ret_val = RouteHintHop_hash(&o_conv);
34745 jboolean __attribute__((visibility("default"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
34746 LDKRouteHintHop a_conv;
34747 a_conv.inner = (void*)(a & (~1));
34748 a_conv.is_owned = false;
34749 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34750 LDKRouteHintHop b_conv;
34751 b_conv.inner = (void*)(b & (~1));
34752 b_conv.is_owned = false;
34753 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34754 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
34758 int8_tArray __attribute__((visibility("default"))) TS_RouteHintHop_write(uint32_t obj) {
34759 LDKRouteHintHop obj_conv;
34760 obj_conv.inner = (void*)(obj & (~1));
34761 obj_conv.is_owned = false;
34762 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34763 LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
34764 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
34765 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
34766 CVec_u8Z_free(ret_var);
34770 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_read(int8_tArray ser) {
34771 LDKu8slice ser_ref;
34772 ser_ref.datalen = *((uint32_t*)ser);
34773 ser_ref.data = (int8_t*)(ser + 4);
34774 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
34775 *ret_conv = RouteHintHop_read(ser_ref);
34776 return (uint64_t)ret_conv;
34779 uint32_t __attribute__((visibility("default"))) TS_find_route(int8_tArray our_node_pubkey, uint32_t params, uint32_t network, uint32_tArray first_hops, uint32_t logger, uint32_t scorer) {
34780 LDKPublicKey our_node_pubkey_ref;
34781 CHECK(*((uint32_t*)our_node_pubkey) == 33);
34782 memcpy(our_node_pubkey_ref.compressed_form, (uint8_t*)(our_node_pubkey + 4), 33);
34783 LDKRouteParameters params_conv;
34784 params_conv.inner = (void*)(params & (~1));
34785 params_conv.is_owned = false;
34786 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
34787 LDKNetworkGraph network_conv;
34788 network_conv.inner = (void*)(network & (~1));
34789 network_conv.is_owned = false;
34790 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_conv);
34791 LDKCVec_ChannelDetailsZ first_hops_constr;
34792 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
34793 if (first_hops != 0) {
34794 first_hops_constr.datalen = *((uint32_t*)first_hops);
34795 if (first_hops_constr.datalen > 0)
34796 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
34798 first_hops_constr.data = NULL;
34799 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
34800 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
34801 uint32_t first_hops_conv_16 = first_hops_vals[q];
34802 LDKChannelDetails first_hops_conv_16_conv;
34803 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
34804 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
34805 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
34806 first_hops_constr.data[q] = first_hops_conv_16_conv;
34808 first_hops_ptr = &first_hops_constr;
34810 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
34811 CHECK_ACCESS(logger_ptr);
34812 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
34813 void* scorer_ptr = (void*)(((uint64_t)scorer) & ~1);
34814 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
34815 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
34816 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
34817 *ret_conv = find_route(our_node_pubkey_ref, ¶ms_conv, &network_conv, first_hops_ptr, logger_conv, scorer_conv);
34818 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
34819 return (uint64_t)ret_conv;
34822 void __attribute__((visibility("default"))) TS_Score_free(uint32_t this_ptr) {
34823 if ((this_ptr & 1) != 0) return;
34824 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
34825 CHECK_ACCESS(this_ptr_ptr);
34826 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
34827 FREE((void*)this_ptr);
34828 Score_free(this_ptr_conv);
34831 void __attribute__((visibility("default"))) TS_LockableScore_free(uint32_t this_ptr) {
34832 if ((this_ptr & 1) != 0) return;
34833 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
34834 CHECK_ACCESS(this_ptr_ptr);
34835 LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
34836 FREE((void*)this_ptr);
34837 LockableScore_free(this_ptr_conv);
34840 void __attribute__((visibility("default"))) TS_MultiThreadedLockableScore_free(uint32_t this_obj) {
34841 LDKMultiThreadedLockableScore this_obj_conv;
34842 this_obj_conv.inner = (void*)(this_obj & (~1));
34843 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34844 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34845 MultiThreadedLockableScore_free(this_obj_conv);
34848 uint32_t __attribute__((visibility("default"))) TS_MultiThreadedLockableScore_new(uint32_t score) {
34849 void* score_ptr = (void*)(((uint64_t)score) & ~1);
34850 CHECK_ACCESS(score_ptr);
34851 LDKScore score_conv = *(LDKScore*)(score_ptr);
34852 LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
34853 uint64_t ret_ref = 0;
34854 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34855 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34856 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34857 ret_ref = (uint64_t)ret_var.inner;
34858 if (ret_var.is_owned) {
34864 void __attribute__((visibility("default"))) TS_Scorer_free(uint32_t this_obj) {
34865 LDKScorer this_obj_conv;
34866 this_obj_conv.inner = (void*)(this_obj & (~1));
34867 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34868 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34869 Scorer_free(this_obj_conv);
34872 void __attribute__((visibility("default"))) TS_ScoringParameters_free(uint32_t this_obj) {
34873 LDKScoringParameters this_obj_conv;
34874 this_obj_conv.inner = (void*)(this_obj & (~1));
34875 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34877 ScoringParameters_free(this_obj_conv);
34880 int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_base_penalty_msat(uint32_t this_ptr) {
34881 LDKScoringParameters this_ptr_conv;
34882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34883 this_ptr_conv.is_owned = false;
34884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34885 int64_t ret_val = ScoringParameters_get_base_penalty_msat(&this_ptr_conv);
34889 void __attribute__((visibility("default"))) TS_ScoringParameters_set_base_penalty_msat(uint32_t this_ptr, int64_t val) {
34890 LDKScoringParameters this_ptr_conv;
34891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34892 this_ptr_conv.is_owned = false;
34893 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34894 ScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
34897 int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_failure_penalty_msat(uint32_t this_ptr) {
34898 LDKScoringParameters this_ptr_conv;
34899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34900 this_ptr_conv.is_owned = false;
34901 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34902 int64_t ret_val = ScoringParameters_get_failure_penalty_msat(&this_ptr_conv);
34906 void __attribute__((visibility("default"))) TS_ScoringParameters_set_failure_penalty_msat(uint32_t this_ptr, int64_t val) {
34907 LDKScoringParameters this_ptr_conv;
34908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34909 this_ptr_conv.is_owned = false;
34910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34911 ScoringParameters_set_failure_penalty_msat(&this_ptr_conv, val);
34914 int16_t __attribute__((visibility("default"))) TS_ScoringParameters_get_overuse_penalty_start_1024th(uint32_t this_ptr) {
34915 LDKScoringParameters this_ptr_conv;
34916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34917 this_ptr_conv.is_owned = false;
34918 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34919 int16_t ret_val = ScoringParameters_get_overuse_penalty_start_1024th(&this_ptr_conv);
34923 void __attribute__((visibility("default"))) TS_ScoringParameters_set_overuse_penalty_start_1024th(uint32_t this_ptr, int16_t val) {
34924 LDKScoringParameters 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 ScoringParameters_set_overuse_penalty_start_1024th(&this_ptr_conv, val);
34931 int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_overuse_penalty_msat_per_1024th(uint32_t this_ptr) {
34932 LDKScoringParameters this_ptr_conv;
34933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34934 this_ptr_conv.is_owned = false;
34935 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34936 int64_t ret_val = ScoringParameters_get_overuse_penalty_msat_per_1024th(&this_ptr_conv);
34940 void __attribute__((visibility("default"))) TS_ScoringParameters_set_overuse_penalty_msat_per_1024th(uint32_t this_ptr, int64_t val) {
34941 LDKScoringParameters this_ptr_conv;
34942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34943 this_ptr_conv.is_owned = false;
34944 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34945 ScoringParameters_set_overuse_penalty_msat_per_1024th(&this_ptr_conv, val);
34948 int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_failure_penalty_half_life(uint32_t this_ptr) {
34949 LDKScoringParameters this_ptr_conv;
34950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34951 this_ptr_conv.is_owned = false;
34952 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34953 int64_t ret_val = ScoringParameters_get_failure_penalty_half_life(&this_ptr_conv);
34957 void __attribute__((visibility("default"))) TS_ScoringParameters_set_failure_penalty_half_life(uint32_t this_ptr, int64_t val) {
34958 LDKScoringParameters this_ptr_conv;
34959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34960 this_ptr_conv.is_owned = false;
34961 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34962 ScoringParameters_set_failure_penalty_half_life(&this_ptr_conv, val);
34965 uint32_t __attribute__((visibility("default"))) TS_ScoringParameters_new(int64_t base_penalty_msat_arg, int64_t failure_penalty_msat_arg, int16_t overuse_penalty_start_1024th_arg, int64_t overuse_penalty_msat_per_1024th_arg, int64_t failure_penalty_half_life_arg) {
34966 LDKScoringParameters ret_var = ScoringParameters_new(base_penalty_msat_arg, failure_penalty_msat_arg, overuse_penalty_start_1024th_arg, overuse_penalty_msat_per_1024th_arg, failure_penalty_half_life_arg);
34967 uint64_t ret_ref = 0;
34968 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34969 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34970 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34971 ret_ref = (uint64_t)ret_var.inner;
34972 if (ret_var.is_owned) {
34978 int8_tArray __attribute__((visibility("default"))) TS_ScoringParameters_write(uint32_t obj) {
34979 LDKScoringParameters obj_conv;
34980 obj_conv.inner = (void*)(obj & (~1));
34981 obj_conv.is_owned = false;
34982 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34983 LDKCVec_u8Z ret_var = ScoringParameters_write(&obj_conv);
34984 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
34985 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
34986 CVec_u8Z_free(ret_var);
34990 uint32_t __attribute__((visibility("default"))) TS_ScoringParameters_read(int8_tArray ser) {
34991 LDKu8slice ser_ref;
34992 ser_ref.datalen = *((uint32_t*)ser);
34993 ser_ref.data = (int8_t*)(ser + 4);
34994 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
34995 *ret_conv = ScoringParameters_read(ser_ref);
34996 return (uint64_t)ret_conv;
34999 uint32_t __attribute__((visibility("default"))) TS_Scorer_new(uint32_t params) {
35000 LDKScoringParameters params_conv;
35001 params_conv.inner = (void*)(params & (~1));
35002 params_conv.is_owned = (params & 1) || (params == 0);
35003 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
35004 // Warning: we need a move here but no clone is available for LDKScoringParameters
35005 LDKScorer ret_var = Scorer_new(params_conv);
35006 uint64_t ret_ref = 0;
35007 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35008 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35009 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35010 ret_ref = (uint64_t)ret_var.inner;
35011 if (ret_var.is_owned) {
35017 uint32_t __attribute__((visibility("default"))) TS_Scorer_default() {
35018 LDKScorer ret_var = Scorer_default();
35019 uint64_t ret_ref = 0;
35020 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35021 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35022 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35023 ret_ref = (uint64_t)ret_var.inner;
35024 if (ret_var.is_owned) {
35030 uint32_t __attribute__((visibility("default"))) TS_ScoringParameters_default() {
35031 LDKScoringParameters ret_var = ScoringParameters_default();
35032 uint64_t ret_ref = 0;
35033 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35034 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35035 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35036 ret_ref = (uint64_t)ret_var.inner;
35037 if (ret_var.is_owned) {
35043 uint32_t __attribute__((visibility("default"))) TS_Scorer_as_Score(uint32_t this_arg) {
35044 LDKScorer this_arg_conv;
35045 this_arg_conv.inner = (void*)(this_arg & (~1));
35046 this_arg_conv.is_owned = false;
35047 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35048 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
35049 *ret_ret = Scorer_as_Score(&this_arg_conv);
35050 return (uint64_t)ret_ret;
35053 int8_tArray __attribute__((visibility("default"))) TS_Scorer_write(uint32_t obj) {
35054 LDKScorer obj_conv;
35055 obj_conv.inner = (void*)(obj & (~1));
35056 obj_conv.is_owned = false;
35057 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35058 LDKCVec_u8Z ret_var = Scorer_write(&obj_conv);
35059 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
35060 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
35061 CVec_u8Z_free(ret_var);
35065 uint32_t __attribute__((visibility("default"))) TS_Scorer_read(int8_tArray ser) {
35066 LDKu8slice ser_ref;
35067 ser_ref.datalen = *((uint32_t*)ser);
35068 ser_ref.data = (int8_t*)(ser + 4);
35069 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
35070 *ret_conv = Scorer_read(ser_ref);
35071 return (uint64_t)ret_conv;
35074 void __attribute__((visibility("default"))) TS_FilesystemPersister_free(uint32_t this_obj) {
35075 LDKFilesystemPersister this_obj_conv;
35076 this_obj_conv.inner = (void*)(this_obj & (~1));
35077 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35078 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35079 FilesystemPersister_free(this_obj_conv);
35082 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_new(jstring path_to_channel_data) {
35083 LDKStr path_to_channel_data_conv = str_ref_to_owned_c(path_to_channel_data);
35084 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
35085 uint64_t ret_ref = 0;
35086 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35087 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35088 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35089 ret_ref = (uint64_t)ret_var.inner;
35090 if (ret_var.is_owned) {
35096 jstring __attribute__((visibility("default"))) TS_FilesystemPersister_get_data_dir(uint32_t this_arg) {
35097 LDKFilesystemPersister this_arg_conv;
35098 this_arg_conv.inner = (void*)(this_arg & (~1));
35099 this_arg_conv.is_owned = false;
35100 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35101 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
35102 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
35107 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_persist_manager(jstring data_dir, uint32_t manager) {
35108 LDKStr data_dir_conv = str_ref_to_owned_c(data_dir);
35109 LDKChannelManager manager_conv;
35110 manager_conv.inner = (void*)(manager & (~1));
35111 manager_conv.is_owned = false;
35112 CHECK_INNER_FIELD_ACCESS_OR_NULL(manager_conv);
35113 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
35114 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
35115 return (uint64_t)ret_conv;
35118 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_read_channelmonitors(uint32_t this_arg, uint32_t keys_manager) {
35119 LDKFilesystemPersister this_arg_conv;
35120 this_arg_conv.inner = (void*)(this_arg & (~1));
35121 this_arg_conv.is_owned = false;
35122 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35123 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
35124 CHECK_ACCESS(keys_manager_ptr);
35125 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
35126 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
35127 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
35128 return (uint64_t)ret_conv;
35131 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_as_Persist(uint32_t this_arg) {
35132 LDKFilesystemPersister this_arg_conv;
35133 this_arg_conv.inner = (void*)(this_arg & (~1));
35134 this_arg_conv.is_owned = false;
35135 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35136 LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
35137 *ret_ret = FilesystemPersister_as_Persist(&this_arg_conv);
35138 return (uint64_t)ret_ret;
35141 void __attribute__((visibility("default"))) TS_BackgroundProcessor_free(uint32_t this_obj) {
35142 LDKBackgroundProcessor this_obj_conv;
35143 this_obj_conv.inner = (void*)(this_obj & (~1));
35144 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35145 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35146 BackgroundProcessor_free(this_obj_conv);
35149 void __attribute__((visibility("default"))) TS_ChannelManagerPersister_free(uint32_t this_ptr) {
35150 if ((this_ptr & 1) != 0) return;
35151 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
35152 CHECK_ACCESS(this_ptr_ptr);
35153 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(this_ptr_ptr);
35154 FREE((void*)this_ptr);
35155 ChannelManagerPersister_free(this_ptr_conv);
35158 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_start(uint32_t persister, uint32_t event_handler, uint32_t chain_monitor, uint32_t channel_manager, uint32_t net_graph_msg_handler, uint32_t peer_manager, uint32_t logger) {
35159 void* persister_ptr = (void*)(((uint64_t)persister) & ~1);
35160 CHECK_ACCESS(persister_ptr);
35161 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(persister_ptr);
35162 void* event_handler_ptr = (void*)(((uint64_t)event_handler) & ~1);
35163 CHECK_ACCESS(event_handler_ptr);
35164 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
35165 LDKChainMonitor chain_monitor_conv;
35166 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
35167 chain_monitor_conv.is_owned = false;
35168 CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
35169 LDKChannelManager channel_manager_conv;
35170 channel_manager_conv.inner = (void*)(channel_manager & (~1));
35171 channel_manager_conv.is_owned = false;
35172 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
35173 LDKNetGraphMsgHandler net_graph_msg_handler_conv;
35174 net_graph_msg_handler_conv.inner = (void*)(net_graph_msg_handler & (~1));
35175 net_graph_msg_handler_conv.is_owned = (net_graph_msg_handler & 1) || (net_graph_msg_handler == 0);
35176 CHECK_INNER_FIELD_ACCESS_OR_NULL(net_graph_msg_handler_conv);
35177 LDKPeerManager peer_manager_conv;
35178 peer_manager_conv.inner = (void*)(peer_manager & (~1));
35179 peer_manager_conv.is_owned = false;
35180 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
35181 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
35182 CHECK_ACCESS(logger_ptr);
35183 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
35184 LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, net_graph_msg_handler_conv, &peer_manager_conv, logger_conv);
35185 uint64_t ret_ref = 0;
35186 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35187 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35188 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35189 ret_ref = (uint64_t)ret_var.inner;
35190 if (ret_var.is_owned) {
35196 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_join(uint32_t this_arg) {
35197 LDKBackgroundProcessor this_arg_conv;
35198 this_arg_conv.inner = (void*)(this_arg & (~1));
35199 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
35200 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35201 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
35202 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
35203 *ret_conv = BackgroundProcessor_join(this_arg_conv);
35204 return (uint64_t)ret_conv;
35207 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_stop(uint32_t this_arg) {
35208 LDKBackgroundProcessor this_arg_conv;
35209 this_arg_conv.inner = (void*)(this_arg & (~1));
35210 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
35211 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35212 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
35213 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
35214 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
35215 return (uint64_t)ret_conv;
35218 void __attribute__((visibility("default"))) TS_check_platform() {
35222 void __attribute__((visibility("default"))) TS_Invoice_free(uint32_t this_obj) {
35223 LDKInvoice this_obj_conv;
35224 this_obj_conv.inner = (void*)(this_obj & (~1));
35225 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35226 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35227 Invoice_free(this_obj_conv);
35230 jboolean __attribute__((visibility("default"))) TS_Invoice_eq(uint32_t a, uint32_t b) {
35232 a_conv.inner = (void*)(a & (~1));
35233 a_conv.is_owned = false;
35234 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35236 b_conv.inner = (void*)(b & (~1));
35237 b_conv.is_owned = false;
35238 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35239 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
35243 static inline uint64_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
35244 LDKInvoice ret_var = Invoice_clone(arg);
35245 uint64_t ret_ref = 0;
35246 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35247 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35248 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35249 ret_ref = (uint64_t)ret_var.inner;
35250 if (ret_var.is_owned) {
35255 int64_t __attribute__((visibility("default"))) TS_Invoice_clone_ptr(uint32_t arg) {
35256 LDKInvoice arg_conv;
35257 arg_conv.inner = (void*)(arg & (~1));
35258 arg_conv.is_owned = false;
35259 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35260 int64_t ret_val = Invoice_clone_ptr(&arg_conv);
35264 uint32_t __attribute__((visibility("default"))) TS_Invoice_clone(uint32_t orig) {
35265 LDKInvoice orig_conv;
35266 orig_conv.inner = (void*)(orig & (~1));
35267 orig_conv.is_owned = false;
35268 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35269 LDKInvoice ret_var = Invoice_clone(&orig_conv);
35270 uint64_t ret_ref = 0;
35271 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35272 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35273 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35274 ret_ref = (uint64_t)ret_var.inner;
35275 if (ret_var.is_owned) {
35281 void __attribute__((visibility("default"))) TS_SignedRawInvoice_free(uint32_t this_obj) {
35282 LDKSignedRawInvoice this_obj_conv;
35283 this_obj_conv.inner = (void*)(this_obj & (~1));
35284 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35285 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35286 SignedRawInvoice_free(this_obj_conv);
35289 jboolean __attribute__((visibility("default"))) TS_SignedRawInvoice_eq(uint32_t a, uint32_t b) {
35290 LDKSignedRawInvoice a_conv;
35291 a_conv.inner = (void*)(a & (~1));
35292 a_conv.is_owned = false;
35293 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35294 LDKSignedRawInvoice b_conv;
35295 b_conv.inner = (void*)(b & (~1));
35296 b_conv.is_owned = false;
35297 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35298 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
35302 static inline uint64_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
35303 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
35304 uint64_t ret_ref = 0;
35305 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35306 CHECK((((uint64_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 = (uint64_t)ret_var.inner;
35309 if (ret_var.is_owned) {
35314 int64_t __attribute__((visibility("default"))) TS_SignedRawInvoice_clone_ptr(uint32_t arg) {
35315 LDKSignedRawInvoice arg_conv;
35316 arg_conv.inner = (void*)(arg & (~1));
35317 arg_conv.is_owned = false;
35318 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35319 int64_t ret_val = SignedRawInvoice_clone_ptr(&arg_conv);
35323 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_clone(uint32_t orig) {
35324 LDKSignedRawInvoice orig_conv;
35325 orig_conv.inner = (void*)(orig & (~1));
35326 orig_conv.is_owned = false;
35327 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35328 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
35329 uint64_t ret_ref = 0;
35330 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35331 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35332 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35333 ret_ref = (uint64_t)ret_var.inner;
35334 if (ret_var.is_owned) {
35340 void __attribute__((visibility("default"))) TS_RawInvoice_free(uint32_t this_obj) {
35341 LDKRawInvoice this_obj_conv;
35342 this_obj_conv.inner = (void*)(this_obj & (~1));
35343 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35345 RawInvoice_free(this_obj_conv);
35348 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_get_data(uint32_t this_ptr) {
35349 LDKRawInvoice this_ptr_conv;
35350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35351 this_ptr_conv.is_owned = false;
35352 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35353 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
35354 uint64_t ret_ref = 0;
35355 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35356 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35357 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35358 ret_ref = (uint64_t)ret_var.inner;
35359 if (ret_var.is_owned) {
35365 void __attribute__((visibility("default"))) TS_RawInvoice_set_data(uint32_t this_ptr, uint32_t val) {
35366 LDKRawInvoice this_ptr_conv;
35367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35368 this_ptr_conv.is_owned = false;
35369 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35370 LDKRawDataPart val_conv;
35371 val_conv.inner = (void*)(val & (~1));
35372 val_conv.is_owned = (val & 1) || (val == 0);
35373 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35374 val_conv = RawDataPart_clone(&val_conv);
35375 RawInvoice_set_data(&this_ptr_conv, val_conv);
35378 jboolean __attribute__((visibility("default"))) TS_RawInvoice_eq(uint32_t a, uint32_t b) {
35379 LDKRawInvoice a_conv;
35380 a_conv.inner = (void*)(a & (~1));
35381 a_conv.is_owned = false;
35382 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35383 LDKRawInvoice b_conv;
35384 b_conv.inner = (void*)(b & (~1));
35385 b_conv.is_owned = false;
35386 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35387 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
35391 static inline uint64_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
35392 LDKRawInvoice ret_var = RawInvoice_clone(arg);
35393 uint64_t ret_ref = 0;
35394 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35395 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35396 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35397 ret_ref = (uint64_t)ret_var.inner;
35398 if (ret_var.is_owned) {
35403 int64_t __attribute__((visibility("default"))) TS_RawInvoice_clone_ptr(uint32_t arg) {
35404 LDKRawInvoice arg_conv;
35405 arg_conv.inner = (void*)(arg & (~1));
35406 arg_conv.is_owned = false;
35407 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35408 int64_t ret_val = RawInvoice_clone_ptr(&arg_conv);
35412 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_clone(uint32_t orig) {
35413 LDKRawInvoice orig_conv;
35414 orig_conv.inner = (void*)(orig & (~1));
35415 orig_conv.is_owned = false;
35416 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35417 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
35418 uint64_t ret_ref = 0;
35419 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35420 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35421 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35422 ret_ref = (uint64_t)ret_var.inner;
35423 if (ret_var.is_owned) {
35429 void __attribute__((visibility("default"))) TS_RawDataPart_free(uint32_t this_obj) {
35430 LDKRawDataPart this_obj_conv;
35431 this_obj_conv.inner = (void*)(this_obj & (~1));
35432 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35433 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35434 RawDataPart_free(this_obj_conv);
35437 uint32_t __attribute__((visibility("default"))) TS_RawDataPart_get_timestamp(uint32_t this_ptr) {
35438 LDKRawDataPart this_ptr_conv;
35439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35440 this_ptr_conv.is_owned = false;
35441 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35442 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
35443 uint64_t ret_ref = 0;
35444 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35445 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35446 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35447 ret_ref = (uint64_t)ret_var.inner;
35448 if (ret_var.is_owned) {
35454 void __attribute__((visibility("default"))) TS_RawDataPart_set_timestamp(uint32_t this_ptr, uint32_t val) {
35455 LDKRawDataPart this_ptr_conv;
35456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35457 this_ptr_conv.is_owned = false;
35458 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35459 LDKPositiveTimestamp val_conv;
35460 val_conv.inner = (void*)(val & (~1));
35461 val_conv.is_owned = (val & 1) || (val == 0);
35462 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35463 val_conv = PositiveTimestamp_clone(&val_conv);
35464 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
35467 jboolean __attribute__((visibility("default"))) TS_RawDataPart_eq(uint32_t a, uint32_t b) {
35468 LDKRawDataPart a_conv;
35469 a_conv.inner = (void*)(a & (~1));
35470 a_conv.is_owned = false;
35471 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35472 LDKRawDataPart b_conv;
35473 b_conv.inner = (void*)(b & (~1));
35474 b_conv.is_owned = false;
35475 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35476 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
35480 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
35481 LDKRawDataPart ret_var = RawDataPart_clone(arg);
35482 uint64_t ret_ref = 0;
35483 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35484 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35485 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35486 ret_ref = (uint64_t)ret_var.inner;
35487 if (ret_var.is_owned) {
35492 int64_t __attribute__((visibility("default"))) TS_RawDataPart_clone_ptr(uint32_t arg) {
35493 LDKRawDataPart arg_conv;
35494 arg_conv.inner = (void*)(arg & (~1));
35495 arg_conv.is_owned = false;
35496 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35497 int64_t ret_val = RawDataPart_clone_ptr(&arg_conv);
35501 uint32_t __attribute__((visibility("default"))) TS_RawDataPart_clone(uint32_t orig) {
35502 LDKRawDataPart orig_conv;
35503 orig_conv.inner = (void*)(orig & (~1));
35504 orig_conv.is_owned = false;
35505 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35506 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
35507 uint64_t ret_ref = 0;
35508 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35509 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35510 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35511 ret_ref = (uint64_t)ret_var.inner;
35512 if (ret_var.is_owned) {
35518 void __attribute__((visibility("default"))) TS_PositiveTimestamp_free(uint32_t this_obj) {
35519 LDKPositiveTimestamp this_obj_conv;
35520 this_obj_conv.inner = (void*)(this_obj & (~1));
35521 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35523 PositiveTimestamp_free(this_obj_conv);
35526 jboolean __attribute__((visibility("default"))) TS_PositiveTimestamp_eq(uint32_t a, uint32_t b) {
35527 LDKPositiveTimestamp a_conv;
35528 a_conv.inner = (void*)(a & (~1));
35529 a_conv.is_owned = false;
35530 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35531 LDKPositiveTimestamp b_conv;
35532 b_conv.inner = (void*)(b & (~1));
35533 b_conv.is_owned = false;
35534 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35535 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
35539 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
35540 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
35541 uint64_t ret_ref = 0;
35542 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35543 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35544 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35545 ret_ref = (uint64_t)ret_var.inner;
35546 if (ret_var.is_owned) {
35551 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_clone_ptr(uint32_t arg) {
35552 LDKPositiveTimestamp arg_conv;
35553 arg_conv.inner = (void*)(arg & (~1));
35554 arg_conv.is_owned = false;
35555 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35556 int64_t ret_val = PositiveTimestamp_clone_ptr(&arg_conv);
35560 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_clone(uint32_t orig) {
35561 LDKPositiveTimestamp orig_conv;
35562 orig_conv.inner = (void*)(orig & (~1));
35563 orig_conv.is_owned = false;
35564 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35565 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
35566 uint64_t ret_ref = 0;
35567 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35568 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35569 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35570 ret_ref = (uint64_t)ret_var.inner;
35571 if (ret_var.is_owned) {
35577 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_clone(uint32_t orig) {
35578 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
35579 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
35583 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_milli() {
35584 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
35588 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_micro() {
35589 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
35593 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_nano() {
35594 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
35598 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_pico() {
35599 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
35603 jboolean __attribute__((visibility("default"))) TS_SiPrefix_eq(uint32_t a, uint32_t b) {
35604 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
35605 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
35606 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
35610 int64_t __attribute__((visibility("default"))) TS_SiPrefix_multiplier(uint32_t this_arg) {
35611 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
35612 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
35616 uint32_t __attribute__((visibility("default"))) TS_Currency_clone(uint32_t orig) {
35617 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
35618 uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
35622 uint32_t __attribute__((visibility("default"))) TS_Currency_bitcoin() {
35623 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
35627 uint32_t __attribute__((visibility("default"))) TS_Currency_bitcoin_testnet() {
35628 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
35632 uint32_t __attribute__((visibility("default"))) TS_Currency_regtest() {
35633 uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
35637 uint32_t __attribute__((visibility("default"))) TS_Currency_simnet() {
35638 uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
35642 uint32_t __attribute__((visibility("default"))) TS_Currency_signet() {
35643 uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
35647 int64_t __attribute__((visibility("default"))) TS_Currency_hash(uint32_t o) {
35648 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
35649 int64_t ret_val = Currency_hash(o_conv);
35653 jboolean __attribute__((visibility("default"))) TS_Currency_eq(uint32_t a, uint32_t b) {
35654 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
35655 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
35656 jboolean ret_val = Currency_eq(a_conv, b_conv);
35660 void __attribute__((visibility("default"))) TS_Sha256_free(uint32_t this_obj) {
35661 LDKSha256 this_obj_conv;
35662 this_obj_conv.inner = (void*)(this_obj & (~1));
35663 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35664 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35665 Sha256_free(this_obj_conv);
35668 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
35669 LDKSha256 ret_var = Sha256_clone(arg);
35670 uint64_t ret_ref = 0;
35671 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35672 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35673 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35674 ret_ref = (uint64_t)ret_var.inner;
35675 if (ret_var.is_owned) {
35680 int64_t __attribute__((visibility("default"))) TS_Sha256_clone_ptr(uint32_t arg) {
35681 LDKSha256 arg_conv;
35682 arg_conv.inner = (void*)(arg & (~1));
35683 arg_conv.is_owned = false;
35684 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35685 int64_t ret_val = Sha256_clone_ptr(&arg_conv);
35689 uint32_t __attribute__((visibility("default"))) TS_Sha256_clone(uint32_t orig) {
35690 LDKSha256 orig_conv;
35691 orig_conv.inner = (void*)(orig & (~1));
35692 orig_conv.is_owned = false;
35693 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35694 LDKSha256 ret_var = Sha256_clone(&orig_conv);
35695 uint64_t ret_ref = 0;
35696 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35697 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35698 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35699 ret_ref = (uint64_t)ret_var.inner;
35700 if (ret_var.is_owned) {
35706 int64_t __attribute__((visibility("default"))) TS_Sha256_hash(uint32_t o) {
35708 o_conv.inner = (void*)(o & (~1));
35709 o_conv.is_owned = false;
35710 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35711 int64_t ret_val = Sha256_hash(&o_conv);
35715 jboolean __attribute__((visibility("default"))) TS_Sha256_eq(uint32_t a, uint32_t b) {
35717 a_conv.inner = (void*)(a & (~1));
35718 a_conv.is_owned = false;
35719 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35721 b_conv.inner = (void*)(b & (~1));
35722 b_conv.is_owned = false;
35723 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35724 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
35728 void __attribute__((visibility("default"))) TS_Description_free(uint32_t this_obj) {
35729 LDKDescription this_obj_conv;
35730 this_obj_conv.inner = (void*)(this_obj & (~1));
35731 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35732 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35733 Description_free(this_obj_conv);
35736 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
35737 LDKDescription ret_var = Description_clone(arg);
35738 uint64_t ret_ref = 0;
35739 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35740 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35741 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35742 ret_ref = (uint64_t)ret_var.inner;
35743 if (ret_var.is_owned) {
35748 int64_t __attribute__((visibility("default"))) TS_Description_clone_ptr(uint32_t arg) {
35749 LDKDescription arg_conv;
35750 arg_conv.inner = (void*)(arg & (~1));
35751 arg_conv.is_owned = false;
35752 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35753 int64_t ret_val = Description_clone_ptr(&arg_conv);
35757 uint32_t __attribute__((visibility("default"))) TS_Description_clone(uint32_t orig) {
35758 LDKDescription orig_conv;
35759 orig_conv.inner = (void*)(orig & (~1));
35760 orig_conv.is_owned = false;
35761 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35762 LDKDescription ret_var = Description_clone(&orig_conv);
35763 uint64_t ret_ref = 0;
35764 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35765 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35766 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35767 ret_ref = (uint64_t)ret_var.inner;
35768 if (ret_var.is_owned) {
35774 int64_t __attribute__((visibility("default"))) TS_Description_hash(uint32_t o) {
35775 LDKDescription o_conv;
35776 o_conv.inner = (void*)(o & (~1));
35777 o_conv.is_owned = false;
35778 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35779 int64_t ret_val = Description_hash(&o_conv);
35783 jboolean __attribute__((visibility("default"))) TS_Description_eq(uint32_t a, uint32_t b) {
35784 LDKDescription a_conv;
35785 a_conv.inner = (void*)(a & (~1));
35786 a_conv.is_owned = false;
35787 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35788 LDKDescription b_conv;
35789 b_conv.inner = (void*)(b & (~1));
35790 b_conv.is_owned = false;
35791 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35792 jboolean ret_val = Description_eq(&a_conv, &b_conv);
35796 void __attribute__((visibility("default"))) TS_PayeePubKey_free(uint32_t this_obj) {
35797 LDKPayeePubKey this_obj_conv;
35798 this_obj_conv.inner = (void*)(this_obj & (~1));
35799 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35801 PayeePubKey_free(this_obj_conv);
35804 int8_tArray __attribute__((visibility("default"))) TS_PayeePubKey_get_a(uint32_t this_ptr) {
35805 LDKPayeePubKey this_ptr_conv;
35806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35807 this_ptr_conv.is_owned = false;
35808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35809 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
35810 memcpy((uint8_t*)(ret_arr + 4), PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
35814 void __attribute__((visibility("default"))) TS_PayeePubKey_set_a(uint32_t this_ptr, int8_tArray val) {
35815 LDKPayeePubKey this_ptr_conv;
35816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35817 this_ptr_conv.is_owned = false;
35818 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35819 LDKPublicKey val_ref;
35820 CHECK(*((uint32_t*)val) == 33);
35821 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
35822 PayeePubKey_set_a(&this_ptr_conv, val_ref);
35825 uint32_t __attribute__((visibility("default"))) TS_PayeePubKey_new(int8_tArray a_arg) {
35826 LDKPublicKey a_arg_ref;
35827 CHECK(*((uint32_t*)a_arg) == 33);
35828 memcpy(a_arg_ref.compressed_form, (uint8_t*)(a_arg + 4), 33);
35829 LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
35830 uint64_t ret_ref = 0;
35831 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35832 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35833 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35834 ret_ref = (uint64_t)ret_var.inner;
35835 if (ret_var.is_owned) {
35841 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
35842 LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
35843 uint64_t ret_ref = 0;
35844 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35845 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35846 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35847 ret_ref = (uint64_t)ret_var.inner;
35848 if (ret_var.is_owned) {
35853 int64_t __attribute__((visibility("default"))) TS_PayeePubKey_clone_ptr(uint32_t arg) {
35854 LDKPayeePubKey arg_conv;
35855 arg_conv.inner = (void*)(arg & (~1));
35856 arg_conv.is_owned = false;
35857 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35858 int64_t ret_val = PayeePubKey_clone_ptr(&arg_conv);
35862 uint32_t __attribute__((visibility("default"))) TS_PayeePubKey_clone(uint32_t orig) {
35863 LDKPayeePubKey orig_conv;
35864 orig_conv.inner = (void*)(orig & (~1));
35865 orig_conv.is_owned = false;
35866 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35867 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
35868 uint64_t ret_ref = 0;
35869 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35870 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35871 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35872 ret_ref = (uint64_t)ret_var.inner;
35873 if (ret_var.is_owned) {
35879 int64_t __attribute__((visibility("default"))) TS_PayeePubKey_hash(uint32_t o) {
35880 LDKPayeePubKey o_conv;
35881 o_conv.inner = (void*)(o & (~1));
35882 o_conv.is_owned = false;
35883 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35884 int64_t ret_val = PayeePubKey_hash(&o_conv);
35888 jboolean __attribute__((visibility("default"))) TS_PayeePubKey_eq(uint32_t a, uint32_t b) {
35889 LDKPayeePubKey a_conv;
35890 a_conv.inner = (void*)(a & (~1));
35891 a_conv.is_owned = false;
35892 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35893 LDKPayeePubKey b_conv;
35894 b_conv.inner = (void*)(b & (~1));
35895 b_conv.is_owned = false;
35896 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35897 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
35901 void __attribute__((visibility("default"))) TS_ExpiryTime_free(uint32_t this_obj) {
35902 LDKExpiryTime this_obj_conv;
35903 this_obj_conv.inner = (void*)(this_obj & (~1));
35904 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35905 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35906 ExpiryTime_free(this_obj_conv);
35909 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
35910 LDKExpiryTime ret_var = ExpiryTime_clone(arg);
35911 uint64_t ret_ref = 0;
35912 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35913 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35914 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35915 ret_ref = (uint64_t)ret_var.inner;
35916 if (ret_var.is_owned) {
35921 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_clone_ptr(uint32_t arg) {
35922 LDKExpiryTime arg_conv;
35923 arg_conv.inner = (void*)(arg & (~1));
35924 arg_conv.is_owned = false;
35925 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35926 int64_t ret_val = ExpiryTime_clone_ptr(&arg_conv);
35930 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_clone(uint32_t orig) {
35931 LDKExpiryTime orig_conv;
35932 orig_conv.inner = (void*)(orig & (~1));
35933 orig_conv.is_owned = false;
35934 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35935 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
35936 uint64_t ret_ref = 0;
35937 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35938 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35939 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35940 ret_ref = (uint64_t)ret_var.inner;
35941 if (ret_var.is_owned) {
35947 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_hash(uint32_t o) {
35948 LDKExpiryTime o_conv;
35949 o_conv.inner = (void*)(o & (~1));
35950 o_conv.is_owned = false;
35951 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35952 int64_t ret_val = ExpiryTime_hash(&o_conv);
35956 jboolean __attribute__((visibility("default"))) TS_ExpiryTime_eq(uint32_t a, uint32_t b) {
35957 LDKExpiryTime a_conv;
35958 a_conv.inner = (void*)(a & (~1));
35959 a_conv.is_owned = false;
35960 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35961 LDKExpiryTime b_conv;
35962 b_conv.inner = (void*)(b & (~1));
35963 b_conv.is_owned = false;
35964 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35965 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
35969 void __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_free(uint32_t this_obj) {
35970 LDKMinFinalCltvExpiry this_obj_conv;
35971 this_obj_conv.inner = (void*)(this_obj & (~1));
35972 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35973 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35974 MinFinalCltvExpiry_free(this_obj_conv);
35977 int64_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_get_a(uint32_t this_ptr) {
35978 LDKMinFinalCltvExpiry this_ptr_conv;
35979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35980 this_ptr_conv.is_owned = false;
35981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35982 int64_t ret_val = MinFinalCltvExpiry_get_a(&this_ptr_conv);
35986 void __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_set_a(uint32_t this_ptr, int64_t val) {
35987 LDKMinFinalCltvExpiry this_ptr_conv;
35988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35989 this_ptr_conv.is_owned = false;
35990 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35991 MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
35994 uint32_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_new(int64_t a_arg) {
35995 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
35996 uint64_t ret_ref = 0;
35997 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35998 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35999 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36000 ret_ref = (uint64_t)ret_var.inner;
36001 if (ret_var.is_owned) {
36007 static inline uint64_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
36008 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
36009 uint64_t ret_ref = 0;
36010 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36011 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36012 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36013 ret_ref = (uint64_t)ret_var.inner;
36014 if (ret_var.is_owned) {
36019 int64_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_clone_ptr(uint32_t arg) {
36020 LDKMinFinalCltvExpiry arg_conv;
36021 arg_conv.inner = (void*)(arg & (~1));
36022 arg_conv.is_owned = false;
36023 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36024 int64_t ret_val = MinFinalCltvExpiry_clone_ptr(&arg_conv);
36028 uint32_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_clone(uint32_t orig) {
36029 LDKMinFinalCltvExpiry orig_conv;
36030 orig_conv.inner = (void*)(orig & (~1));
36031 orig_conv.is_owned = false;
36032 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36033 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
36034 uint64_t ret_ref = 0;
36035 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36036 CHECK((((uint64_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 = (uint64_t)ret_var.inner;
36039 if (ret_var.is_owned) {
36045 int64_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_hash(uint32_t o) {
36046 LDKMinFinalCltvExpiry o_conv;
36047 o_conv.inner = (void*)(o & (~1));
36048 o_conv.is_owned = false;
36049 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36050 int64_t ret_val = MinFinalCltvExpiry_hash(&o_conv);
36054 jboolean __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_eq(uint32_t a, uint32_t b) {
36055 LDKMinFinalCltvExpiry a_conv;
36056 a_conv.inner = (void*)(a & (~1));
36057 a_conv.is_owned = false;
36058 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36059 LDKMinFinalCltvExpiry b_conv;
36060 b_conv.inner = (void*)(b & (~1));
36061 b_conv.is_owned = false;
36062 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36063 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
36067 void __attribute__((visibility("default"))) TS_Fallback_free(uint32_t this_ptr) {
36068 if ((this_ptr & 1) != 0) return;
36069 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
36070 CHECK_ACCESS(this_ptr_ptr);
36071 LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
36072 FREE((void*)this_ptr);
36073 Fallback_free(this_ptr_conv);
36076 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
36077 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
36078 *ret_copy = Fallback_clone(arg);
36079 uint64_t ret_ref = (uint64_t)ret_copy;
36082 int64_t __attribute__((visibility("default"))) TS_Fallback_clone_ptr(uint32_t arg) {
36083 LDKFallback* arg_conv = (LDKFallback*)arg;
36084 int64_t ret_val = Fallback_clone_ptr(arg_conv);
36088 uint32_t __attribute__((visibility("default"))) TS_Fallback_clone(uint32_t orig) {
36089 LDKFallback* orig_conv = (LDKFallback*)orig;
36090 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
36091 *ret_copy = Fallback_clone(orig_conv);
36092 uint64_t ret_ref = (uint64_t)ret_copy;
36096 uint32_t __attribute__((visibility("default"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
36098 LDKCVec_u8Z program_ref;
36099 program_ref.datalen = *((uint32_t*)program);
36100 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
36101 memcpy(program_ref.data, (uint8_t*)(program + 4), program_ref.datalen);
36102 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
36103 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
36104 uint64_t ret_ref = (uint64_t)ret_copy;
36108 uint32_t __attribute__((visibility("default"))) TS_Fallback_pub_key_hash(int8_tArray a) {
36109 LDKTwentyBytes a_ref;
36110 CHECK(*((uint32_t*)a) == 20);
36111 memcpy(a_ref.data, (uint8_t*)(a + 4), 20);
36112 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
36113 *ret_copy = Fallback_pub_key_hash(a_ref);
36114 uint64_t ret_ref = (uint64_t)ret_copy;
36118 uint32_t __attribute__((visibility("default"))) TS_Fallback_script_hash(int8_tArray a) {
36119 LDKTwentyBytes a_ref;
36120 CHECK(*((uint32_t*)a) == 20);
36121 memcpy(a_ref.data, (uint8_t*)(a + 4), 20);
36122 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
36123 *ret_copy = Fallback_script_hash(a_ref);
36124 uint64_t ret_ref = (uint64_t)ret_copy;
36128 int64_t __attribute__((visibility("default"))) TS_Fallback_hash(uint32_t o) {
36129 LDKFallback* o_conv = (LDKFallback*)o;
36130 int64_t ret_val = Fallback_hash(o_conv);
36134 jboolean __attribute__((visibility("default"))) TS_Fallback_eq(uint32_t a, uint32_t b) {
36135 LDKFallback* a_conv = (LDKFallback*)a;
36136 LDKFallback* b_conv = (LDKFallback*)b;
36137 jboolean ret_val = Fallback_eq(a_conv, b_conv);
36141 void __attribute__((visibility("default"))) TS_InvoiceSignature_free(uint32_t this_obj) {
36142 LDKInvoiceSignature this_obj_conv;
36143 this_obj_conv.inner = (void*)(this_obj & (~1));
36144 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36145 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36146 InvoiceSignature_free(this_obj_conv);
36149 static inline uint64_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
36150 LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
36151 uint64_t ret_ref = 0;
36152 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36153 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36154 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36155 ret_ref = (uint64_t)ret_var.inner;
36156 if (ret_var.is_owned) {
36161 int64_t __attribute__((visibility("default"))) TS_InvoiceSignature_clone_ptr(uint32_t arg) {
36162 LDKInvoiceSignature arg_conv;
36163 arg_conv.inner = (void*)(arg & (~1));
36164 arg_conv.is_owned = false;
36165 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36166 int64_t ret_val = InvoiceSignature_clone_ptr(&arg_conv);
36170 uint32_t __attribute__((visibility("default"))) TS_InvoiceSignature_clone(uint32_t orig) {
36171 LDKInvoiceSignature orig_conv;
36172 orig_conv.inner = (void*)(orig & (~1));
36173 orig_conv.is_owned = false;
36174 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36175 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
36176 uint64_t ret_ref = 0;
36177 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36178 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36179 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36180 ret_ref = (uint64_t)ret_var.inner;
36181 if (ret_var.is_owned) {
36187 jboolean __attribute__((visibility("default"))) TS_InvoiceSignature_eq(uint32_t a, uint32_t b) {
36188 LDKInvoiceSignature a_conv;
36189 a_conv.inner = (void*)(a & (~1));
36190 a_conv.is_owned = false;
36191 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36192 LDKInvoiceSignature b_conv;
36193 b_conv.inner = (void*)(b & (~1));
36194 b_conv.is_owned = false;
36195 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36196 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
36200 void __attribute__((visibility("default"))) TS_PrivateRoute_free(uint32_t this_obj) {
36201 LDKPrivateRoute this_obj_conv;
36202 this_obj_conv.inner = (void*)(this_obj & (~1));
36203 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36204 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36205 PrivateRoute_free(this_obj_conv);
36208 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
36209 LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
36210 uint64_t ret_ref = 0;
36211 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36212 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36213 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36214 ret_ref = (uint64_t)ret_var.inner;
36215 if (ret_var.is_owned) {
36220 int64_t __attribute__((visibility("default"))) TS_PrivateRoute_clone_ptr(uint32_t arg) {
36221 LDKPrivateRoute arg_conv;
36222 arg_conv.inner = (void*)(arg & (~1));
36223 arg_conv.is_owned = false;
36224 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36225 int64_t ret_val = PrivateRoute_clone_ptr(&arg_conv);
36229 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_clone(uint32_t orig) {
36230 LDKPrivateRoute orig_conv;
36231 orig_conv.inner = (void*)(orig & (~1));
36232 orig_conv.is_owned = false;
36233 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36234 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
36235 uint64_t ret_ref = 0;
36236 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36237 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36238 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36239 ret_ref = (uint64_t)ret_var.inner;
36240 if (ret_var.is_owned) {
36246 int64_t __attribute__((visibility("default"))) TS_PrivateRoute_hash(uint32_t o) {
36247 LDKPrivateRoute o_conv;
36248 o_conv.inner = (void*)(o & (~1));
36249 o_conv.is_owned = false;
36250 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36251 int64_t ret_val = PrivateRoute_hash(&o_conv);
36255 jboolean __attribute__((visibility("default"))) TS_PrivateRoute_eq(uint32_t a, uint32_t b) {
36256 LDKPrivateRoute a_conv;
36257 a_conv.inner = (void*)(a & (~1));
36258 a_conv.is_owned = false;
36259 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36260 LDKPrivateRoute b_conv;
36261 b_conv.inner = (void*)(b & (~1));
36262 b_conv.is_owned = false;
36263 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36264 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
36268 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_into_parts(uint32_t this_arg) {
36269 LDKSignedRawInvoice this_arg_conv;
36270 this_arg_conv.inner = (void*)(this_arg & (~1));
36271 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
36272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36273 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
36274 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
36275 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
36276 return ((uint64_t)ret_conv);
36279 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_raw_invoice(uint32_t this_arg) {
36280 LDKSignedRawInvoice this_arg_conv;
36281 this_arg_conv.inner = (void*)(this_arg & (~1));
36282 this_arg_conv.is_owned = false;
36283 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36284 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
36285 uint64_t ret_ref = 0;
36286 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36287 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36288 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36289 ret_ref = (uint64_t)ret_var.inner;
36290 if (ret_var.is_owned) {
36296 int8_tArray __attribute__((visibility("default"))) TS_SignedRawInvoice_hash(uint32_t this_arg) {
36297 LDKSignedRawInvoice this_arg_conv;
36298 this_arg_conv.inner = (void*)(this_arg & (~1));
36299 this_arg_conv.is_owned = false;
36300 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36301 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
36302 memcpy((uint8_t*)(ret_arr + 4), *SignedRawInvoice_hash(&this_arg_conv), 32);
36306 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_signature(uint32_t this_arg) {
36307 LDKSignedRawInvoice this_arg_conv;
36308 this_arg_conv.inner = (void*)(this_arg & (~1));
36309 this_arg_conv.is_owned = false;
36310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36311 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
36312 uint64_t ret_ref = 0;
36313 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36314 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36315 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36316 ret_ref = (uint64_t)ret_var.inner;
36317 if (ret_var.is_owned) {
36323 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_recover_payee_pub_key(uint32_t this_arg) {
36324 LDKSignedRawInvoice this_arg_conv;
36325 this_arg_conv.inner = (void*)(this_arg & (~1));
36326 this_arg_conv.is_owned = false;
36327 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36328 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
36329 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
36330 return (uint64_t)ret_conv;
36333 jboolean __attribute__((visibility("default"))) TS_SignedRawInvoice_check_signature(uint32_t this_arg) {
36334 LDKSignedRawInvoice this_arg_conv;
36335 this_arg_conv.inner = (void*)(this_arg & (~1));
36336 this_arg_conv.is_owned = false;
36337 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36338 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
36342 int8_tArray __attribute__((visibility("default"))) TS_RawInvoice_hash(uint32_t this_arg) {
36343 LDKRawInvoice this_arg_conv;
36344 this_arg_conv.inner = (void*)(this_arg & (~1));
36345 this_arg_conv.is_owned = false;
36346 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36347 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
36348 memcpy((uint8_t*)(ret_arr + 4), RawInvoice_hash(&this_arg_conv).data, 32);
36352 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_payment_hash(uint32_t this_arg) {
36353 LDKRawInvoice this_arg_conv;
36354 this_arg_conv.inner = (void*)(this_arg & (~1));
36355 this_arg_conv.is_owned = false;
36356 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36357 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
36358 uint64_t ret_ref = 0;
36359 if ((uint64_t)ret_var.inner > 4096) {
36360 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36361 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36362 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36363 ret_ref = (uint64_t)ret_var.inner;
36364 if (ret_var.is_owned) {
36371 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_description(uint32_t this_arg) {
36372 LDKRawInvoice this_arg_conv;
36373 this_arg_conv.inner = (void*)(this_arg & (~1));
36374 this_arg_conv.is_owned = false;
36375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36376 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
36377 uint64_t ret_ref = 0;
36378 if ((uint64_t)ret_var.inner > 4096) {
36379 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36380 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36381 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36382 ret_ref = (uint64_t)ret_var.inner;
36383 if (ret_var.is_owned) {
36390 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_payee_pub_key(uint32_t this_arg) {
36391 LDKRawInvoice this_arg_conv;
36392 this_arg_conv.inner = (void*)(this_arg & (~1));
36393 this_arg_conv.is_owned = false;
36394 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36395 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
36396 uint64_t ret_ref = 0;
36397 if ((uint64_t)ret_var.inner > 4096) {
36398 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36399 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36400 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36401 ret_ref = (uint64_t)ret_var.inner;
36402 if (ret_var.is_owned) {
36409 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_description_hash(uint32_t this_arg) {
36410 LDKRawInvoice this_arg_conv;
36411 this_arg_conv.inner = (void*)(this_arg & (~1));
36412 this_arg_conv.is_owned = false;
36413 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36414 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
36415 uint64_t ret_ref = 0;
36416 if ((uint64_t)ret_var.inner > 4096) {
36417 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36418 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36419 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36420 ret_ref = (uint64_t)ret_var.inner;
36421 if (ret_var.is_owned) {
36428 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_expiry_time(uint32_t this_arg) {
36429 LDKRawInvoice this_arg_conv;
36430 this_arg_conv.inner = (void*)(this_arg & (~1));
36431 this_arg_conv.is_owned = false;
36432 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36433 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
36434 uint64_t ret_ref = 0;
36435 if ((uint64_t)ret_var.inner > 4096) {
36436 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36437 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36438 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36439 ret_ref = (uint64_t)ret_var.inner;
36440 if (ret_var.is_owned) {
36447 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_min_final_cltv_expiry(uint32_t this_arg) {
36448 LDKRawInvoice this_arg_conv;
36449 this_arg_conv.inner = (void*)(this_arg & (~1));
36450 this_arg_conv.is_owned = false;
36451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36452 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
36453 uint64_t ret_ref = 0;
36454 if ((uint64_t)ret_var.inner > 4096) {
36455 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36456 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36457 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36458 ret_ref = (uint64_t)ret_var.inner;
36459 if (ret_var.is_owned) {
36466 int8_tArray __attribute__((visibility("default"))) TS_RawInvoice_payment_secret(uint32_t this_arg) {
36467 LDKRawInvoice this_arg_conv;
36468 this_arg_conv.inner = (void*)(this_arg & (~1));
36469 this_arg_conv.is_owned = false;
36470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36471 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
36472 memcpy((uint8_t*)(ret_arr + 4), RawInvoice_payment_secret(&this_arg_conv).data, 32);
36476 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_features(uint32_t this_arg) {
36477 LDKRawInvoice this_arg_conv;
36478 this_arg_conv.inner = (void*)(this_arg & (~1));
36479 this_arg_conv.is_owned = false;
36480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36481 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
36482 uint64_t ret_ref = 0;
36483 if ((uint64_t)ret_var.inner > 4096) {
36484 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36485 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36486 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36487 ret_ref = (uint64_t)ret_var.inner;
36488 if (ret_var.is_owned) {
36495 uint32_tArray __attribute__((visibility("default"))) TS_RawInvoice_private_routes(uint32_t this_arg) {
36496 LDKRawInvoice this_arg_conv;
36497 this_arg_conv.inner = (void*)(this_arg & (~1));
36498 this_arg_conv.is_owned = false;
36499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36500 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
36501 uint32_tArray ret_arr = NULL;
36502 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
36503 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
36504 for (size_t o = 0; o < ret_var.datalen; o++) {
36505 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
36506 uint64_t ret_conv_14_ref = 0;
36507 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36508 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36509 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
36510 ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
36511 if (ret_conv_14_var.is_owned) {
36512 ret_conv_14_ref |= 1;
36514 ret_arr_ptr[o] = ret_conv_14_ref;
36517 FREE(ret_var.data);
36521 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_amount_pico_btc(uint32_t this_arg) {
36522 LDKRawInvoice this_arg_conv;
36523 this_arg_conv.inner = (void*)(this_arg & (~1));
36524 this_arg_conv.is_owned = false;
36525 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36526 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
36527 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
36528 uint64_t ret_ref = (uint64_t)ret_copy;
36532 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_currency(uint32_t this_arg) {
36533 LDKRawInvoice this_arg_conv;
36534 this_arg_conv.inner = (void*)(this_arg & (~1));
36535 this_arg_conv.is_owned = false;
36536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36537 uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
36541 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
36542 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
36543 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
36544 return (uint64_t)ret_conv;
36547 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_from_system_time(int64_t time) {
36548 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
36549 *ret_conv = PositiveTimestamp_from_system_time(time);
36550 return (uint64_t)ret_conv;
36553 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_as_unix_timestamp(uint32_t this_arg) {
36554 LDKPositiveTimestamp this_arg_conv;
36555 this_arg_conv.inner = (void*)(this_arg & (~1));
36556 this_arg_conv.is_owned = false;
36557 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36558 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
36562 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_as_time(uint32_t this_arg) {
36563 LDKPositiveTimestamp this_arg_conv;
36564 this_arg_conv.inner = (void*)(this_arg & (~1));
36565 this_arg_conv.is_owned = false;
36566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36567 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
36571 uint32_t __attribute__((visibility("default"))) TS_Invoice_into_signed_raw(uint32_t this_arg) {
36572 LDKInvoice this_arg_conv;
36573 this_arg_conv.inner = (void*)(this_arg & (~1));
36574 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
36575 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36576 this_arg_conv = Invoice_clone(&this_arg_conv);
36577 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
36578 uint64_t ret_ref = 0;
36579 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36580 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36581 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36582 ret_ref = (uint64_t)ret_var.inner;
36583 if (ret_var.is_owned) {
36589 uint32_t __attribute__((visibility("default"))) TS_Invoice_check_signature(uint32_t this_arg) {
36590 LDKInvoice this_arg_conv;
36591 this_arg_conv.inner = (void*)(this_arg & (~1));
36592 this_arg_conv.is_owned = false;
36593 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36594 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
36595 *ret_conv = Invoice_check_signature(&this_arg_conv);
36596 return (uint64_t)ret_conv;
36599 uint32_t __attribute__((visibility("default"))) TS_Invoice_from_signed(uint32_t signed_invoice) {
36600 LDKSignedRawInvoice signed_invoice_conv;
36601 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
36602 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
36603 CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
36604 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
36605 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
36606 *ret_conv = Invoice_from_signed(signed_invoice_conv);
36607 return (uint64_t)ret_conv;
36610 int64_t __attribute__((visibility("default"))) TS_Invoice_timestamp(uint32_t this_arg) {
36611 LDKInvoice this_arg_conv;
36612 this_arg_conv.inner = (void*)(this_arg & (~1));
36613 this_arg_conv.is_owned = false;
36614 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36615 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
36619 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payment_hash(uint32_t this_arg) {
36620 LDKInvoice this_arg_conv;
36621 this_arg_conv.inner = (void*)(this_arg & (~1));
36622 this_arg_conv.is_owned = false;
36623 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36624 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
36625 memcpy((uint8_t*)(ret_arr + 4), *Invoice_payment_hash(&this_arg_conv), 32);
36629 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payee_pub_key(uint32_t this_arg) {
36630 LDKInvoice this_arg_conv;
36631 this_arg_conv.inner = (void*)(this_arg & (~1));
36632 this_arg_conv.is_owned = false;
36633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36634 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
36635 memcpy((uint8_t*)(ret_arr + 4), Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
36639 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payment_secret(uint32_t this_arg) {
36640 LDKInvoice this_arg_conv;
36641 this_arg_conv.inner = (void*)(this_arg & (~1));
36642 this_arg_conv.is_owned = false;
36643 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36644 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
36645 memcpy((uint8_t*)(ret_arr + 4), *Invoice_payment_secret(&this_arg_conv), 32);
36649 uint32_t __attribute__((visibility("default"))) TS_Invoice_features(uint32_t this_arg) {
36650 LDKInvoice this_arg_conv;
36651 this_arg_conv.inner = (void*)(this_arg & (~1));
36652 this_arg_conv.is_owned = false;
36653 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36654 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
36655 uint64_t ret_ref = 0;
36656 if ((uint64_t)ret_var.inner > 4096) {
36657 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36658 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36659 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36660 ret_ref = (uint64_t)ret_var.inner;
36661 if (ret_var.is_owned) {
36668 int8_tArray __attribute__((visibility("default"))) TS_Invoice_recover_payee_pub_key(uint32_t this_arg) {
36669 LDKInvoice this_arg_conv;
36670 this_arg_conv.inner = (void*)(this_arg & (~1));
36671 this_arg_conv.is_owned = false;
36672 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36673 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
36674 memcpy((uint8_t*)(ret_arr + 4), Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
36678 int64_t __attribute__((visibility("default"))) TS_Invoice_expiry_time(uint32_t this_arg) {
36679 LDKInvoice this_arg_conv;
36680 this_arg_conv.inner = (void*)(this_arg & (~1));
36681 this_arg_conv.is_owned = false;
36682 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36683 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
36687 jboolean __attribute__((visibility("default"))) TS_Invoice_is_expired(uint32_t this_arg) {
36688 LDKInvoice this_arg_conv;
36689 this_arg_conv.inner = (void*)(this_arg & (~1));
36690 this_arg_conv.is_owned = false;
36691 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36692 jboolean ret_val = Invoice_is_expired(&this_arg_conv);
36696 int64_t __attribute__((visibility("default"))) TS_Invoice_min_final_cltv_expiry(uint32_t this_arg) {
36697 LDKInvoice 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 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
36705 uint32_tArray __attribute__((visibility("default"))) TS_Invoice_private_routes(uint32_t this_arg) {
36706 LDKInvoice this_arg_conv;
36707 this_arg_conv.inner = (void*)(this_arg & (~1));
36708 this_arg_conv.is_owned = false;
36709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36710 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
36711 uint32_tArray ret_arr = NULL;
36712 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
36713 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
36714 for (size_t o = 0; o < ret_var.datalen; o++) {
36715 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
36716 uint64_t ret_conv_14_ref = 0;
36717 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36718 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36719 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
36720 ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
36721 if (ret_conv_14_var.is_owned) {
36722 ret_conv_14_ref |= 1;
36724 ret_arr_ptr[o] = ret_conv_14_ref;
36727 FREE(ret_var.data);
36731 uint32_tArray __attribute__((visibility("default"))) TS_Invoice_route_hints(uint32_t this_arg) {
36732 LDKInvoice 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 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
36737 uint32_tArray ret_arr = NULL;
36738 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
36739 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
36740 for (size_t l = 0; l < ret_var.datalen; l++) {
36741 LDKRouteHint ret_conv_11_var = ret_var.data[l];
36742 uint64_t ret_conv_11_ref = 0;
36743 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36744 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36745 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
36746 ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
36747 if (ret_conv_11_var.is_owned) {
36748 ret_conv_11_ref |= 1;
36750 ret_arr_ptr[l] = ret_conv_11_ref;
36753 FREE(ret_var.data);
36757 uint32_t __attribute__((visibility("default"))) TS_Invoice_currency(uint32_t this_arg) {
36758 LDKInvoice this_arg_conv;
36759 this_arg_conv.inner = (void*)(this_arg & (~1));
36760 this_arg_conv.is_owned = false;
36761 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36762 uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
36766 uint32_t __attribute__((visibility("default"))) TS_Invoice_amount_milli_satoshis(uint32_t this_arg) {
36767 LDKInvoice this_arg_conv;
36768 this_arg_conv.inner = (void*)(this_arg & (~1));
36769 this_arg_conv.is_owned = false;
36770 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36771 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
36772 *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
36773 uint64_t ret_ref = (uint64_t)ret_copy;
36777 uint32_t __attribute__((visibility("default"))) TS_Description_new(jstring description) {
36778 LDKStr description_conv = str_ref_to_owned_c(description);
36779 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
36780 *ret_conv = Description_new(description_conv);
36781 return (uint64_t)ret_conv;
36784 jstring __attribute__((visibility("default"))) TS_Description_into_inner(uint32_t this_arg) {
36785 LDKDescription this_arg_conv;
36786 this_arg_conv.inner = (void*)(this_arg & (~1));
36787 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
36788 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36789 this_arg_conv = Description_clone(&this_arg_conv);
36790 LDKStr ret_str = Description_into_inner(this_arg_conv);
36791 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36796 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
36797 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
36798 *ret_conv = ExpiryTime_from_seconds(seconds);
36799 return (uint64_t)ret_conv;
36802 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_from_duration(int64_t duration) {
36803 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
36804 *ret_conv = ExpiryTime_from_duration(duration);
36805 return (uint64_t)ret_conv;
36808 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_as_seconds(uint32_t this_arg) {
36809 LDKExpiryTime this_arg_conv;
36810 this_arg_conv.inner = (void*)(this_arg & (~1));
36811 this_arg_conv.is_owned = false;
36812 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36813 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
36817 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_as_duration(uint32_t this_arg) {
36818 LDKExpiryTime this_arg_conv;
36819 this_arg_conv.inner = (void*)(this_arg & (~1));
36820 this_arg_conv.is_owned = false;
36821 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36822 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
36826 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_new(uint32_t hops) {
36827 LDKRouteHint hops_conv;
36828 hops_conv.inner = (void*)(hops & (~1));
36829 hops_conv.is_owned = (hops & 1) || (hops == 0);
36830 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
36831 hops_conv = RouteHint_clone(&hops_conv);
36832 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
36833 *ret_conv = PrivateRoute_new(hops_conv);
36834 return (uint64_t)ret_conv;
36837 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_into_inner(uint32_t this_arg) {
36838 LDKPrivateRoute this_arg_conv;
36839 this_arg_conv.inner = (void*)(this_arg & (~1));
36840 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
36841 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36842 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
36843 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
36844 uint64_t ret_ref = 0;
36845 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36846 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36847 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36848 ret_ref = (uint64_t)ret_var.inner;
36849 if (ret_var.is_owned) {
36855 uint32_t __attribute__((visibility("default"))) TS_CreationError_clone(uint32_t orig) {
36856 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
36857 uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
36861 uint32_t __attribute__((visibility("default"))) TS_CreationError_description_too_long() {
36862 uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
36866 uint32_t __attribute__((visibility("default"))) TS_CreationError_route_too_long() {
36867 uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
36871 uint32_t __attribute__((visibility("default"))) TS_CreationError_timestamp_out_of_bounds() {
36872 uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
36876 uint32_t __attribute__((visibility("default"))) TS_CreationError_expiry_time_out_of_bounds() {
36877 uint32_t ret_conv = LDKCreationError_to_js(CreationError_expiry_time_out_of_bounds());
36881 uint32_t __attribute__((visibility("default"))) TS_CreationError_invalid_amount() {
36882 uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
36886 jboolean __attribute__((visibility("default"))) TS_CreationError_eq(uint32_t a, uint32_t b) {
36887 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
36888 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
36889 jboolean ret_val = CreationError_eq(a_conv, b_conv);
36893 jstring __attribute__((visibility("default"))) TS_CreationError_to_str(uint32_t o) {
36894 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
36895 LDKStr ret_str = CreationError_to_str(o_conv);
36896 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36901 uint32_t __attribute__((visibility("default"))) TS_SemanticError_clone(uint32_t orig) {
36902 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
36903 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
36907 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_payment_hash() {
36908 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
36912 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_hashes() {
36913 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
36917 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_description() {
36918 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
36922 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_descriptions() {
36923 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
36927 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_payment_secret() {
36928 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
36932 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_secrets() {
36933 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
36937 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_features() {
36938 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
36942 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_recovery_id() {
36943 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
36947 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_signature() {
36948 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
36952 uint32_t __attribute__((visibility("default"))) TS_SemanticError_imprecise_amount() {
36953 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
36957 jboolean __attribute__((visibility("default"))) TS_SemanticError_eq(uint32_t a, uint32_t b) {
36958 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
36959 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
36960 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
36964 jstring __attribute__((visibility("default"))) TS_SemanticError_to_str(uint32_t o) {
36965 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
36966 LDKStr ret_str = SemanticError_to_str(o_conv);
36967 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36972 void __attribute__((visibility("default"))) TS_SignOrCreationError_free(uint32_t this_ptr) {
36973 if ((this_ptr & 1) != 0) return;
36974 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
36975 CHECK_ACCESS(this_ptr_ptr);
36976 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
36977 FREE((void*)this_ptr);
36978 SignOrCreationError_free(this_ptr_conv);
36981 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
36982 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
36983 *ret_copy = SignOrCreationError_clone(arg);
36984 uint64_t ret_ref = (uint64_t)ret_copy;
36987 int64_t __attribute__((visibility("default"))) TS_SignOrCreationError_clone_ptr(uint32_t arg) {
36988 LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)arg;
36989 int64_t ret_val = SignOrCreationError_clone_ptr(arg_conv);
36993 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_clone(uint32_t orig) {
36994 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
36995 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
36996 *ret_copy = SignOrCreationError_clone(orig_conv);
36997 uint64_t ret_ref = (uint64_t)ret_copy;
37001 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_sign_error() {
37002 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
37003 *ret_copy = SignOrCreationError_sign_error();
37004 uint64_t ret_ref = (uint64_t)ret_copy;
37008 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_creation_error(uint32_t a) {
37009 LDKCreationError a_conv = LDKCreationError_from_js(a);
37010 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
37011 *ret_copy = SignOrCreationError_creation_error(a_conv);
37012 uint64_t ret_ref = (uint64_t)ret_copy;
37016 jboolean __attribute__((visibility("default"))) TS_SignOrCreationError_eq(uint32_t a, uint32_t b) {
37017 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
37018 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
37019 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
37023 jstring __attribute__((visibility("default"))) TS_SignOrCreationError_to_str(uint32_t o) {
37024 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
37025 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
37026 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
37031 void __attribute__((visibility("default"))) TS_InvoicePayer_free(uint32_t this_obj) {
37032 LDKInvoicePayer this_obj_conv;
37033 this_obj_conv.inner = (void*)(this_obj & (~1));
37034 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37035 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37036 InvoicePayer_free(this_obj_conv);
37039 void __attribute__((visibility("default"))) TS_Payer_free(uint32_t this_ptr) {
37040 if ((this_ptr & 1) != 0) return;
37041 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
37042 CHECK_ACCESS(this_ptr_ptr);
37043 LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
37044 FREE((void*)this_ptr);
37045 Payer_free(this_ptr_conv);
37048 void __attribute__((visibility("default"))) TS_Router_free(uint32_t this_ptr) {
37049 if ((this_ptr & 1) != 0) return;
37050 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
37051 CHECK_ACCESS(this_ptr_ptr);
37052 LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
37053 FREE((void*)this_ptr);
37054 Router_free(this_ptr_conv);
37057 void __attribute__((visibility("default"))) TS_RetryAttempts_free(uint32_t this_obj) {
37058 LDKRetryAttempts this_obj_conv;
37059 this_obj_conv.inner = (void*)(this_obj & (~1));
37060 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37061 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37062 RetryAttempts_free(this_obj_conv);
37065 int64_t __attribute__((visibility("default"))) TS_RetryAttempts_get_a(uint32_t this_ptr) {
37066 LDKRetryAttempts this_ptr_conv;
37067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37068 this_ptr_conv.is_owned = false;
37069 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37070 int64_t ret_val = RetryAttempts_get_a(&this_ptr_conv);
37074 void __attribute__((visibility("default"))) TS_RetryAttempts_set_a(uint32_t this_ptr, int64_t val) {
37075 LDKRetryAttempts this_ptr_conv;
37076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37077 this_ptr_conv.is_owned = false;
37078 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37079 RetryAttempts_set_a(&this_ptr_conv, val);
37082 uint32_t __attribute__((visibility("default"))) TS_RetryAttempts_new(int64_t a_arg) {
37083 LDKRetryAttempts ret_var = RetryAttempts_new(a_arg);
37084 uint64_t ret_ref = 0;
37085 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37086 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37087 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37088 ret_ref = (uint64_t)ret_var.inner;
37089 if (ret_var.is_owned) {
37095 static inline uint64_t RetryAttempts_clone_ptr(LDKRetryAttempts *NONNULL_PTR arg) {
37096 LDKRetryAttempts ret_var = RetryAttempts_clone(arg);
37097 uint64_t ret_ref = 0;
37098 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37099 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37100 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37101 ret_ref = (uint64_t)ret_var.inner;
37102 if (ret_var.is_owned) {
37107 int64_t __attribute__((visibility("default"))) TS_RetryAttempts_clone_ptr(uint32_t arg) {
37108 LDKRetryAttempts arg_conv;
37109 arg_conv.inner = (void*)(arg & (~1));
37110 arg_conv.is_owned = false;
37111 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37112 int64_t ret_val = RetryAttempts_clone_ptr(&arg_conv);
37116 uint32_t __attribute__((visibility("default"))) TS_RetryAttempts_clone(uint32_t orig) {
37117 LDKRetryAttempts orig_conv;
37118 orig_conv.inner = (void*)(orig & (~1));
37119 orig_conv.is_owned = false;
37120 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37121 LDKRetryAttempts ret_var = RetryAttempts_clone(&orig_conv);
37122 uint64_t ret_ref = 0;
37123 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37124 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37125 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37126 ret_ref = (uint64_t)ret_var.inner;
37127 if (ret_var.is_owned) {
37133 jboolean __attribute__((visibility("default"))) TS_RetryAttempts_eq(uint32_t a, uint32_t b) {
37134 LDKRetryAttempts a_conv;
37135 a_conv.inner = (void*)(a & (~1));
37136 a_conv.is_owned = false;
37137 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37138 LDKRetryAttempts b_conv;
37139 b_conv.inner = (void*)(b & (~1));
37140 b_conv.is_owned = false;
37141 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37142 jboolean ret_val = RetryAttempts_eq(&a_conv, &b_conv);
37146 int64_t __attribute__((visibility("default"))) TS_RetryAttempts_hash(uint32_t o) {
37147 LDKRetryAttempts o_conv;
37148 o_conv.inner = (void*)(o & (~1));
37149 o_conv.is_owned = false;
37150 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37151 int64_t ret_val = RetryAttempts_hash(&o_conv);
37155 void __attribute__((visibility("default"))) TS_PaymentError_free(uint32_t this_ptr) {
37156 if ((this_ptr & 1) != 0) return;
37157 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
37158 CHECK_ACCESS(this_ptr_ptr);
37159 LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
37160 FREE((void*)this_ptr);
37161 PaymentError_free(this_ptr_conv);
37164 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
37165 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
37166 *ret_copy = PaymentError_clone(arg);
37167 uint64_t ret_ref = (uint64_t)ret_copy;
37170 int64_t __attribute__((visibility("default"))) TS_PaymentError_clone_ptr(uint32_t arg) {
37171 LDKPaymentError* arg_conv = (LDKPaymentError*)arg;
37172 int64_t ret_val = PaymentError_clone_ptr(arg_conv);
37176 uint32_t __attribute__((visibility("default"))) TS_PaymentError_clone(uint32_t orig) {
37177 LDKPaymentError* orig_conv = (LDKPaymentError*)orig;
37178 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
37179 *ret_copy = PaymentError_clone(orig_conv);
37180 uint64_t ret_ref = (uint64_t)ret_copy;
37184 uint32_t __attribute__((visibility("default"))) TS_PaymentError_invoice(jstring a) {
37185 LDKStr a_conv = str_ref_to_owned_c(a);
37186 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
37187 *ret_copy = PaymentError_invoice(a_conv);
37188 uint64_t ret_ref = (uint64_t)ret_copy;
37192 uint32_t __attribute__((visibility("default"))) TS_PaymentError_routing(uint32_t a) {
37193 LDKLightningError a_conv;
37194 a_conv.inner = (void*)(a & (~1));
37195 a_conv.is_owned = (a & 1) || (a == 0);
37196 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37197 a_conv = LightningError_clone(&a_conv);
37198 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
37199 *ret_copy = PaymentError_routing(a_conv);
37200 uint64_t ret_ref = (uint64_t)ret_copy;
37204 uint32_t __attribute__((visibility("default"))) TS_PaymentError_sending(uint32_t a) {
37205 void* a_ptr = (void*)(((uint64_t)a) & ~1);
37206 CHECK_ACCESS(a_ptr);
37207 LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
37208 a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)a) & ~1));
37209 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
37210 *ret_copy = PaymentError_sending(a_conv);
37211 uint64_t ret_ref = (uint64_t)ret_copy;
37215 uint32_t __attribute__((visibility("default"))) TS_InvoicePayer_new(uint32_t payer, uint32_t router, uint32_t scorer, uint32_t logger, uint32_t event_handler, uint32_t retry_attempts) {
37216 void* payer_ptr = (void*)(((uint64_t)payer) & ~1);
37217 CHECK_ACCESS(payer_ptr);
37218 LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
37219 void* router_ptr = (void*)(((uint64_t)router) & ~1);
37220 CHECK_ACCESS(router_ptr);
37221 LDKRouter router_conv = *(LDKRouter*)(router_ptr);
37222 LDKMultiThreadedLockableScore scorer_conv;
37223 scorer_conv.inner = (void*)(scorer & (~1));
37224 scorer_conv.is_owned = false;
37225 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
37226 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
37227 CHECK_ACCESS(logger_ptr);
37228 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
37229 void* event_handler_ptr = (void*)(((uint64_t)event_handler) & ~1);
37230 CHECK_ACCESS(event_handler_ptr);
37231 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
37232 LDKRetryAttempts retry_attempts_conv;
37233 retry_attempts_conv.inner = (void*)(retry_attempts & (~1));
37234 retry_attempts_conv.is_owned = (retry_attempts & 1) || (retry_attempts == 0);
37235 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_attempts_conv);
37236 retry_attempts_conv = RetryAttempts_clone(&retry_attempts_conv);
37237 LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, &scorer_conv, logger_conv, event_handler_conv, retry_attempts_conv);
37238 uint64_t ret_ref = 0;
37239 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37240 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37241 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37242 ret_ref = (uint64_t)ret_var.inner;
37243 if (ret_var.is_owned) {
37249 uint32_t __attribute__((visibility("default"))) TS_InvoicePayer_pay_invoice(uint32_t this_arg, uint32_t invoice) {
37250 LDKInvoicePayer this_arg_conv;
37251 this_arg_conv.inner = (void*)(this_arg & (~1));
37252 this_arg_conv.is_owned = false;
37253 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37254 LDKInvoice invoice_conv;
37255 invoice_conv.inner = (void*)(invoice & (~1));
37256 invoice_conv.is_owned = false;
37257 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
37258 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
37259 *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
37260 return (uint64_t)ret_conv;
37263 uint32_t __attribute__((visibility("default"))) TS_InvoicePayer_pay_zero_value_invoice(uint32_t this_arg, uint32_t invoice, int64_t amount_msats) {
37264 LDKInvoicePayer this_arg_conv;
37265 this_arg_conv.inner = (void*)(this_arg & (~1));
37266 this_arg_conv.is_owned = false;
37267 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37268 LDKInvoice invoice_conv;
37269 invoice_conv.inner = (void*)(invoice & (~1));
37270 invoice_conv.is_owned = false;
37271 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
37272 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
37273 *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
37274 return (uint64_t)ret_conv;
37277 uint32_t __attribute__((visibility("default"))) 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) {
37278 LDKInvoicePayer this_arg_conv;
37279 this_arg_conv.inner = (void*)(this_arg & (~1));
37280 this_arg_conv.is_owned = false;
37281 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37282 LDKPublicKey pubkey_ref;
37283 CHECK(*((uint32_t*)pubkey) == 33);
37284 memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33);
37285 LDKThirtyTwoBytes payment_preimage_ref;
37286 CHECK(*((uint32_t*)payment_preimage) == 32);
37287 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
37288 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
37289 *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
37290 return (uint64_t)ret_conv;
37293 void __attribute__((visibility("default"))) TS_InvoicePayer_remove_cached_payment(uint32_t this_arg, int8_tArray payment_hash) {
37294 LDKInvoicePayer this_arg_conv;
37295 this_arg_conv.inner = (void*)(this_arg & (~1));
37296 this_arg_conv.is_owned = false;
37297 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37298 unsigned char payment_hash_arr[32];
37299 CHECK(*((uint32_t*)payment_hash) == 32);
37300 memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32);
37301 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
37302 InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
37305 uint32_t __attribute__((visibility("default"))) TS_InvoicePayer_as_EventHandler(uint32_t this_arg) {
37306 LDKInvoicePayer this_arg_conv;
37307 this_arg_conv.inner = (void*)(this_arg & (~1));
37308 this_arg_conv.is_owned = false;
37309 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37310 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
37311 *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
37312 return (uint64_t)ret_ret;
37315 uint32_t __attribute__((visibility("default"))) TS_create_invoice_from_channelmanager(uint32_t channelmanager, uint32_t keys_manager, uint32_t network, uint32_t amt_msat, jstring description) {
37316 LDKChannelManager channelmanager_conv;
37317 channelmanager_conv.inner = (void*)(channelmanager & (~1));
37318 channelmanager_conv.is_owned = false;
37319 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
37320 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
37321 CHECK_ACCESS(keys_manager_ptr);
37322 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
37323 LDKCurrency network_conv = LDKCurrency_from_js(network);
37324 void* amt_msat_ptr = (void*)(((uint64_t)amt_msat) & ~1);
37325 CHECK_ACCESS(amt_msat_ptr);
37326 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
37327 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1));
37328 LDKStr description_conv = str_ref_to_owned_c(description);
37329 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
37330 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
37331 return (uint64_t)ret_conv;
37334 void __attribute__((visibility("default"))) TS_DefaultRouter_free(uint32_t this_obj) {
37335 LDKDefaultRouter this_obj_conv;
37336 this_obj_conv.inner = (void*)(this_obj & (~1));
37337 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37338 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37339 DefaultRouter_free(this_obj_conv);
37342 uint32_t __attribute__((visibility("default"))) TS_DefaultRouter_new(uint32_t network_graph, uint32_t logger) {
37343 LDKNetworkGraph network_graph_conv;
37344 network_graph_conv.inner = (void*)(network_graph & (~1));
37345 network_graph_conv.is_owned = false;
37346 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
37347 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
37348 CHECK_ACCESS(logger_ptr);
37349 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
37350 LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv);
37351 uint64_t ret_ref = 0;
37352 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37353 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37354 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37355 ret_ref = (uint64_t)ret_var.inner;
37356 if (ret_var.is_owned) {
37362 uint32_t __attribute__((visibility("default"))) TS_DefaultRouter_as_Router(uint32_t this_arg) {
37363 LDKDefaultRouter this_arg_conv;
37364 this_arg_conv.inner = (void*)(this_arg & (~1));
37365 this_arg_conv.is_owned = false;
37366 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37367 LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
37368 *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
37369 return (uint64_t)ret_ret;
37372 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Payer(uint32_t this_arg) {
37373 LDKChannelManager this_arg_conv;
37374 this_arg_conv.inner = (void*)(this_arg & (~1));
37375 this_arg_conv.is_owned = false;
37376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37377 LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
37378 *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
37379 return (uint64_t)ret_ret;
37382 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_from_str(jstring s) {
37383 LDKStr s_conv = str_ref_to_owned_c(s);
37384 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
37385 *ret_conv = SiPrefix_from_str(s_conv);
37386 return (uint64_t)ret_conv;
37389 uint32_t __attribute__((visibility("default"))) TS_Invoice_from_str(jstring s) {
37390 LDKStr s_conv = str_ref_to_owned_c(s);
37391 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
37392 *ret_conv = Invoice_from_str(s_conv);
37393 return (uint64_t)ret_conv;
37396 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_from_str(jstring s) {
37397 LDKStr s_conv = str_ref_to_owned_c(s);
37398 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
37399 *ret_conv = SignedRawInvoice_from_str(s_conv);
37400 return (uint64_t)ret_conv;
37403 jstring __attribute__((visibility("default"))) TS_Invoice_to_str(uint32_t o) {
37405 o_conv.inner = (void*)(o & (~1));
37406 o_conv.is_owned = false;
37407 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37408 LDKStr ret_str = Invoice_to_str(&o_conv);
37409 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
37414 jstring __attribute__((visibility("default"))) TS_SignedRawInvoice_to_str(uint32_t o) {
37415 LDKSignedRawInvoice o_conv;
37416 o_conv.inner = (void*)(o & (~1));
37417 o_conv.is_owned = false;
37418 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37419 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
37420 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
37425 jstring __attribute__((visibility("default"))) TS_Currency_to_str(uint32_t o) {
37426 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
37427 LDKStr ret_str = Currency_to_str(o_conv);
37428 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
37433 jstring __attribute__((visibility("default"))) TS_SiPrefix_to_str(uint32_t o) {
37434 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
37435 LDKStr ret_str = SiPrefix_to_str(o_conv);
37436 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);