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 LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_js(int32_t ord) {
88 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
89 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
93 static inline int32_t LDKChannelMonitorUpdateErr_to_js(LDKChannelMonitorUpdateErr val) {
95 case LDKChannelMonitorUpdateErr_TemporaryFailure: return 0;
96 case LDKChannelMonitorUpdateErr_PermanentFailure: return 1;
100 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
102 case 0: return LDKConfirmationTarget_Background;
103 case 1: return LDKConfirmationTarget_Normal;
104 case 2: return LDKConfirmationTarget_HighPriority;
108 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
110 case LDKConfirmationTarget_Background: return 0;
111 case LDKConfirmationTarget_Normal: return 1;
112 case LDKConfirmationTarget_HighPriority: return 2;
116 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
118 case 0: return LDKCreationError_DescriptionTooLong;
119 case 1: return LDKCreationError_RouteTooLong;
120 case 2: return LDKCreationError_TimestampOutOfBounds;
121 case 3: return LDKCreationError_ExpiryTimeOutOfBounds;
125 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
127 case LDKCreationError_DescriptionTooLong: return 0;
128 case LDKCreationError_RouteTooLong: return 1;
129 case LDKCreationError_TimestampOutOfBounds: return 2;
130 case LDKCreationError_ExpiryTimeOutOfBounds: return 3;
134 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
136 case 0: return LDKCurrency_Bitcoin;
137 case 1: return LDKCurrency_BitcoinTestnet;
138 case 2: return LDKCurrency_Regtest;
139 case 3: return LDKCurrency_Simnet;
140 case 4: return LDKCurrency_Signet;
144 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
146 case LDKCurrency_Bitcoin: return 0;
147 case LDKCurrency_BitcoinTestnet: return 1;
148 case LDKCurrency_Regtest: return 2;
149 case LDKCurrency_Simnet: return 3;
150 case LDKCurrency_Signet: return 4;
154 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
156 case 0: return LDKIOError_NotFound;
157 case 1: return LDKIOError_PermissionDenied;
158 case 2: return LDKIOError_ConnectionRefused;
159 case 3: return LDKIOError_ConnectionReset;
160 case 4: return LDKIOError_ConnectionAborted;
161 case 5: return LDKIOError_NotConnected;
162 case 6: return LDKIOError_AddrInUse;
163 case 7: return LDKIOError_AddrNotAvailable;
164 case 8: return LDKIOError_BrokenPipe;
165 case 9: return LDKIOError_AlreadyExists;
166 case 10: return LDKIOError_WouldBlock;
167 case 11: return LDKIOError_InvalidInput;
168 case 12: return LDKIOError_InvalidData;
169 case 13: return LDKIOError_TimedOut;
170 case 14: return LDKIOError_WriteZero;
171 case 15: return LDKIOError_Interrupted;
172 case 16: return LDKIOError_Other;
173 case 17: return LDKIOError_UnexpectedEof;
177 static inline int32_t LDKIOError_to_js(LDKIOError val) {
179 case LDKIOError_NotFound: return 0;
180 case LDKIOError_PermissionDenied: return 1;
181 case LDKIOError_ConnectionRefused: return 2;
182 case LDKIOError_ConnectionReset: return 3;
183 case LDKIOError_ConnectionAborted: return 4;
184 case LDKIOError_NotConnected: return 5;
185 case LDKIOError_AddrInUse: return 6;
186 case LDKIOError_AddrNotAvailable: return 7;
187 case LDKIOError_BrokenPipe: return 8;
188 case LDKIOError_AlreadyExists: return 9;
189 case LDKIOError_WouldBlock: return 10;
190 case LDKIOError_InvalidInput: return 11;
191 case LDKIOError_InvalidData: return 12;
192 case LDKIOError_TimedOut: return 13;
193 case LDKIOError_WriteZero: return 14;
194 case LDKIOError_Interrupted: return 15;
195 case LDKIOError_Other: return 16;
196 case LDKIOError_UnexpectedEof: return 17;
200 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
202 case 0: return LDKLevel_Trace;
203 case 1: return LDKLevel_Debug;
204 case 2: return LDKLevel_Info;
205 case 3: return LDKLevel_Warn;
206 case 4: return LDKLevel_Error;
210 static inline int32_t LDKLevel_to_js(LDKLevel val) {
212 case LDKLevel_Trace: return 0;
213 case LDKLevel_Debug: return 1;
214 case LDKLevel_Info: return 2;
215 case LDKLevel_Warn: return 3;
216 case LDKLevel_Error: return 4;
220 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
222 case 0: return LDKNetwork_Bitcoin;
223 case 1: return LDKNetwork_Testnet;
224 case 2: return LDKNetwork_Regtest;
225 case 3: return LDKNetwork_Signet;
229 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
231 case LDKNetwork_Bitcoin: return 0;
232 case LDKNetwork_Testnet: return 1;
233 case LDKNetwork_Regtest: return 2;
234 case LDKNetwork_Signet: return 3;
238 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
240 case 0: return LDKSecp256k1Error_IncorrectSignature;
241 case 1: return LDKSecp256k1Error_InvalidMessage;
242 case 2: return LDKSecp256k1Error_InvalidPublicKey;
243 case 3: return LDKSecp256k1Error_InvalidSignature;
244 case 4: return LDKSecp256k1Error_InvalidSecretKey;
245 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
246 case 6: return LDKSecp256k1Error_InvalidTweak;
247 case 7: return LDKSecp256k1Error_TweakCheckFailed;
248 case 8: return LDKSecp256k1Error_NotEnoughMemory;
252 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
254 case LDKSecp256k1Error_IncorrectSignature: return 0;
255 case LDKSecp256k1Error_InvalidMessage: return 1;
256 case LDKSecp256k1Error_InvalidPublicKey: return 2;
257 case LDKSecp256k1Error_InvalidSignature: return 3;
258 case LDKSecp256k1Error_InvalidSecretKey: return 4;
259 case LDKSecp256k1Error_InvalidRecoveryId: return 5;
260 case LDKSecp256k1Error_InvalidTweak: return 6;
261 case LDKSecp256k1Error_TweakCheckFailed: return 7;
262 case LDKSecp256k1Error_NotEnoughMemory: return 8;
266 static inline LDKSemanticError LDKSemanticError_from_js(int32_t ord) {
268 case 0: return LDKSemanticError_NoPaymentHash;
269 case 1: return LDKSemanticError_MultiplePaymentHashes;
270 case 2: return LDKSemanticError_NoDescription;
271 case 3: return LDKSemanticError_MultipleDescriptions;
272 case 4: return LDKSemanticError_NoPaymentSecret;
273 case 5: return LDKSemanticError_MultiplePaymentSecrets;
274 case 6: return LDKSemanticError_InvalidFeatures;
275 case 7: return LDKSemanticError_InvalidRecoveryId;
276 case 8: return LDKSemanticError_InvalidSignature;
277 case 9: return LDKSemanticError_ImpreciseAmount;
281 static inline int32_t LDKSemanticError_to_js(LDKSemanticError val) {
283 case LDKSemanticError_NoPaymentHash: return 0;
284 case LDKSemanticError_MultiplePaymentHashes: return 1;
285 case LDKSemanticError_NoDescription: return 2;
286 case LDKSemanticError_MultipleDescriptions: return 3;
287 case LDKSemanticError_NoPaymentSecret: return 4;
288 case LDKSemanticError_MultiplePaymentSecrets: return 5;
289 case LDKSemanticError_InvalidFeatures: return 6;
290 case LDKSemanticError_InvalidRecoveryId: return 7;
291 case LDKSemanticError_InvalidSignature: return 8;
292 case LDKSemanticError_ImpreciseAmount: return 9;
296 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
298 case 0: return LDKSiPrefix_Milli;
299 case 1: return LDKSiPrefix_Micro;
300 case 2: return LDKSiPrefix_Nano;
301 case 3: return LDKSiPrefix_Pico;
305 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
307 case LDKSiPrefix_Milli: return 0;
308 case LDKSiPrefix_Micro: return 1;
309 case LDKSiPrefix_Nano: return 2;
310 case LDKSiPrefix_Pico: return 3;
314 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
315 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
316 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
319 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) {
320 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
321 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
322 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
323 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
324 CVec_u8Z_free(ret_var);
328 uint64_t TxOut_get_value (struct LDKTxOut* thing) { return thing->value;}int64_t __attribute__((visibility("default"))) TS_TxOut_get_value(uint32_t thing) {
329 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
330 int64_t ret_val = TxOut_get_value(thing_conv);
334 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_ok(uint32_t arg) {
335 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
336 CHECK(val->result_ok);
337 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
338 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).bytes, 32);
341 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_err(uint32_t arg) {
342 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
343 CHECK(!val->result_ok);
344 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
347 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_ok(uint32_t arg) {
348 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
349 CHECK(val->result_ok);
350 int8_tArray res_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
351 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compressed_form, 33);
354 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_err(uint32_t arg) {
355 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
356 CHECK(!val->result_ok);
357 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
360 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_ok(uint32_t arg) {
361 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
362 CHECK(val->result_ok);
363 LDKTxCreationKeys res_var = (*val->contents.result);
364 uint64_t res_ref = 0;
365 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
366 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
367 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
368 res_ref = (uint64_t)res_var.inner & ~1;
371 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_err(uint32_t arg) {
372 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
373 CHECK(!val->result_ok);
374 LDKDecodeError err_var = (*val->contents.err);
375 uint64_t err_ref = 0;
376 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
377 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
378 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
379 err_ref = (uint64_t)err_var.inner & ~1;
382 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint32_t arg) {
383 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
384 CHECK(val->result_ok);
385 LDKChannelPublicKeys res_var = (*val->contents.result);
386 uint64_t res_ref = 0;
387 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
388 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
389 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
390 res_ref = (uint64_t)res_var.inner & ~1;
393 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_err(uint32_t arg) {
394 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
395 CHECK(!val->result_ok);
396 LDKDecodeError err_var = (*val->contents.err);
397 uint64_t err_ref = 0;
398 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
399 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
400 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
401 err_ref = (uint64_t)err_var.inner & ~1;
404 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_ok(uint32_t arg) {
405 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
406 CHECK(val->result_ok);
407 LDKTxCreationKeys res_var = (*val->contents.result);
408 uint64_t res_ref = 0;
409 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
410 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
411 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
412 res_ref = (uint64_t)res_var.inner & ~1;
415 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_err(uint32_t arg) {
416 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
417 CHECK(!val->result_ok);
418 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
421 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u32Z_ref_from_ptr(uint32_t ptr) {
422 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
424 case LDKCOption_u32Z_Some: {
425 return 0 /* LDKCOption_u32Z - Some */; (void) obj->some;
427 case LDKCOption_u32Z_None: {
428 return 0 /* LDKCOption_u32Z - None */;
433 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint32_t arg) {
434 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
435 CHECK(val->result_ok);
436 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
437 uint64_t res_ref = 0;
438 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
439 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
440 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
441 res_ref = (uint64_t)res_var.inner & ~1;
444 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint32_t arg) {
445 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
446 CHECK(!val->result_ok);
447 LDKDecodeError err_var = (*val->contents.err);
448 uint64_t err_ref = 0;
449 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
450 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
451 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
452 err_ref = (uint64_t)err_var.inner & ~1;
455 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
456 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
457 CHECK(val->result_ok);
458 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
459 uint64_t res_ref = 0;
460 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
461 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
462 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
463 res_ref = (uint64_t)res_var.inner & ~1;
466 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
467 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
468 CHECK(!val->result_ok);
469 LDKDecodeError err_var = (*val->contents.err);
470 uint64_t err_ref = 0;
471 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
472 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
473 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
474 err_ref = (uint64_t)err_var.inner & ~1;
477 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
478 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
479 CHECK(val->result_ok);
480 LDKChannelTransactionParameters res_var = (*val->contents.result);
481 uint64_t res_ref = 0;
482 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
483 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
484 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
485 res_ref = (uint64_t)res_var.inner & ~1;
488 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
489 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
490 CHECK(!val->result_ok);
491 LDKDecodeError err_var = (*val->contents.err);
492 uint64_t err_ref = 0;
493 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
494 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
495 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
496 err_ref = (uint64_t)err_var.inner & ~1;
499 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
500 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
501 CHECK(val->result_ok);
502 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
503 uint64_t res_ref = 0;
504 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
505 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
506 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
507 res_ref = (uint64_t)res_var.inner & ~1;
510 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
511 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
512 CHECK(!val->result_ok);
513 LDKDecodeError err_var = (*val->contents.err);
514 uint64_t err_ref = 0;
515 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
516 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
517 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
518 err_ref = (uint64_t)err_var.inner & ~1;
521 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
522 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
523 CHECK(val->result_ok);
524 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
525 uint64_t res_ref = 0;
526 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
527 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
528 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
529 res_ref = (uint64_t)res_var.inner & ~1;
532 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
533 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
534 CHECK(!val->result_ok);
535 LDKDecodeError err_var = (*val->contents.err);
536 uint64_t err_ref = 0;
537 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
538 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
539 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
540 err_ref = (uint64_t)err_var.inner & ~1;
543 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_get_ok(uint32_t arg) {
544 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
545 CHECK(val->result_ok);
546 LDKTrustedClosingTransaction res_var = (*val->contents.result);
547 uint64_t res_ref = 0;
548 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
549 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
550 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
551 res_ref = (uint64_t)res_var.inner & ~1;
554 void __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_get_err(uint32_t arg) {
555 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
556 CHECK(!val->result_ok);
557 return *val->contents.err;
559 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
560 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
561 CHECK(val->result_ok);
562 LDKCommitmentTransaction res_var = (*val->contents.result);
563 uint64_t res_ref = 0;
564 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
565 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
566 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
567 res_ref = (uint64_t)res_var.inner & ~1;
570 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
571 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
572 CHECK(!val->result_ok);
573 LDKDecodeError err_var = (*val->contents.err);
574 uint64_t err_ref = 0;
575 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
576 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
577 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
578 err_ref = (uint64_t)err_var.inner & ~1;
581 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_ok(uint32_t arg) {
582 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
583 CHECK(val->result_ok);
584 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
585 uint64_t res_ref = 0;
586 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
587 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
588 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
589 res_ref = (uint64_t)res_var.inner & ~1;
592 void __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_err(uint32_t arg) {
593 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
594 CHECK(!val->result_ok);
595 return *val->contents.err;
597 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_ok(uint32_t arg) {
598 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
599 CHECK(val->result_ok);
600 LDKCVec_SignatureZ res_var = (*val->contents.result);
601 ptrArray res_arr = NULL;
602 res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
603 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
604 for (size_t m = 0; m < res_var.datalen; m++) {
605 int8_tArray res_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
606 memcpy((uint8_t*)(res_conv_12_arr + 4), res_var.data[m].compact_form, 64);
607 res_arr_ptr[m] = res_conv_12_arr;
612 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_err(uint32_t arg) {
613 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
614 CHECK(!val->result_ok);
615 return *val->contents.err;
617 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_get_ok(uint32_t arg) {
618 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
619 CHECK(val->result_ok);
620 LDKShutdownScript res_var = (*val->contents.result);
621 uint64_t res_ref = 0;
622 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
623 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
624 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
625 res_ref = (uint64_t)res_var.inner & ~1;
628 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_get_err(uint32_t arg) {
629 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
630 CHECK(!val->result_ok);
631 LDKDecodeError err_var = (*val->contents.err);
632 uint64_t err_ref = 0;
633 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
634 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
635 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
636 err_ref = (uint64_t)err_var.inner & ~1;
639 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint32_t arg) {
640 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
641 CHECK(val->result_ok);
642 LDKShutdownScript res_var = (*val->contents.result);
643 uint64_t res_ref = 0;
644 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
645 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
646 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
647 res_ref = (uint64_t)res_var.inner & ~1;
650 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint32_t arg) {
651 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
652 CHECK(!val->result_ok);
653 LDKInvalidShutdownScript err_var = (*val->contents.err);
654 uint64_t err_ref = 0;
655 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
656 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
657 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
658 err_ref = (uint64_t)err_var.inner & ~1;
661 void __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_ok(uint32_t arg) {
662 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
663 CHECK(val->result_ok);
664 return *val->contents.result;
666 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_err(uint32_t arg) {
667 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
668 CHECK(!val->result_ok);
669 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
672 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_get_ok(uint32_t arg) {
673 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
674 CHECK(val->result_ok);
675 LDKRouteHop res_var = (*val->contents.result);
676 uint64_t res_ref = 0;
677 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
678 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
679 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
680 res_ref = (uint64_t)res_var.inner & ~1;
683 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_get_err(uint32_t arg) {
684 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
685 CHECK(!val->result_ok);
686 LDKDecodeError err_var = (*val->contents.err);
687 uint64_t err_ref = 0;
688 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
689 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
690 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
691 err_ref = (uint64_t)err_var.inner & ~1;
694 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
695 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
696 for (size_t i = 0; i < ret.datalen; i++) {
697 ret.data[i] = RouteHop_clone(&orig->data[i]);
701 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
702 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
703 for (size_t i = 0; i < ret.datalen; i++) {
704 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
708 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_ok(uint32_t arg) {
709 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
710 CHECK(val->result_ok);
711 LDKRoute res_var = (*val->contents.result);
712 uint64_t res_ref = 0;
713 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
714 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
715 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
716 res_ref = (uint64_t)res_var.inner & ~1;
719 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_err(uint32_t arg) {
720 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
721 CHECK(!val->result_ok);
722 LDKDecodeError err_var = (*val->contents.err);
723 uint64_t err_ref = 0;
724 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
725 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
726 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
727 err_ref = (uint64_t)err_var.inner & ~1;
730 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteParametersDecodeErrorZ_get_ok(uint32_t arg) {
731 LDKCResult_RouteParametersDecodeErrorZ *val = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
732 CHECK(val->result_ok);
733 LDKRouteParameters res_var = (*val->contents.result);
734 uint64_t res_ref = 0;
735 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
736 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
737 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
738 res_ref = (uint64_t)res_var.inner & ~1;
741 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteParametersDecodeErrorZ_get_err(uint32_t arg) {
742 LDKCResult_RouteParametersDecodeErrorZ *val = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
743 CHECK(!val->result_ok);
744 LDKDecodeError err_var = (*val->contents.err);
745 uint64_t err_ref = 0;
746 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
747 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
748 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
749 err_ref = (uint64_t)err_var.inner & ~1;
752 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
753 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
754 for (size_t i = 0; i < ret.datalen; i++) {
755 ret.data[i] = RouteHint_clone(&orig->data[i]);
759 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u64Z_ref_from_ptr(uint32_t ptr) {
760 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
762 case LDKCOption_u64Z_Some: {
763 return 0 /* LDKCOption_u64Z - Some */; (void) obj->some;
765 case LDKCOption_u64Z_None: {
766 return 0 /* LDKCOption_u64Z - None */;
771 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeeDecodeErrorZ_get_ok(uint32_t arg) {
772 LDKCResult_PayeeDecodeErrorZ *val = (LDKCResult_PayeeDecodeErrorZ*)(arg & ~1);
773 CHECK(val->result_ok);
774 LDKPayee res_var = (*val->contents.result);
775 uint64_t res_ref = 0;
776 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
777 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
778 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
779 res_ref = (uint64_t)res_var.inner & ~1;
782 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeeDecodeErrorZ_get_err(uint32_t arg) {
783 LDKCResult_PayeeDecodeErrorZ *val = (LDKCResult_PayeeDecodeErrorZ*)(arg & ~1);
784 CHECK(!val->result_ok);
785 LDKDecodeError err_var = (*val->contents.err);
786 uint64_t err_ref = 0;
787 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
788 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
789 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
790 err_ref = (uint64_t)err_var.inner & ~1;
793 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
794 LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
795 for (size_t i = 0; i < ret.datalen; i++) {
796 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
800 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHintDecodeErrorZ_get_ok(uint32_t arg) {
801 LDKCResult_RouteHintDecodeErrorZ *val = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
802 CHECK(val->result_ok);
803 LDKRouteHint res_var = (*val->contents.result);
804 uint64_t res_ref = 0;
805 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
806 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
807 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
808 res_ref = (uint64_t)res_var.inner & ~1;
811 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHintDecodeErrorZ_get_err(uint32_t arg) {
812 LDKCResult_RouteHintDecodeErrorZ *val = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
813 CHECK(!val->result_ok);
814 LDKDecodeError err_var = (*val->contents.err);
815 uint64_t err_ref = 0;
816 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
817 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
818 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
819 err_ref = (uint64_t)err_var.inner & ~1;
822 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHintHopDecodeErrorZ_get_ok(uint32_t arg) {
823 LDKCResult_RouteHintHopDecodeErrorZ *val = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
824 CHECK(val->result_ok);
825 LDKRouteHintHop res_var = (*val->contents.result);
826 uint64_t res_ref = 0;
827 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
828 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
829 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
830 res_ref = (uint64_t)res_var.inner & ~1;
833 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHintHopDecodeErrorZ_get_err(uint32_t arg) {
834 LDKCResult_RouteHintHopDecodeErrorZ *val = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
835 CHECK(!val->result_ok);
836 LDKDecodeError err_var = (*val->contents.err);
837 uint64_t err_ref = 0;
838 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
839 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
840 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
841 err_ref = (uint64_t)err_var.inner & ~1;
844 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
845 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
846 for (size_t i = 0; i < ret.datalen; i++) {
847 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
851 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_ok(uint32_t arg) {
852 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
853 CHECK(val->result_ok);
854 LDKRoute res_var = (*val->contents.result);
855 uint64_t res_ref = 0;
856 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
857 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
858 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
859 res_ref = (uint64_t)res_var.inner & ~1;
862 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_err(uint32_t arg) {
863 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
864 CHECK(!val->result_ok);
865 LDKLightningError err_var = (*val->contents.err);
866 uint64_t err_ref = 0;
867 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
868 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
869 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
870 err_ref = (uint64_t)err_var.inner & ~1;
873 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_ok(uint32_t arg) {
874 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
875 CHECK(val->result_ok);
876 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
877 return (uint64_t)res_ref;
879 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_err(uint32_t arg) {
880 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
881 CHECK(!val->result_ok);
882 uint32_t err_conv = LDKAccessError_to_js((*val->contents.err));
885 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR tuple){
888 int64_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_get_a(uint32_t tuple) {
889 LDKC2Tuple_usizeTransactionZ* tuple_conv = (LDKC2Tuple_usizeTransactionZ*)(tuple & ~1);
890 int64_t ret_val = C2Tuple_usizeTransactionZ_get_a(tuple_conv);
894 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR tuple){
897 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_get_b(uint32_t tuple) {
898 LDKC2Tuple_usizeTransactionZ* tuple_conv = (LDKC2Tuple_usizeTransactionZ*)(tuple & ~1);
899 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(tuple_conv);
900 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
901 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
902 Transaction_free(ret_var);
906 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
907 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
908 for (size_t i = 0; i < ret.datalen; i++) {
909 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
913 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
914 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
915 for (size_t i = 0; i < ret.datalen; i++) {
916 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
920 void __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t arg) {
921 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
922 CHECK(val->result_ok);
923 return *val->contents.result;
925 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t arg) {
926 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
927 CHECK(!val->result_ok);
928 uint32_t err_conv = LDKChannelMonitorUpdateErr_to_js((*val->contents.err));
931 uint32_t __attribute__((visibility("default"))) TS_LDKMonitorEvent_ref_from_ptr(uint32_t ptr) {
932 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
934 case LDKMonitorEvent_HTLCEvent: {
935 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
936 uint64_t htlc_event_ref = 0;
937 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
938 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
939 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
940 htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
941 return 0 /* LDKMonitorEvent - HTLCEvent */; (void) htlc_event_ref;
943 case LDKMonitorEvent_CommitmentTxConfirmed: {
944 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
945 uint64_t commitment_tx_confirmed_ref = 0;
946 CHECK((((uint64_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
947 CHECK((((uint64_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
948 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
949 commitment_tx_confirmed_ref = (uint64_t)commitment_tx_confirmed_var.inner & ~1;
950 return 0 /* LDKMonitorEvent - CommitmentTxConfirmed */; (void) commitment_tx_confirmed_ref;
952 case LDKMonitorEvent_UpdateCompleted: {
953 LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
954 uint64_t funding_txo_ref = 0;
955 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
956 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
957 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
958 funding_txo_ref = (uint64_t)funding_txo_var.inner & ~1;
959 return 0 /* LDKMonitorEvent - UpdateCompleted */; (void) funding_txo_ref; (void) obj->update_completed.monitor_update_id;
961 case LDKMonitorEvent_UpdateFailed: {
962 LDKOutPoint update_failed_var = obj->update_failed;
963 uint64_t update_failed_ref = 0;
964 CHECK((((uint64_t)update_failed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
965 CHECK((((uint64_t)&update_failed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
966 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
967 update_failed_ref = (uint64_t)update_failed_var.inner & ~1;
968 return 0 /* LDKMonitorEvent - UpdateFailed */; (void) update_failed_ref;
973 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
974 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
975 for (size_t i = 0; i < ret.datalen; i++) {
976 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
980 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_ref_from_ptr(uint32_t ptr) {
981 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
983 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
984 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
985 *some_conv = obj->some;
986 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
987 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - Some */; (void) ((uint64_t)some_conv);
989 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
990 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - None */;
995 uint32_t __attribute__((visibility("default"))) TS_LDKClosureReason_ref_from_ptr(uint32_t ptr) {
996 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
998 case LDKClosureReason_CounterpartyForceClosed: {
999 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
1000 jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
1001 return 0 /* LDKClosureReason - CounterpartyForceClosed */; (void) peer_msg_conv;
1003 case LDKClosureReason_HolderForceClosed: {
1004 return 0 /* LDKClosureReason - HolderForceClosed */;
1006 case LDKClosureReason_CooperativeClosure: {
1007 return 0 /* LDKClosureReason - CooperativeClosure */;
1009 case LDKClosureReason_CommitmentTxConfirmed: {
1010 return 0 /* LDKClosureReason - CommitmentTxConfirmed */;
1012 case LDKClosureReason_ProcessingError: {
1013 LDKStr err_str = obj->processing_error.err;
1014 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
1015 return 0 /* LDKClosureReason - ProcessingError */; (void) err_conv;
1017 case LDKClosureReason_DisconnectedPeer: {
1018 return 0 /* LDKClosureReason - DisconnectedPeer */;
1020 case LDKClosureReason_OutdatedChannelManager: {
1021 return 0 /* LDKClosureReason - OutdatedChannelManager */;
1026 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_ClosureReasonZ_ref_from_ptr(uint32_t ptr) {
1027 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
1029 case LDKCOption_ClosureReasonZ_Some: {
1030 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1031 return 0 /* LDKCOption_ClosureReasonZ - Some */; (void) some_ref;
1033 case LDKCOption_ClosureReasonZ_None: {
1034 return 0 /* LDKCOption_ClosureReasonZ - None */;
1039 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint32_t arg) {
1040 LDKCResult_COption_ClosureReasonZDecodeErrorZ *val = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
1041 CHECK(val->result_ok);
1042 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1045 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint32_t arg) {
1046 LDKCResult_COption_ClosureReasonZDecodeErrorZ *val = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
1047 CHECK(!val->result_ok);
1048 LDKDecodeError err_var = (*val->contents.err);
1049 uint64_t err_ref = 0;
1050 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1051 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1052 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1053 err_ref = (uint64_t)err_var.inner & ~1;
1056 uint32_t __attribute__((visibility("default"))) TS_LDKNetworkUpdate_ref_from_ptr(uint32_t ptr) {
1057 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1059 case LDKNetworkUpdate_ChannelUpdateMessage: {
1060 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1061 uint64_t msg_ref = 0;
1062 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1063 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1064 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1065 msg_ref = (uint64_t)msg_var.inner & ~1;
1066 return 0 /* LDKNetworkUpdate - ChannelUpdateMessage */; (void) msg_ref;
1068 case LDKNetworkUpdate_ChannelClosed: {
1069 return 0 /* LDKNetworkUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
1071 case LDKNetworkUpdate_NodeFailure: {
1072 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1073 memcpy((uint8_t*)(node_id_arr + 4), obj->node_failure.node_id.compressed_form, 33);
1074 return 0 /* LDKNetworkUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
1079 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_NetworkUpdateZ_ref_from_ptr(uint32_t ptr) {
1080 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1082 case LDKCOption_NetworkUpdateZ_Some: {
1083 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1084 return 0 /* LDKCOption_NetworkUpdateZ - Some */; (void) some_ref;
1086 case LDKCOption_NetworkUpdateZ_None: {
1087 return 0 /* LDKCOption_NetworkUpdateZ - None */;
1092 uint32_t __attribute__((visibility("default"))) TS_LDKSpendableOutputDescriptor_ref_from_ptr(uint32_t ptr) {
1093 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1095 case LDKSpendableOutputDescriptor_StaticOutput: {
1096 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1097 uint64_t outpoint_ref = 0;
1098 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1099 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1100 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1101 outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1102 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1103 return 0 /* LDKSpendableOutputDescriptor - StaticOutput */; (void) outpoint_ref; (void) (uint64_t)output_ref;
1105 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1106 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1107 uint64_t delayed_payment_output_ref = 0;
1108 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1109 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1110 CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1111 delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1112 return 0 /* LDKSpendableOutputDescriptor - DelayedPaymentOutput */; (void) delayed_payment_output_ref;
1114 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1115 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1116 uint64_t static_payment_output_ref = 0;
1117 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1118 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1119 CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1120 static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1121 return 0 /* LDKSpendableOutputDescriptor - StaticPaymentOutput */; (void) static_payment_output_ref;
1126 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1127 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1128 for (size_t i = 0; i < ret.datalen; i++) {
1129 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1133 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentPurpose_ref_from_ptr(uint32_t ptr) {
1134 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1136 case LDKPaymentPurpose_InvoicePayment: {
1137 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1138 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->invoice_payment.payment_preimage.data, 32);
1139 int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1140 memcpy((uint8_t*)(payment_secret_arr + 4), obj->invoice_payment.payment_secret.data, 32);
1141 return 0 /* LDKPaymentPurpose - InvoicePayment */; (void) payment_preimage_arr; (void) payment_secret_arr; (void) obj->invoice_payment.user_payment_id;
1143 case LDKPaymentPurpose_SpontaneousPayment: {
1144 int8_tArray spontaneous_payment_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1145 memcpy((uint8_t*)(spontaneous_payment_arr + 4), obj->spontaneous_payment.data, 32);
1146 return 0 /* LDKPaymentPurpose - SpontaneousPayment */; (void) spontaneous_payment_arr;
1151 uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_t ptr) {
1152 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1154 case LDKEvent_FundingGenerationReady: {
1155 int8_tArray temporary_channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1156 memcpy((uint8_t*)(temporary_channel_id_arr + 4), obj->funding_generation_ready.temporary_channel_id.data, 32);
1157 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1158 int8_tArray output_script_arr = init_arr(output_script_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1159 memcpy((uint8_t*)(output_script_arr + 4), output_script_var.data, output_script_var.datalen);
1160 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;
1162 case LDKEvent_PaymentReceived: {
1163 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1164 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_received.payment_hash.data, 32);
1165 uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
1166 return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) obj->payment_received.amt; (void) purpose_ref;
1168 case LDKEvent_PaymentSent: {
1169 int8_tArray payment_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1170 memcpy((uint8_t*)(payment_id_arr + 4), obj->payment_sent.payment_id.data, 32);
1171 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1172 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_sent.payment_preimage.data, 32);
1173 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1174 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_sent.payment_hash.data, 32);
1175 uint64_t fee_paid_msat_ref = ((uint64_t)&obj->payment_sent.fee_paid_msat) | 1;
1176 return 0 /* LDKEvent - PaymentSent */; (void) payment_id_arr; (void) payment_preimage_arr; (void) payment_hash_arr; (void) fee_paid_msat_ref;
1178 case LDKEvent_PaymentPathFailed: {
1179 int8_tArray payment_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1180 memcpy((uint8_t*)(payment_id_arr + 4), obj->payment_path_failed.payment_id.data, 32);
1181 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1182 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_path_failed.payment_hash.data, 32);
1183 uint64_t network_update_ref = ((uint64_t)&obj->payment_path_failed.network_update) | 1;
1184 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
1185 uint32_tArray path_arr = NULL;
1186 path_arr = init_arr(path_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
1187 uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4);
1188 for (size_t k = 0; k < path_var.datalen; k++) {
1189 LDKRouteHop path_conv_10_var = path_var.data[k];
1190 uint64_t path_conv_10_ref = 0;
1191 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1192 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1193 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1194 path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
1195 path_arr_ptr[k] = path_conv_10_ref;
1198 uint64_t short_channel_id_ref = ((uint64_t)&obj->payment_path_failed.short_channel_id) | 1;
1199 LDKRouteParameters retry_var = obj->payment_path_failed.retry;
1200 uint64_t retry_ref = 0;
1201 if ((uint64_t)retry_var.inner > 4096) {
1202 CHECK((((uint64_t)retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1203 CHECK((((uint64_t)&retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1204 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
1205 retry_ref = (uint64_t)retry_var.inner & ~1;
1207 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;
1209 case LDKEvent_PendingHTLCsForwardable: {
1210 return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable;
1212 case LDKEvent_SpendableOutputs: {
1213 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1214 uint32_tArray outputs_arr = NULL;
1215 outputs_arr = init_arr(outputs_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
1216 uint32_t *outputs_arr_ptr = (uint32_t*)(outputs_arr + 4);
1217 for (size_t b = 0; b < outputs_var.datalen; b++) {
1218 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
1219 outputs_arr_ptr[b] = outputs_conv_27_ref;
1222 return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr;
1224 case LDKEvent_PaymentForwarded: {
1225 uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
1226 return 0 /* LDKEvent - PaymentForwarded */; (void) fee_earned_msat_ref; (void) obj->payment_forwarded.claim_from_onchain_tx;
1228 case LDKEvent_ChannelClosed: {
1229 int8_tArray channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1230 memcpy((uint8_t*)(channel_id_arr + 4), obj->channel_closed.channel_id.data, 32);
1231 uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1;
1232 return 0 /* LDKEvent - ChannelClosed */; (void) channel_id_arr; (void) obj->channel_closed.user_channel_id; (void) reason_ref;
1234 case LDKEvent_DiscardFunding: {
1235 int8_tArray channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1236 memcpy((uint8_t*)(channel_id_arr + 4), obj->discard_funding.channel_id.data, 32);
1237 LDKTransaction transaction_var = obj->discard_funding.transaction;
1238 int8_tArray transaction_arr = init_arr(transaction_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1239 memcpy((uint8_t*)(transaction_arr + 4), transaction_var.data, transaction_var.datalen);
1240 return 0 /* LDKEvent - DiscardFunding */; (void) channel_id_arr; (void) transaction_arr;
1245 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_EventZ_ref_from_ptr(uint32_t ptr) {
1246 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
1248 case LDKCOption_EventZ_Some: {
1249 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1250 return 0 /* LDKCOption_EventZ - Some */; (void) some_ref;
1252 case LDKCOption_EventZ_None: {
1253 return 0 /* LDKCOption_EventZ - None */;
1258 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_EventZDecodeErrorZ_get_ok(uint32_t arg) {
1259 LDKCResult_COption_EventZDecodeErrorZ *val = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
1260 CHECK(val->result_ok);
1261 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1264 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_EventZDecodeErrorZ_get_err(uint32_t arg) {
1265 LDKCResult_COption_EventZDecodeErrorZ *val = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
1266 CHECK(!val->result_ok);
1267 LDKDecodeError err_var = (*val->contents.err);
1268 uint64_t err_ref = 0;
1269 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1270 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1271 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1272 err_ref = (uint64_t)err_var.inner & ~1;
1275 uint32_t __attribute__((visibility("default"))) TS_LDKErrorAction_ref_from_ptr(uint32_t ptr) {
1276 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1278 case LDKErrorAction_DisconnectPeer: {
1279 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1280 uint64_t msg_ref = 0;
1281 if ((uint64_t)msg_var.inner > 4096) {
1282 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1283 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1284 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1285 msg_ref = (uint64_t)msg_var.inner & ~1;
1287 return 0 /* LDKErrorAction - DisconnectPeer */; (void) msg_ref;
1289 case LDKErrorAction_IgnoreError: {
1290 return 0 /* LDKErrorAction - IgnoreError */;
1292 case LDKErrorAction_IgnoreAndLog: {
1293 uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
1294 return 0 /* LDKErrorAction - IgnoreAndLog */; (void) ignore_and_log_conv;
1296 case LDKErrorAction_SendErrorMessage: {
1297 LDKErrorMessage msg_var = obj->send_error_message.msg;
1298 uint64_t msg_ref = 0;
1299 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1300 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1301 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1302 msg_ref = (uint64_t)msg_var.inner & ~1;
1303 return 0 /* LDKErrorAction - SendErrorMessage */; (void) msg_ref;
1308 uint32_t __attribute__((visibility("default"))) TS_LDKMessageSendEvent_ref_from_ptr(uint32_t ptr) {
1309 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1311 case LDKMessageSendEvent_SendAcceptChannel: {
1312 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1313 memcpy((uint8_t*)(node_id_arr + 4), obj->send_accept_channel.node_id.compressed_form, 33);
1314 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1315 uint64_t msg_ref = 0;
1316 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1317 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1318 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1319 msg_ref = (uint64_t)msg_var.inner & ~1;
1320 return 0 /* LDKMessageSendEvent - SendAcceptChannel */; (void) node_id_arr; (void) msg_ref;
1322 case LDKMessageSendEvent_SendOpenChannel: {
1323 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1324 memcpy((uint8_t*)(node_id_arr + 4), obj->send_open_channel.node_id.compressed_form, 33);
1325 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1326 uint64_t msg_ref = 0;
1327 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1328 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1329 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1330 msg_ref = (uint64_t)msg_var.inner & ~1;
1331 return 0 /* LDKMessageSendEvent - SendOpenChannel */; (void) node_id_arr; (void) msg_ref;
1333 case LDKMessageSendEvent_SendFundingCreated: {
1334 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1335 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_created.node_id.compressed_form, 33);
1336 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1337 uint64_t msg_ref = 0;
1338 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1339 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1340 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1341 msg_ref = (uint64_t)msg_var.inner & ~1;
1342 return 0 /* LDKMessageSendEvent - SendFundingCreated */; (void) node_id_arr; (void) msg_ref;
1344 case LDKMessageSendEvent_SendFundingSigned: {
1345 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1346 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_signed.node_id.compressed_form, 33);
1347 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1348 uint64_t msg_ref = 0;
1349 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1350 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1351 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1352 msg_ref = (uint64_t)msg_var.inner & ~1;
1353 return 0 /* LDKMessageSendEvent - SendFundingSigned */; (void) node_id_arr; (void) msg_ref;
1355 case LDKMessageSendEvent_SendFundingLocked: {
1356 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1357 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_locked.node_id.compressed_form, 33);
1358 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1359 uint64_t msg_ref = 0;
1360 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1361 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1362 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1363 msg_ref = (uint64_t)msg_var.inner & ~1;
1364 return 0 /* LDKMessageSendEvent - SendFundingLocked */; (void) node_id_arr; (void) msg_ref;
1366 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1367 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1368 memcpy((uint8_t*)(node_id_arr + 4), obj->send_announcement_signatures.node_id.compressed_form, 33);
1369 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1370 uint64_t msg_ref = 0;
1371 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1372 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1373 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1374 msg_ref = (uint64_t)msg_var.inner & ~1;
1375 return 0 /* LDKMessageSendEvent - SendAnnouncementSignatures */; (void) node_id_arr; (void) msg_ref;
1377 case LDKMessageSendEvent_UpdateHTLCs: {
1378 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1379 memcpy((uint8_t*)(node_id_arr + 4), obj->update_htl_cs.node_id.compressed_form, 33);
1380 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1381 uint64_t updates_ref = 0;
1382 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1383 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1384 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
1385 updates_ref = (uint64_t)updates_var.inner & ~1;
1386 return 0 /* LDKMessageSendEvent - UpdateHTLCs */; (void) node_id_arr; (void) updates_ref;
1388 case LDKMessageSendEvent_SendRevokeAndACK: {
1389 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1390 memcpy((uint8_t*)(node_id_arr + 4), obj->send_revoke_and_ack.node_id.compressed_form, 33);
1391 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1392 uint64_t msg_ref = 0;
1393 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1394 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1395 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1396 msg_ref = (uint64_t)msg_var.inner & ~1;
1397 return 0 /* LDKMessageSendEvent - SendRevokeAndACK */; (void) node_id_arr; (void) msg_ref;
1399 case LDKMessageSendEvent_SendClosingSigned: {
1400 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1401 memcpy((uint8_t*)(node_id_arr + 4), obj->send_closing_signed.node_id.compressed_form, 33);
1402 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1403 uint64_t msg_ref = 0;
1404 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1405 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1406 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1407 msg_ref = (uint64_t)msg_var.inner & ~1;
1408 return 0 /* LDKMessageSendEvent - SendClosingSigned */; (void) node_id_arr; (void) msg_ref;
1410 case LDKMessageSendEvent_SendShutdown: {
1411 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1412 memcpy((uint8_t*)(node_id_arr + 4), obj->send_shutdown.node_id.compressed_form, 33);
1413 LDKShutdown msg_var = obj->send_shutdown.msg;
1414 uint64_t msg_ref = 0;
1415 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1416 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1417 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1418 msg_ref = (uint64_t)msg_var.inner & ~1;
1419 return 0 /* LDKMessageSendEvent - SendShutdown */; (void) node_id_arr; (void) msg_ref;
1421 case LDKMessageSendEvent_SendChannelReestablish: {
1422 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1423 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_reestablish.node_id.compressed_form, 33);
1424 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1425 uint64_t msg_ref = 0;
1426 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1427 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1428 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1429 msg_ref = (uint64_t)msg_var.inner & ~1;
1430 return 0 /* LDKMessageSendEvent - SendChannelReestablish */; (void) node_id_arr; (void) msg_ref;
1432 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1433 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1434 uint64_t msg_ref = 0;
1435 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1436 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1437 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1438 msg_ref = (uint64_t)msg_var.inner & ~1;
1439 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1440 uint64_t update_msg_ref = 0;
1441 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1442 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1443 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
1444 update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
1445 return 0 /* LDKMessageSendEvent - BroadcastChannelAnnouncement */; (void) msg_ref; (void) update_msg_ref;
1447 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1448 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1449 uint64_t msg_ref = 0;
1450 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1451 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1452 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1453 msg_ref = (uint64_t)msg_var.inner & ~1;
1454 return 0 /* LDKMessageSendEvent - BroadcastNodeAnnouncement */; (void) msg_ref;
1456 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1457 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1458 uint64_t msg_ref = 0;
1459 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1460 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1461 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1462 msg_ref = (uint64_t)msg_var.inner & ~1;
1463 return 0 /* LDKMessageSendEvent - BroadcastChannelUpdate */; (void) msg_ref;
1465 case LDKMessageSendEvent_SendChannelUpdate: {
1466 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1467 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_update.node_id.compressed_form, 33);
1468 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
1469 uint64_t msg_ref = 0;
1470 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1471 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1472 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1473 msg_ref = (uint64_t)msg_var.inner & ~1;
1474 return 0 /* LDKMessageSendEvent - SendChannelUpdate */; (void) node_id_arr; (void) msg_ref;
1476 case LDKMessageSendEvent_HandleError: {
1477 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1478 memcpy((uint8_t*)(node_id_arr + 4), obj->handle_error.node_id.compressed_form, 33);
1479 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
1480 return 0 /* LDKMessageSendEvent - HandleError */; (void) node_id_arr; (void) action_ref;
1482 case LDKMessageSendEvent_SendChannelRangeQuery: {
1483 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1484 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_range_query.node_id.compressed_form, 33);
1485 LDKQueryChannelRange msg_var = obj->send_channel_range_query.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 return 0 /* LDKMessageSendEvent - SendChannelRangeQuery */; (void) node_id_arr; (void) msg_ref;
1493 case LDKMessageSendEvent_SendShortIdsQuery: {
1494 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1495 memcpy((uint8_t*)(node_id_arr + 4), obj->send_short_ids_query.node_id.compressed_form, 33);
1496 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1497 uint64_t msg_ref = 0;
1498 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1499 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1500 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1501 msg_ref = (uint64_t)msg_var.inner & ~1;
1502 return 0 /* LDKMessageSendEvent - SendShortIdsQuery */; (void) node_id_arr; (void) msg_ref;
1504 case LDKMessageSendEvent_SendReplyChannelRange: {
1505 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1506 memcpy((uint8_t*)(node_id_arr + 4), obj->send_reply_channel_range.node_id.compressed_form, 33);
1507 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1508 uint64_t msg_ref = 0;
1509 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1510 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1511 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1512 msg_ref = (uint64_t)msg_var.inner & ~1;
1513 return 0 /* LDKMessageSendEvent - SendReplyChannelRange */; (void) node_id_arr; (void) msg_ref;
1518 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1519 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1520 for (size_t i = 0; i < ret.datalen; i++) {
1521 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1525 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1526 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1527 CHECK(val->result_ok);
1528 LDKInitFeatures res_var = (*val->contents.result);
1529 uint64_t res_ref = 0;
1530 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1531 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1532 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1533 res_ref = (uint64_t)res_var.inner & ~1;
1536 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1537 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1538 CHECK(!val->result_ok);
1539 LDKDecodeError err_var = (*val->contents.err);
1540 uint64_t err_ref = 0;
1541 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1542 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1543 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1544 err_ref = (uint64_t)err_var.inner & ~1;
1547 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1548 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1549 CHECK(val->result_ok);
1550 LDKNodeFeatures res_var = (*val->contents.result);
1551 uint64_t res_ref = 0;
1552 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1553 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1554 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1555 res_ref = (uint64_t)res_var.inner & ~1;
1558 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1559 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1560 CHECK(!val->result_ok);
1561 LDKDecodeError err_var = (*val->contents.err);
1562 uint64_t err_ref = 0;
1563 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1564 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1565 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1566 err_ref = (uint64_t)err_var.inner & ~1;
1569 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1570 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1571 CHECK(val->result_ok);
1572 LDKChannelFeatures res_var = (*val->contents.result);
1573 uint64_t res_ref = 0;
1574 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1575 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1576 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1577 res_ref = (uint64_t)res_var.inner & ~1;
1580 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1581 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1582 CHECK(!val->result_ok);
1583 LDKDecodeError err_var = (*val->contents.err);
1584 uint64_t err_ref = 0;
1585 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1586 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1587 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1588 err_ref = (uint64_t)err_var.inner & ~1;
1591 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1592 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1593 CHECK(val->result_ok);
1594 LDKInvoiceFeatures res_var = (*val->contents.result);
1595 uint64_t res_ref = 0;
1596 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1597 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1598 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1599 res_ref = (uint64_t)res_var.inner & ~1;
1602 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1603 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1604 CHECK(!val->result_ok);
1605 LDKDecodeError err_var = (*val->contents.err);
1606 uint64_t err_ref = 0;
1607 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1608 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1609 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1610 err_ref = (uint64_t)err_var.inner & ~1;
1613 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScoringParametersDecodeErrorZ_get_ok(uint32_t arg) {
1614 LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1);
1615 CHECK(val->result_ok);
1616 LDKScoringParameters res_var = (*val->contents.result);
1617 uint64_t res_ref = 0;
1618 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1619 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1620 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1621 res_ref = (uint64_t)res_var.inner & ~1;
1624 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScoringParametersDecodeErrorZ_get_err(uint32_t arg) {
1625 LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1);
1626 CHECK(!val->result_ok);
1627 LDKDecodeError err_var = (*val->contents.err);
1628 uint64_t err_ref = 0;
1629 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1630 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1631 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1632 err_ref = (uint64_t)err_var.inner & ~1;
1635 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScorerDecodeErrorZ_get_ok(uint32_t arg) {
1636 LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1);
1637 CHECK(val->result_ok);
1638 LDKScorer res_var = (*val->contents.result);
1639 uint64_t res_ref = 0;
1640 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1641 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1642 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1643 res_ref = (uint64_t)res_var.inner & ~1;
1646 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScorerDecodeErrorZ_get_err(uint32_t arg) {
1647 LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1);
1648 CHECK(!val->result_ok);
1649 LDKDecodeError err_var = (*val->contents.err);
1650 uint64_t err_ref = 0;
1651 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1652 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1653 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1654 err_ref = (uint64_t)err_var.inner & ~1;
1657 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1658 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1659 CHECK(val->result_ok);
1660 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
1661 uint64_t res_ref = 0;
1662 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1663 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1664 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1665 res_ref = (uint64_t)res_var.inner & ~1;
1668 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1669 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1670 CHECK(!val->result_ok);
1671 LDKDecodeError err_var = (*val->contents.err);
1672 uint64_t err_ref = 0;
1673 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1674 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1675 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1676 err_ref = (uint64_t)err_var.inner & ~1;
1679 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1680 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1681 CHECK(val->result_ok);
1682 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
1683 uint64_t res_ref = 0;
1684 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1685 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1686 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1687 res_ref = (uint64_t)res_var.inner & ~1;
1690 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1691 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1692 CHECK(!val->result_ok);
1693 LDKDecodeError err_var = (*val->contents.err);
1694 uint64_t err_ref = 0;
1695 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1696 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1697 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1698 err_ref = (uint64_t)err_var.inner & ~1;
1701 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1702 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1703 CHECK(val->result_ok);
1704 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1707 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1708 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1709 CHECK(!val->result_ok);
1710 LDKDecodeError err_var = (*val->contents.err);
1711 uint64_t err_ref = 0;
1712 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1713 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1714 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1715 err_ref = (uint64_t)err_var.inner & ~1;
1718 void __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_get_ok(uint32_t arg) {
1719 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
1720 CHECK(val->result_ok);
1721 return *val->contents.result;
1723 void __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_get_err(uint32_t arg) {
1724 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
1725 CHECK(!val->result_ok);
1726 return *val->contents.err;
1728 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR tuple){
1731 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t tuple) {
1732 LDKC2Tuple_SignatureCVec_SignatureZZ* tuple_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(tuple & ~1);
1733 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1734 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_SignatureCVec_SignatureZZ_get_a(tuple_conv).compact_form, 64);
1738 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR tuple){
1741 ptrArray __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t tuple) {
1742 LDKC2Tuple_SignatureCVec_SignatureZZ* tuple_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(tuple & ~1);
1743 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(tuple_conv);
1744 ptrArray ret_arr = NULL;
1745 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
1746 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
1747 for (size_t m = 0; m < ret_var.datalen; m++) {
1748 int8_tArray ret_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1749 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].compact_form, 64);
1750 ret_arr_ptr[m] = ret_conv_12_arr;
1757 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t arg) {
1758 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1759 CHECK(val->result_ok);
1760 LDKC2Tuple_SignatureCVec_SignatureZZ* res_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1761 *res_conv = (*val->contents.result);
1762 *res_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(res_conv);
1763 return ((uint64_t)res_conv);
1765 void __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t arg) {
1766 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1767 CHECK(!val->result_ok);
1768 return *val->contents.err;
1770 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_ok(uint32_t arg) {
1771 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1772 CHECK(val->result_ok);
1773 int8_tArray res_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1774 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compact_form, 64);
1777 void __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_err(uint32_t arg) {
1778 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1779 CHECK(!val->result_ok);
1780 return *val->contents.err;
1782 typedef struct LDKBaseSign_JCalls {
1783 atomic_size_t refcnt;
1784 uint32_t get_per_commitment_point_meth;
1785 uint32_t release_commitment_secret_meth;
1786 uint32_t validate_holder_commitment_meth;
1787 uint32_t channel_keys_id_meth;
1788 uint32_t sign_counterparty_commitment_meth;
1789 uint32_t validate_counterparty_revocation_meth;
1790 uint32_t sign_holder_commitment_and_htlcs_meth;
1791 uint32_t sign_justice_revoked_output_meth;
1792 uint32_t sign_justice_revoked_htlc_meth;
1793 uint32_t sign_counterparty_htlc_transaction_meth;
1794 uint32_t sign_closing_transaction_meth;
1795 uint32_t sign_channel_announcement_meth;
1796 uint32_t ready_channel_meth;
1797 } LDKBaseSign_JCalls;
1798 static void LDKBaseSign_JCalls_free(void* this_arg) {
1799 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1800 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1801 js_free(j_calls->get_per_commitment_point_meth);
1802 js_free(j_calls->release_commitment_secret_meth);
1803 js_free(j_calls->validate_holder_commitment_meth);
1804 js_free(j_calls->channel_keys_id_meth);
1805 js_free(j_calls->sign_counterparty_commitment_meth);
1806 js_free(j_calls->validate_counterparty_revocation_meth);
1807 js_free(j_calls->sign_holder_commitment_and_htlcs_meth);
1808 js_free(j_calls->sign_justice_revoked_output_meth);
1809 js_free(j_calls->sign_justice_revoked_htlc_meth);
1810 js_free(j_calls->sign_counterparty_htlc_transaction_meth);
1811 js_free(j_calls->sign_closing_transaction_meth);
1812 js_free(j_calls->sign_channel_announcement_meth);
1813 js_free(j_calls->ready_channel_meth);
1817 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1818 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1819 int8_tArray ret = js_invoke_function_1(j_calls->get_per_commitment_point_meth, idx);
1820 LDKPublicKey ret_ref;
1821 CHECK(*((uint32_t*)ret) == 33);
1822 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
1825 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1826 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1827 int8_tArray ret = js_invoke_function_1(j_calls->release_commitment_secret_meth, idx);
1828 LDKThirtyTwoBytes ret_ref;
1829 CHECK(*((uint32_t*)ret) == 32);
1830 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1833 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx) {
1834 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1835 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1836 uint64_t holder_tx_ref = 0;
1837 holder_tx_var = HolderCommitmentTransaction_clone(holder_tx);
1838 CHECK((((uint64_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1839 CHECK((((uint64_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1840 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
1841 holder_tx_ref = (uint64_t)holder_tx_var.inner;
1842 if (holder_tx_var.is_owned) {
1845 uint32_t ret = js_invoke_function_1(j_calls->validate_holder_commitment_meth, holder_tx_ref);
1846 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1847 CHECK_ACCESS(ret_ptr);
1848 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1852 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
1853 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1854 int8_tArray ret = js_invoke_function_0(j_calls->channel_keys_id_meth);
1855 LDKThirtyTwoBytes ret_ref;
1856 CHECK(*((uint32_t*)ret) == 32);
1857 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1860 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1861 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1862 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1863 uint64_t commitment_tx_ref = 0;
1864 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1865 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1866 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1867 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1868 commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1869 if (commitment_tx_var.is_owned) {
1870 commitment_tx_ref |= 1;
1872 uint32_t ret = js_invoke_function_1(j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
1873 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1874 CHECK_ACCESS(ret_ptr);
1875 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
1879 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
1880 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1881 int8_tArray secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1882 memcpy((uint8_t*)(secret_arr + 4), *secret, 32);
1883 uint32_t ret = js_invoke_function_2(j_calls->validate_counterparty_revocation_meth, idx, secret_arr);
1884 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1885 CHECK_ACCESS(ret_ptr);
1886 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1890 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1891 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1892 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1893 uint64_t commitment_tx_ref = 0;
1894 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1895 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1896 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1897 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1898 commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1899 if (commitment_tx_var.is_owned) {
1900 commitment_tx_ref |= 1;
1902 uint32_t ret = js_invoke_function_1(j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
1903 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1904 CHECK_ACCESS(ret_ptr);
1905 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
1909 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]) {
1910 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1911 LDKTransaction justice_tx_var = justice_tx;
1912 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1913 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1914 Transaction_free(justice_tx_var);
1915 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1916 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1917 uint32_t ret = js_invoke_function_4(j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
1918 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1919 CHECK_ACCESS(ret_ptr);
1920 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1924 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) {
1925 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1926 LDKTransaction justice_tx_var = justice_tx;
1927 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1928 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1929 Transaction_free(justice_tx_var);
1930 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1931 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1932 LDKHTLCOutputInCommitment htlc_var = *htlc;
1933 uint64_t htlc_ref = 0;
1934 htlc_var = HTLCOutputInCommitment_clone(htlc);
1935 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1936 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1937 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
1938 htlc_ref = (uint64_t)htlc_var.inner;
1939 if (htlc_var.is_owned) {
1942 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);
1943 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1944 CHECK_ACCESS(ret_ptr);
1945 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1949 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) {
1950 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1951 LDKTransaction htlc_tx_var = htlc_tx;
1952 int8_tArray htlc_tx_arr = init_arr(htlc_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1953 memcpy((uint8_t*)(htlc_tx_arr + 4), htlc_tx_var.data, htlc_tx_var.datalen);
1954 Transaction_free(htlc_tx_var);
1955 int8_tArray per_commitment_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1956 memcpy((uint8_t*)(per_commitment_point_arr + 4), per_commitment_point.compressed_form, 33);
1957 LDKHTLCOutputInCommitment htlc_var = *htlc;
1958 uint64_t htlc_ref = 0;
1959 htlc_var = HTLCOutputInCommitment_clone(htlc);
1960 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1961 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1962 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
1963 htlc_ref = (uint64_t)htlc_var.inner;
1964 if (htlc_var.is_owned) {
1967 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);
1968 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1969 CHECK_ACCESS(ret_ptr);
1970 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1974 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
1975 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1976 LDKClosingTransaction closing_tx_var = *closing_tx;
1977 uint64_t closing_tx_ref = 0;
1978 closing_tx_var = ClosingTransaction_clone(closing_tx);
1979 CHECK((((uint64_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1980 CHECK((((uint64_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1981 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
1982 closing_tx_ref = (uint64_t)closing_tx_var.inner;
1983 if (closing_tx_var.is_owned) {
1984 closing_tx_ref |= 1;
1986 uint32_t ret = js_invoke_function_1(j_calls->sign_closing_transaction_meth, closing_tx_ref);
1987 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1988 CHECK_ACCESS(ret_ptr);
1989 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1993 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1994 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1995 LDKUnsignedChannelAnnouncement msg_var = *msg;
1996 uint64_t msg_ref = 0;
1997 msg_var = UnsignedChannelAnnouncement_clone(msg);
1998 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1999 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2000 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2001 msg_ref = (uint64_t)msg_var.inner;
2002 if (msg_var.is_owned) {
2005 uint32_t ret = js_invoke_function_1(j_calls->sign_channel_announcement_meth, msg_ref);
2006 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2007 CHECK_ACCESS(ret_ptr);
2008 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2012 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2013 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2014 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2015 uint64_t channel_parameters_ref = 0;
2016 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
2017 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2018 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2019 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
2020 channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
2021 if (channel_parameters_var.is_owned) {
2022 channel_parameters_ref |= 1;
2024 js_invoke_function_1(j_calls->ready_channel_meth, channel_parameters_ref);
2026 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
2027 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
2028 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2030 static inline LDKBaseSign LDKBaseSign_init (/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
2031 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
2032 atomic_init(&calls->refcnt, 1);
2033 //TODO: Assign calls->o from o
2035 LDKChannelPublicKeys pubkeys_conv;
2036 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2037 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2038 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2041 .this_arg = (void*) calls,
2042 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
2043 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
2044 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
2045 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
2046 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
2047 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
2048 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
2049 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
2050 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
2051 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
2052 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
2053 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
2054 .ready_channel = ready_channel_LDKBaseSign_jcall,
2055 .free = LDKBaseSign_JCalls_free,
2056 .pubkeys = pubkeys_conv,
2057 .set_pubkeys = NULL,
2061 long __attribute__((visibility("default"))) TS_LDKBaseSign_new(/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
2062 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
2063 *res_ptr = LDKBaseSign_init(o, pubkeys);
2064 return (long)res_ptr;
2066 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
2067 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2068 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2069 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2070 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
2071 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
2075 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
2076 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2077 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2078 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2079 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2080 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
2084 uint32_t __attribute__((visibility("default"))) TS_BaseSign_validate_holder_commitment(uint32_t this_arg, uint32_t holder_tx) {
2085 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2086 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2087 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2088 LDKHolderCommitmentTransaction holder_tx_conv;
2089 holder_tx_conv.inner = (void*)(holder_tx & (~1));
2090 holder_tx_conv.is_owned = false;
2091 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
2092 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2093 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv);
2094 return (uint64_t)ret_conv;
2097 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_channel_keys_id(uint32_t this_arg) {
2098 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2099 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2100 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2101 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2102 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
2106 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_counterparty_commitment(uint32_t this_arg, uint32_t commitment_tx) {
2107 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2108 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2109 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2110 LDKCommitmentTransaction commitment_tx_conv;
2111 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2112 commitment_tx_conv.is_owned = false;
2113 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2114 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2115 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2116 return (uint64_t)ret_conv;
2119 uint32_t __attribute__((visibility("default"))) TS_BaseSign_validate_counterparty_revocation(uint32_t this_arg, int64_t idx, int8_tArray secret) {
2120 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2121 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2122 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2123 unsigned char secret_arr[32];
2124 CHECK(*((uint32_t*)secret) == 32);
2125 memcpy(secret_arr, (uint8_t*)(secret + 4), 32);
2126 unsigned char (*secret_ref)[32] = &secret_arr;
2127 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2128 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
2129 return (uint64_t)ret_conv;
2132 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_holder_commitment_and_htlcs(uint32_t this_arg, uint32_t commitment_tx) {
2133 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2134 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2135 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2136 LDKHolderCommitmentTransaction commitment_tx_conv;
2137 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2138 commitment_tx_conv.is_owned = false;
2139 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2140 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2141 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2142 return (uint64_t)ret_conv;
2145 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) {
2146 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2147 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2148 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2149 LDKTransaction justice_tx_ref;
2150 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
2151 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2152 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
2153 justice_tx_ref.data_is_owned = true;
2154 unsigned char per_commitment_key_arr[32];
2155 CHECK(*((uint32_t*)per_commitment_key) == 32);
2156 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
2157 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2158 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2159 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2160 return (uint64_t)ret_conv;
2163 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) {
2164 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2165 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2166 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2167 LDKTransaction justice_tx_ref;
2168 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
2169 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2170 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
2171 justice_tx_ref.data_is_owned = true;
2172 unsigned char per_commitment_key_arr[32];
2173 CHECK(*((uint32_t*)per_commitment_key) == 32);
2174 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
2175 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2176 LDKHTLCOutputInCommitment htlc_conv;
2177 htlc_conv.inner = (void*)(htlc & (~1));
2178 htlc_conv.is_owned = false;
2179 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2180 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2181 *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);
2182 return (uint64_t)ret_conv;
2185 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) {
2186 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2187 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2188 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2189 LDKTransaction htlc_tx_ref;
2190 htlc_tx_ref.datalen = *((uint32_t*)htlc_tx);
2191 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2192 memcpy(htlc_tx_ref.data, (uint8_t*)(htlc_tx + 4), htlc_tx_ref.datalen);
2193 htlc_tx_ref.data_is_owned = true;
2194 LDKPublicKey per_commitment_point_ref;
2195 CHECK(*((uint32_t*)per_commitment_point) == 33);
2196 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
2197 LDKHTLCOutputInCommitment htlc_conv;
2198 htlc_conv.inner = (void*)(htlc & (~1));
2199 htlc_conv.is_owned = false;
2200 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2201 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2202 *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);
2203 return (uint64_t)ret_conv;
2206 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_closing_transaction(uint32_t this_arg, uint32_t closing_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 LDKClosingTransaction closing_tx_conv;
2211 closing_tx_conv.inner = (void*)(closing_tx & (~1));
2212 closing_tx_conv.is_owned = false;
2213 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
2214 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2215 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
2216 return (uint64_t)ret_conv;
2219 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
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 LDKUnsignedChannelAnnouncement msg_conv;
2224 msg_conv.inner = (void*)(msg & (~1));
2225 msg_conv.is_owned = false;
2226 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
2227 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2228 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2229 return (uint64_t)ret_conv;
2232 void __attribute__((visibility("default"))) TS_BaseSign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
2233 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2234 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2235 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2236 LDKChannelTransactionParameters channel_parameters_conv;
2237 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2238 channel_parameters_conv.is_owned = false;
2239 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
2240 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2243 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
2244 if (this_arg->set_pubkeys != NULL)
2245 this_arg->set_pubkeys(this_arg);
2246 return this_arg->pubkeys;
2248 uint32_t __attribute__((visibility("default"))) TS_BaseSign_get_pubkeys(uint32_t this_arg) {
2249 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2250 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2251 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2252 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
2253 uint64_t ret_ref = 0;
2254 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2255 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2256 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2257 ret_ref = (uint64_t)ret_var.inner;
2258 if (ret_var.is_owned) {
2264 typedef struct LDKSign_JCalls {
2265 atomic_size_t refcnt;
2266 LDKBaseSign_JCalls* BaseSign;
2267 uint32_t write_meth;
2269 static void LDKSign_JCalls_free(void* this_arg) {
2270 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2271 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2272 js_free(j_calls->write_meth);
2276 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
2277 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2278 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
2279 LDKCVec_u8Z ret_ref;
2280 ret_ref.datalen = *((uint32_t*)ret);
2281 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2282 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
2285 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
2286 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
2287 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2288 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
2290 static inline LDKSign LDKSign_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* BaseSign, uint32_t pubkeys) {
2291 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2292 atomic_init(&calls->refcnt, 1);
2293 //TODO: Assign calls->o from o
2295 LDKChannelPublicKeys pubkeys_conv;
2296 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2297 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2298 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2301 .this_arg = (void*) calls,
2302 .write = write_LDKSign_jcall,
2303 .cloned = LDKSign_JCalls_cloned,
2304 .free = LDKSign_JCalls_free,
2305 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
2307 calls->BaseSign = ret.BaseSign.this_arg;
2310 long __attribute__((visibility("default"))) TS_LDKSign_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* BaseSign, uint32_t pubkeys) {
2311 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2312 *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
2313 return (long)res_ptr;
2315 int8_tArray __attribute__((visibility("default"))) TS_Sign_write(uint32_t this_arg) {
2316 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2317 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2318 LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
2319 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2320 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2321 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
2322 CVec_u8Z_free(ret_var);
2326 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_ok(uint32_t arg) {
2327 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2328 CHECK(val->result_ok);
2329 LDKSign* res_ret = MALLOC(sizeof(LDKSign), "LDKSign");
2330 *res_ret = Sign_clone(&(*val->contents.result));
2331 return (uint64_t)res_ret;
2333 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_err(uint32_t arg) {
2334 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2335 CHECK(!val->result_ok);
2336 LDKDecodeError err_var = (*val->contents.err);
2337 uint64_t err_ref = 0;
2338 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2339 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2340 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
2341 err_ref = (uint64_t)err_var.inner & ~1;
2344 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_get_ok(uint32_t arg) {
2345 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2346 CHECK(val->result_ok);
2347 int8_tArray es_arr = init_arr(68, sizeof(uint8_t), "Native int8_tArray Bytes");
2348 memcpy((uint8_t*)(es_arr + 4), (*val->contents.result).serialized_form, 68);
2351 void __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_get_err(uint32_t arg) {
2352 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2353 CHECK(!val->result_ok);
2354 return *val->contents.err;
2356 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2357 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2358 for (size_t i = 0; i < ret.datalen; i++) {
2359 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2363 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t arg) {
2364 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2365 CHECK(val->result_ok);
2366 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
2367 ptrArray res_arr = NULL;
2368 res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
2369 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
2370 for (size_t m = 0; m < res_var.datalen; m++) {
2371 LDKCVec_u8Z res_conv_12_var = res_var.data[m];
2372 int8_tArray res_conv_12_arr = init_arr(res_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2373 memcpy((uint8_t*)(res_conv_12_arr + 4), res_conv_12_var.data, res_conv_12_var.datalen);
2374 res_arr_ptr[m] = res_conv_12_arr;
2379 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t arg) {
2380 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2381 CHECK(!val->result_ok);
2382 return *val->contents.err;
2384 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t arg) {
2385 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2386 CHECK(val->result_ok);
2387 LDKInMemorySigner res_var = (*val->contents.result);
2388 uint64_t res_ref = 0;
2389 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2390 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2391 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
2392 res_ref = (uint64_t)res_var.inner & ~1;
2395 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_err(uint32_t arg) {
2396 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2397 CHECK(!val->result_ok);
2398 LDKDecodeError err_var = (*val->contents.err);
2399 uint64_t err_ref = 0;
2400 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2401 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2402 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
2403 err_ref = (uint64_t)err_var.inner & ~1;
2406 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2407 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2408 for (size_t i = 0; i < ret.datalen; i++) {
2409 ret.data[i] = TxOut_clone(&orig->data[i]);
2413 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_ok(uint32_t arg) {
2414 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2415 CHECK(val->result_ok);
2416 LDKTransaction res_var = (*val->contents.result);
2417 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2418 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
2421 void __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_err(uint32_t arg) {
2422 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2423 CHECK(!val->result_ok);
2424 return *val->contents.err;
2426 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR tuple){
2427 return ThirtyTwoBytes_clone(&tuple->a);
2429 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t tuple) {
2430 LDKC2Tuple_BlockHashChannelMonitorZ* tuple_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(tuple & ~1);
2431 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2432 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_BlockHashChannelMonitorZ_get_a(tuple_conv).data, 32);
2436 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR tuple){
2437 return ChannelMonitor_clone(&tuple->b);
2439 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t tuple) {
2440 LDKC2Tuple_BlockHashChannelMonitorZ* tuple_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(tuple & ~1);
2441 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(tuple_conv);
2442 uint64_t ret_ref = 0;
2443 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2444 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2445 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2446 ret_ref = (uint64_t)ret_var.inner;
2447 if (ret_var.is_owned) {
2453 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
2454 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
2455 for (size_t i = 0; i < ret.datalen; i++) {
2456 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
2460 uint32_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(uint32_t arg) {
2461 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2462 CHECK(val->result_ok);
2463 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
2464 uint32_tArray res_arr = NULL;
2465 res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2466 uint32_t *res_arr_ptr = (uint32_t*)(res_arr + 4);
2467 for (size_t j = 0; j < res_var.datalen; j++) {
2468 LDKC2Tuple_BlockHashChannelMonitorZ* res_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2469 *res_conv_35_conv = res_var.data[j];
2470 *res_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone(res_conv_35_conv);
2471 res_arr_ptr[j] = ((uint64_t)res_conv_35_conv);
2476 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(uint32_t arg) {
2477 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2478 CHECK(!val->result_ok);
2479 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
2482 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u16Z_ref_from_ptr(uint32_t ptr) {
2483 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
2485 case LDKCOption_u16Z_Some: {
2486 return 0 /* LDKCOption_u16Z - Some */; (void) obj->some;
2488 case LDKCOption_u16Z_None: {
2489 return 0 /* LDKCOption_u16Z - None */;
2494 uint32_t __attribute__((visibility("default"))) TS_LDKAPIError_ref_from_ptr(uint32_t ptr) {
2495 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
2497 case LDKAPIError_APIMisuseError: {
2498 LDKStr err_str = obj->api_misuse_error.err;
2499 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2500 return 0 /* LDKAPIError - APIMisuseError */; (void) err_conv;
2502 case LDKAPIError_FeeRateTooHigh: {
2503 LDKStr err_str = obj->fee_rate_too_high.err;
2504 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2505 return 0 /* LDKAPIError - FeeRateTooHigh */; (void) err_conv; (void) obj->fee_rate_too_high.feerate;
2507 case LDKAPIError_RouteError: {
2508 LDKStr err_str = obj->route_error.err;
2509 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2510 return 0 /* LDKAPIError - RouteError */; (void) err_conv;
2512 case LDKAPIError_ChannelUnavailable: {
2513 LDKStr err_str = obj->channel_unavailable.err;
2514 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2515 return 0 /* LDKAPIError - ChannelUnavailable */; (void) err_conv;
2517 case LDKAPIError_MonitorUpdateFailed: {
2518 return 0 /* LDKAPIError - MonitorUpdateFailed */;
2520 case LDKAPIError_IncompatibleShutdownScript: {
2521 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
2522 uint64_t script_ref = 0;
2523 CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2524 CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2525 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
2526 script_ref = (uint64_t)script_var.inner & ~1;
2527 return 0 /* LDKAPIError - IncompatibleShutdownScript */; (void) script_ref;
2532 void __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_ok(uint32_t arg) {
2533 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2534 CHECK(val->result_ok);
2535 return *val->contents.result;
2537 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_err(uint32_t arg) {
2538 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2539 CHECK(!val->result_ok);
2540 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2543 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2544 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2545 for (size_t i = 0; i < ret.datalen; i++) {
2546 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
2550 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
2551 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
2552 for (size_t i = 0; i < ret.datalen; i++) {
2553 ret.data[i] = APIError_clone(&orig->data[i]);
2557 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult__u832APIErrorZ_get_ok(uint32_t arg) {
2558 LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1);
2559 CHECK(val->result_ok);
2560 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2561 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2564 uint32_t __attribute__((visibility("default"))) TS_LDKCResult__u832APIErrorZ_get_err(uint32_t arg) {
2565 LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1);
2566 CHECK(!val->result_ok);
2567 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2570 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentSendFailure_ref_from_ptr(uint32_t ptr) {
2571 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
2573 case LDKPaymentSendFailure_ParameterError: {
2574 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
2575 return 0 /* LDKPaymentSendFailure - ParameterError */; (void) parameter_error_ref;
2577 case LDKPaymentSendFailure_PathParameterError: {
2578 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
2579 uint32_tArray path_parameter_error_arr = NULL;
2580 path_parameter_error_arr = init_arr(path_parameter_error_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2581 uint32_t *path_parameter_error_arr_ptr = (uint32_t*)(path_parameter_error_arr + 4);
2582 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
2583 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2584 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
2585 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
2586 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
2589 return 0 /* LDKPaymentSendFailure - PathParameterError */; (void) path_parameter_error_arr;
2591 case LDKPaymentSendFailure_AllFailedRetrySafe: {
2592 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
2593 uint32_tArray all_failed_retry_safe_arr = NULL;
2594 all_failed_retry_safe_arr = init_arr(all_failed_retry_safe_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2595 uint32_t *all_failed_retry_safe_arr_ptr = (uint32_t*)(all_failed_retry_safe_arr + 4);
2596 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
2597 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
2598 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
2601 return 0 /* LDKPaymentSendFailure - AllFailedRetrySafe */; (void) all_failed_retry_safe_arr;
2603 case LDKPaymentSendFailure_PartialFailure: {
2604 LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
2605 uint32_tArray results_arr = NULL;
2606 results_arr = init_arr(results_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2607 uint32_t *results_arr_ptr = (uint32_t*)(results_arr + 4);
2608 for (size_t w = 0; w < results_var.datalen; w++) {
2609 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2610 *results_conv_22_conv = results_var.data[w];
2611 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
2612 results_arr_ptr[w] = (uint64_t)results_conv_22_conv;
2615 LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
2616 uint64_t failed_paths_retry_ref = 0;
2617 if ((uint64_t)failed_paths_retry_var.inner > 4096) {
2618 CHECK((((uint64_t)failed_paths_retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2619 CHECK((((uint64_t)&failed_paths_retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2620 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
2621 failed_paths_retry_ref = (uint64_t)failed_paths_retry_var.inner & ~1;
2623 int8_tArray payment_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2624 memcpy((uint8_t*)(payment_id_arr + 4), obj->partial_failure.payment_id.data, 32);
2625 return 0 /* LDKPaymentSendFailure - PartialFailure */; (void) results_arr; (void) failed_paths_retry_ref; (void) payment_id_arr;
2630 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentSendFailureZ_get_ok(uint32_t arg) {
2631 LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
2632 CHECK(val->result_ok);
2633 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2634 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2637 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentSendFailureZ_get_err(uint32_t arg) {
2638 LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
2639 CHECK(!val->result_ok);
2640 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2643 void __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_ok(uint32_t arg) {
2644 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2645 CHECK(val->result_ok);
2646 return *val->contents.result;
2648 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_err(uint32_t arg) {
2649 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2650 CHECK(!val->result_ok);
2651 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2654 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){
2655 return ThirtyTwoBytes_clone(&tuple->a);
2657 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint32_t tuple) {
2658 LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1);
2659 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2660 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentIdZ_get_a(tuple_conv).data, 32);
2664 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){
2665 return ThirtyTwoBytes_clone(&tuple->b);
2667 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint32_t tuple) {
2668 LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1);
2669 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2670 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentIdZ_get_b(tuple_conv).data, 32);
2674 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint32_t arg) {
2675 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
2676 CHECK(val->result_ok);
2677 LDKC2Tuple_PaymentHashPaymentIdZ* res_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
2678 *res_conv = (*val->contents.result);
2679 *res_conv = C2Tuple_PaymentHashPaymentIdZ_clone(res_conv);
2680 return ((uint64_t)res_conv);
2682 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint32_t arg) {
2683 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
2684 CHECK(!val->result_ok);
2685 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2688 uint32_t __attribute__((visibility("default"))) TS_LDKNetAddress_ref_from_ptr(uint32_t ptr) {
2689 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
2691 case LDKNetAddress_IPv4: {
2692 int8_tArray addr_arr = init_arr(4, sizeof(uint8_t), "Native int8_tArray Bytes");
2693 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv4.addr.data, 4);
2694 return 0 /* LDKNetAddress - IPv4 */; (void) addr_arr; (void) obj->i_pv4.port;
2696 case LDKNetAddress_IPv6: {
2697 int8_tArray addr_arr = init_arr(16, sizeof(uint8_t), "Native int8_tArray Bytes");
2698 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv6.addr.data, 16);
2699 return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port;
2701 case LDKNetAddress_OnionV2: {
2702 int8_tArray addr_arr = init_arr(10, sizeof(uint8_t), "Native int8_tArray Bytes");
2703 memcpy((uint8_t*)(addr_arr + 4), obj->onion_v2.addr.data, 10);
2704 return 0 /* LDKNetAddress - OnionV2 */; (void) addr_arr; (void) obj->onion_v2.port;
2706 case LDKNetAddress_OnionV3: {
2707 int8_tArray ed25519_pubkey_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2708 memcpy((uint8_t*)(ed25519_pubkey_arr + 4), obj->onion_v3.ed25519_pubkey.data, 32);
2709 return 0 /* LDKNetAddress - OnionV3 */; (void) ed25519_pubkey_arr; (void) obj->onion_v3.checksum; (void) obj->onion_v3.version; (void) obj->onion_v3.port;
2714 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
2715 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
2716 for (size_t i = 0; i < ret.datalen; i++) {
2717 ret.data[i] = NetAddress_clone(&orig->data[i]);
2721 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR tuple){
2722 return ThirtyTwoBytes_clone(&tuple->a);
2724 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint32_t tuple) {
2725 LDKC2Tuple_PaymentHashPaymentSecretZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(tuple & ~1);
2726 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2727 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentSecretZ_get_a(tuple_conv).data, 32);
2731 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR tuple){
2732 return ThirtyTwoBytes_clone(&tuple->b);
2734 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint32_t tuple) {
2735 LDKC2Tuple_PaymentHashPaymentSecretZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(tuple & ~1);
2736 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2737 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentSecretZ_get_b(tuple_conv).data, 32);
2741 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_ok(uint32_t arg) {
2742 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
2743 CHECK(val->result_ok);
2744 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2745 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2748 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_err(uint32_t arg) {
2749 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
2750 CHECK(!val->result_ok);
2751 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2754 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
2755 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
2756 for (size_t i = 0; i < ret.datalen; i++) {
2757 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
2761 typedef struct LDKWatch_JCalls {
2762 atomic_size_t refcnt;
2763 uint32_t watch_channel_meth;
2764 uint32_t update_channel_meth;
2765 uint32_t release_pending_monitor_events_meth;
2767 static void LDKWatch_JCalls_free(void* this_arg) {
2768 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2769 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2770 js_free(j_calls->watch_channel_meth);
2771 js_free(j_calls->update_channel_meth);
2772 js_free(j_calls->release_pending_monitor_events_meth);
2776 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2777 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2778 LDKOutPoint funding_txo_var = funding_txo;
2779 uint64_t funding_txo_ref = 0;
2780 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2781 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2782 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2783 funding_txo_ref = (uint64_t)funding_txo_var.inner;
2784 if (funding_txo_var.is_owned) {
2785 funding_txo_ref |= 1;
2787 LDKChannelMonitor monitor_var = monitor;
2788 uint64_t monitor_ref = 0;
2789 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2790 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2791 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
2792 monitor_ref = (uint64_t)monitor_var.inner;
2793 if (monitor_var.is_owned) {
2796 uint32_t ret = js_invoke_function_2(j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2797 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2798 CHECK_ACCESS(ret_ptr);
2799 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
2803 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2804 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2805 LDKOutPoint funding_txo_var = funding_txo;
2806 uint64_t funding_txo_ref = 0;
2807 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2808 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2809 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2810 funding_txo_ref = (uint64_t)funding_txo_var.inner;
2811 if (funding_txo_var.is_owned) {
2812 funding_txo_ref |= 1;
2814 LDKChannelMonitorUpdate update_var = update;
2815 uint64_t update_ref = 0;
2816 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2817 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2818 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
2819 update_ref = (uint64_t)update_var.inner;
2820 if (update_var.is_owned) {
2823 uint32_t ret = js_invoke_function_2(j_calls->update_channel_meth, funding_txo_ref, update_ref);
2824 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2825 CHECK_ACCESS(ret_ptr);
2826 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
2830 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
2831 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2832 uint32_tArray ret = js_invoke_function_0(j_calls->release_pending_monitor_events_meth);
2833 LDKCVec_MonitorEventZ ret_constr;
2834 ret_constr.datalen = *((uint32_t*)ret);
2835 if (ret_constr.datalen > 0)
2836 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2838 ret_constr.data = NULL;
2839 uint32_t* ret_vals = (uint32_t*)(ret + 4);
2840 for (size_t o = 0; o < ret_constr.datalen; o++) {
2841 uint32_t ret_conv_14 = ret_vals[o];
2842 void* ret_conv_14_ptr = (void*)(((uint64_t)ret_conv_14) & ~1);
2843 CHECK_ACCESS(ret_conv_14_ptr);
2844 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(ret_conv_14_ptr);
2845 FREE((void*)ret_conv_14);
2846 ret_constr.data[o] = ret_conv_14_conv;
2850 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
2851 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
2852 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2854 static inline LDKWatch LDKWatch_init (/*TODO: JS Object Reference */void* o) {
2855 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2856 atomic_init(&calls->refcnt, 1);
2857 //TODO: Assign calls->o from o
2860 .this_arg = (void*) calls,
2861 .watch_channel = watch_channel_LDKWatch_jcall,
2862 .update_channel = update_channel_LDKWatch_jcall,
2863 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
2864 .free = LDKWatch_JCalls_free,
2868 long __attribute__((visibility("default"))) TS_LDKWatch_new(/*TODO: JS Object Reference */void* o) {
2869 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2870 *res_ptr = LDKWatch_init(o);
2871 return (long)res_ptr;
2873 uint32_t __attribute__((visibility("default"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
2874 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2875 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2876 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
2877 LDKOutPoint funding_txo_conv;
2878 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2879 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2880 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
2881 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2882 LDKChannelMonitor monitor_conv;
2883 monitor_conv.inner = (void*)(monitor & (~1));
2884 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2885 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
2886 monitor_conv = ChannelMonitor_clone(&monitor_conv);
2887 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2888 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2889 return (uint64_t)ret_conv;
2892 uint32_t __attribute__((visibility("default"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
2893 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2894 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2895 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
2896 LDKOutPoint funding_txo_conv;
2897 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2898 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2899 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
2900 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2901 LDKChannelMonitorUpdate update_conv;
2902 update_conv.inner = (void*)(update & (~1));
2903 update_conv.is_owned = (update & 1) || (update == 0);
2904 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
2905 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2906 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2907 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2908 return (uint64_t)ret_conv;
2911 uint32_tArray __attribute__((visibility("default"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
2912 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2913 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2914 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
2915 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2916 uint32_tArray ret_arr = NULL;
2917 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2918 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
2919 for (size_t o = 0; o < ret_var.datalen; o++) {
2920 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2921 *ret_conv_14_copy = ret_var.data[o];
2922 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
2923 ret_arr_ptr[o] = ret_conv_14_ref;
2930 typedef struct LDKBroadcasterInterface_JCalls {
2931 atomic_size_t refcnt;
2932 uint32_t broadcast_transaction_meth;
2933 } LDKBroadcasterInterface_JCalls;
2934 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2935 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2936 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2937 js_free(j_calls->broadcast_transaction_meth);
2941 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
2942 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2943 LDKTransaction tx_var = tx;
2944 int8_tArray tx_arr = init_arr(tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2945 memcpy((uint8_t*)(tx_arr + 4), tx_var.data, tx_var.datalen);
2946 Transaction_free(tx_var);
2947 js_invoke_function_1(j_calls->broadcast_transaction_meth, tx_arr);
2949 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
2950 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
2951 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2953 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (/*TODO: JS Object Reference */void* o) {
2954 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2955 atomic_init(&calls->refcnt, 1);
2956 //TODO: Assign calls->o from o
2958 LDKBroadcasterInterface ret = {
2959 .this_arg = (void*) calls,
2960 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
2961 .free = LDKBroadcasterInterface_JCalls_free,
2965 long __attribute__((visibility("default"))) TS_LDKBroadcasterInterface_new(/*TODO: JS Object Reference */void* o) {
2966 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2967 *res_ptr = LDKBroadcasterInterface_init(o);
2968 return (long)res_ptr;
2970 void __attribute__((visibility("default"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
2971 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2972 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2973 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
2974 LDKTransaction tx_ref;
2975 tx_ref.datalen = *((uint32_t*)tx);
2976 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
2977 memcpy(tx_ref.data, (uint8_t*)(tx + 4), tx_ref.datalen);
2978 tx_ref.data_is_owned = true;
2979 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
2982 typedef struct LDKKeysInterface_JCalls {
2983 atomic_size_t refcnt;
2984 uint32_t get_node_secret_meth;
2985 uint32_t get_destination_script_meth;
2986 uint32_t get_shutdown_scriptpubkey_meth;
2987 uint32_t get_channel_signer_meth;
2988 uint32_t get_secure_random_bytes_meth;
2989 uint32_t read_chan_signer_meth;
2990 uint32_t sign_invoice_meth;
2991 } LDKKeysInterface_JCalls;
2992 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2993 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2994 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2995 js_free(j_calls->get_node_secret_meth);
2996 js_free(j_calls->get_destination_script_meth);
2997 js_free(j_calls->get_shutdown_scriptpubkey_meth);
2998 js_free(j_calls->get_channel_signer_meth);
2999 js_free(j_calls->get_secure_random_bytes_meth);
3000 js_free(j_calls->read_chan_signer_meth);
3001 js_free(j_calls->sign_invoice_meth);
3005 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
3006 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3007 int8_tArray ret = js_invoke_function_0(j_calls->get_node_secret_meth);
3008 LDKSecretKey ret_ref;
3009 CHECK(*((uint32_t*)ret) == 32);
3010 memcpy(ret_ref.bytes, (uint8_t*)(ret + 4), 32);
3013 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
3014 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3015 int8_tArray ret = js_invoke_function_0(j_calls->get_destination_script_meth);
3016 LDKCVec_u8Z ret_ref;
3017 ret_ref.datalen = *((uint32_t*)ret);
3018 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3019 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
3022 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
3023 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3024 uint32_t ret = js_invoke_function_0(j_calls->get_shutdown_scriptpubkey_meth);
3025 LDKShutdownScript ret_conv;
3026 ret_conv.inner = (void*)(ret & (~1));
3027 ret_conv.is_owned = (ret & 1) || (ret == 0);
3028 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
3031 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
3032 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3033 uint32_t ret = js_invoke_function_2(j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
3034 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
3035 CHECK_ACCESS(ret_ptr);
3036 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
3040 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
3041 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3042 int8_tArray ret = js_invoke_function_0(j_calls->get_secure_random_bytes_meth);
3043 LDKThirtyTwoBytes ret_ref;
3044 CHECK(*((uint32_t*)ret) == 32);
3045 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
3048 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
3049 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3050 LDKu8slice reader_var = reader;
3051 int8_tArray reader_arr = init_arr(reader_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3052 memcpy((uint8_t*)(reader_arr + 4), reader_var.data, reader_var.datalen);
3053 uint32_t ret = js_invoke_function_1(j_calls->read_chan_signer_meth, reader_arr);
3054 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
3055 CHECK_ACCESS(ret_ptr);
3056 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
3060 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
3061 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3062 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
3063 int8_tArray invoice_preimage_arr = init_arr(invoice_preimage_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3064 memcpy((uint8_t*)(invoice_preimage_arr + 4), invoice_preimage_var.data, invoice_preimage_var.datalen);
3065 CVec_u8Z_free(invoice_preimage_var);
3066 uint32_t ret = js_invoke_function_1(j_calls->sign_invoice_meth, invoice_preimage_arr);
3067 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
3068 CHECK_ACCESS(ret_ptr);
3069 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
3073 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
3074 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
3075 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3077 static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Reference */void* o) {
3078 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
3079 atomic_init(&calls->refcnt, 1);
3080 //TODO: Assign calls->o from o
3082 LDKKeysInterface ret = {
3083 .this_arg = (void*) calls,
3084 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
3085 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
3086 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
3087 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
3088 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
3089 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
3090 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
3091 .free = LDKKeysInterface_JCalls_free,
3095 long __attribute__((visibility("default"))) TS_LDKKeysInterface_new(/*TODO: JS Object Reference */void* o) {
3096 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
3097 *res_ptr = LDKKeysInterface_init(o);
3098 return (long)res_ptr;
3100 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_node_secret(uint32_t this_arg) {
3101 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3102 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3103 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3104 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3105 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
3109 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
3110 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3111 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3112 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3113 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
3114 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3115 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3116 CVec_u8Z_free(ret_var);
3120 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint32_t this_arg) {
3121 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3122 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3123 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3124 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
3125 uint64_t ret_ref = 0;
3126 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3127 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3128 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3129 ret_ref = (uint64_t)ret_var.inner;
3130 if (ret_var.is_owned) {
3136 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
3137 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3138 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3139 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3140 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
3141 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
3142 return (uint64_t)ret_ret;
3145 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
3146 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3147 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3148 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3149 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3150 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
3154 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
3155 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3156 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3157 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3158 LDKu8slice reader_ref;
3159 reader_ref.datalen = *((uint32_t*)reader);
3160 reader_ref.data = (int8_t*)(reader + 4);
3161 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
3162 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
3163 return (uint64_t)ret_conv;
3166 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_sign_invoice(uint32_t this_arg, int8_tArray invoice_preimage) {
3167 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3168 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3169 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3170 LDKCVec_u8Z invoice_preimage_ref;
3171 invoice_preimage_ref.datalen = *((uint32_t*)invoice_preimage);
3172 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
3173 memcpy(invoice_preimage_ref.data, (uint8_t*)(invoice_preimage + 4), invoice_preimage_ref.datalen);
3174 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
3175 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
3176 return (uint64_t)ret_conv;
3179 typedef struct LDKFeeEstimator_JCalls {
3180 atomic_size_t refcnt;
3181 uint32_t get_est_sat_per_1000_weight_meth;
3182 } LDKFeeEstimator_JCalls;
3183 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
3184 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3185 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3186 js_free(j_calls->get_est_sat_per_1000_weight_meth);
3190 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
3191 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3192 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
3193 return js_invoke_function_1(j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
3195 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
3196 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
3197 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3199 static inline LDKFeeEstimator LDKFeeEstimator_init (/*TODO: JS Object Reference */void* o) {
3200 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
3201 atomic_init(&calls->refcnt, 1);
3202 //TODO: Assign calls->o from o
3204 LDKFeeEstimator ret = {
3205 .this_arg = (void*) calls,
3206 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
3207 .free = LDKFeeEstimator_JCalls_free,
3211 long __attribute__((visibility("default"))) TS_LDKFeeEstimator_new(/*TODO: JS Object Reference */void* o) {
3212 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
3213 *res_ptr = LDKFeeEstimator_init(o);
3214 return (long)res_ptr;
3216 int32_t __attribute__((visibility("default"))) TS_FeeEstimator_get_est_sat_per_1000_weight(uint32_t this_arg, uint32_t confirmation_target) {
3217 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3218 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3219 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
3220 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
3221 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
3225 typedef struct LDKLogger_JCalls {
3226 atomic_size_t refcnt;
3229 static void LDKLogger_JCalls_free(void* this_arg) {
3230 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3231 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3232 js_free(j_calls->log_meth);
3236 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
3237 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3238 LDKRecord record_var = *record;
3239 uint64_t record_ref = 0;
3240 record_var = Record_clone(record);
3241 CHECK((((uint64_t)record_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3242 CHECK((((uint64_t)&record_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3243 CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
3244 record_ref = (uint64_t)record_var.inner;
3245 if (record_var.is_owned) {
3248 js_invoke_function_1(j_calls->log_meth, record_ref);
3250 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
3251 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
3252 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3254 static inline LDKLogger LDKLogger_init (/*TODO: JS Object Reference */void* o) {
3255 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3256 atomic_init(&calls->refcnt, 1);
3257 //TODO: Assign calls->o from o
3260 .this_arg = (void*) calls,
3261 .log = log_LDKLogger_jcall,
3262 .free = LDKLogger_JCalls_free,
3266 long __attribute__((visibility("default"))) TS_LDKLogger_new(/*TODO: JS Object Reference */void* o) {
3267 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3268 *res_ptr = LDKLogger_init(o);
3269 return (long)res_ptr;
3271 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR tuple){
3272 return ThirtyTwoBytes_clone(&tuple->a);
3274 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint32_t tuple) {
3275 LDKC2Tuple_BlockHashChannelManagerZ* tuple_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(tuple & ~1);
3276 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3277 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_BlockHashChannelManagerZ_get_a(tuple_conv).data, 32);
3281 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR tuple){
3284 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint32_t tuple) {
3285 LDKC2Tuple_BlockHashChannelManagerZ* tuple_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(tuple & ~1);
3286 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(tuple_conv);
3287 uint64_t ret_ref = 0;
3288 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3289 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3290 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3291 ret_ref = (uint64_t)ret_var.inner & ~1;
3295 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t arg) {
3296 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3297 CHECK(val->result_ok);
3298 LDKC2Tuple_BlockHashChannelManagerZ* res_conv = &(*val->contents.result);
3299 // Warning: we really need to clone here, but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
3300 return ((uint64_t)res_conv) | 1;
3302 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t arg) {
3303 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3304 CHECK(!val->result_ok);
3305 LDKDecodeError err_var = (*val->contents.err);
3306 uint64_t err_ref = 0;
3307 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3308 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3309 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
3310 err_ref = (uint64_t)err_var.inner & ~1;
3313 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t arg) {
3314 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
3315 CHECK(val->result_ok);
3316 LDKChannelConfig res_var = (*val->contents.result);
3317 uint64_t res_ref = 0;
3318 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3319 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3320 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3321 res_ref = (uint64_t)res_var.inner & ~1;
3324 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_err(uint32_t arg) {
3325 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
3326 CHECK(!val->result_ok);
3327 LDKDecodeError err_var = (*val->contents.err);
3328 uint64_t err_ref = 0;
3329 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3330 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3331 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
3332 err_ref = (uint64_t)err_var.inner & ~1;
3335 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_ok(uint32_t arg) {
3336 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
3337 CHECK(val->result_ok);
3338 LDKOutPoint res_var = (*val->contents.result);
3339 uint64_t res_ref = 0;
3340 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3341 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3342 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3343 res_ref = (uint64_t)res_var.inner & ~1;
3346 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_err(uint32_t arg) {
3347 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
3348 CHECK(!val->result_ok);
3349 LDKDecodeError err_var = (*val->contents.err);
3350 uint64_t err_ref = 0;
3351 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3352 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3353 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
3354 err_ref = (uint64_t)err_var.inner & ~1;
3357 typedef struct LDKType_JCalls {
3358 atomic_size_t refcnt;
3359 uint32_t type_id_meth;
3360 uint32_t debug_str_meth;
3361 uint32_t write_meth;
3363 static void LDKType_JCalls_free(void* this_arg) {
3364 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3365 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3366 js_free(j_calls->type_id_meth);
3367 js_free(j_calls->debug_str_meth);
3368 js_free(j_calls->write_meth);
3372 uint16_t type_id_LDKType_jcall(const void* this_arg) {
3373 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3374 return js_invoke_function_0(j_calls->type_id_meth);
3376 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
3377 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3378 uint32_t ret = js_invoke_function_0(j_calls->debug_str_meth);
3379 LDKStr ret_conv = str_ref_to_owned_c(ret);
3382 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
3383 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3384 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
3385 LDKCVec_u8Z ret_ref;
3386 ret_ref.datalen = *((uint32_t*)ret);
3387 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3388 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
3391 static void LDKType_JCalls_cloned(LDKType* new_obj) {
3392 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
3393 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3395 static inline LDKType LDKType_init (/*TODO: JS Object Reference */void* o) {
3396 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
3397 atomic_init(&calls->refcnt, 1);
3398 //TODO: Assign calls->o from o
3401 .this_arg = (void*) calls,
3402 .type_id = type_id_LDKType_jcall,
3403 .debug_str = debug_str_LDKType_jcall,
3404 .write = write_LDKType_jcall,
3405 .cloned = LDKType_JCalls_cloned,
3406 .free = LDKType_JCalls_free,
3410 long __attribute__((visibility("default"))) TS_LDKType_new(/*TODO: JS Object Reference */void* o) {
3411 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
3412 *res_ptr = LDKType_init(o);
3413 return (long)res_ptr;
3415 int16_t __attribute__((visibility("default"))) TS_Type_type_id(uint32_t this_arg) {
3416 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3417 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3418 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
3419 int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
3423 jstring __attribute__((visibility("default"))) TS_Type_debug_str(uint32_t this_arg) {
3424 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3425 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3426 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
3427 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
3428 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
3433 int8_tArray __attribute__((visibility("default"))) TS_Type_write(uint32_t this_arg) {
3434 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3435 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3436 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
3437 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3438 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3439 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3440 CVec_u8Z_free(ret_var);
3444 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_TypeZ_ref_from_ptr(uint32_t ptr) {
3445 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
3447 case LDKCOption_TypeZ_Some: {
3448 LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
3449 *some_ret = Type_clone(&obj->some);
3450 return 0 /* LDKCOption_TypeZ - Some */; (void) (uint64_t)some_ret;
3452 case LDKCOption_TypeZ_None: {
3453 return 0 /* LDKCOption_TypeZ - None */;
3458 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_get_ok(uint32_t arg) {
3459 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
3460 CHECK(val->result_ok);
3461 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
3464 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_get_err(uint32_t arg) {
3465 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
3466 CHECK(!val->result_ok);
3467 LDKDecodeError err_var = (*val->contents.err);
3468 uint64_t err_ref = 0;
3469 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3470 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3471 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
3472 err_ref = (uint64_t)err_var.inner & ~1;
3475 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentError_ref_from_ptr(uint32_t ptr) {
3476 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
3478 case LDKPaymentError_Invoice: {
3479 LDKStr invoice_str = obj->invoice;
3480 jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
3481 return 0 /* LDKPaymentError - Invoice */; (void) invoice_conv;
3483 case LDKPaymentError_Routing: {
3484 LDKLightningError routing_var = obj->routing;
3485 uint64_t routing_ref = 0;
3486 CHECK((((uint64_t)routing_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3487 CHECK((((uint64_t)&routing_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3488 CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
3489 routing_ref = (uint64_t)routing_var.inner & ~1;
3490 return 0 /* LDKPaymentError - Routing */; (void) routing_ref;
3492 case LDKPaymentError_Sending: {
3493 uint64_t sending_ref = ((uint64_t)&obj->sending) | 1;
3494 return 0 /* LDKPaymentError - Sending */; (void) sending_ref;
3499 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentErrorZ_get_ok(uint32_t arg) {
3500 LDKCResult_PaymentIdPaymentErrorZ *val = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
3501 CHECK(val->result_ok);
3502 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3503 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
3506 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentErrorZ_get_err(uint32_t arg) {
3507 LDKCResult_PaymentIdPaymentErrorZ *val = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
3508 CHECK(!val->result_ok);
3509 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3512 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_get_ok(uint32_t arg) {
3513 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
3514 CHECK(val->result_ok);
3515 uint32_t res_conv = LDKSiPrefix_to_js((*val->contents.result));
3518 void __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_get_err(uint32_t arg) {
3519 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
3520 CHECK(!val->result_ok);
3521 return *val->contents.err;
3523 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_get_ok(uint32_t arg) {
3524 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
3525 CHECK(val->result_ok);
3526 LDKInvoice res_var = (*val->contents.result);
3527 uint64_t res_ref = 0;
3528 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3529 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3530 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3531 res_ref = (uint64_t)res_var.inner & ~1;
3534 void __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_get_err(uint32_t arg) {
3535 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
3536 CHECK(!val->result_ok);
3537 return *val->contents.err;
3539 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_get_ok(uint32_t arg) {
3540 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
3541 CHECK(val->result_ok);
3542 LDKSignedRawInvoice res_var = (*val->contents.result);
3543 uint64_t res_ref = 0;
3544 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3545 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3546 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3547 res_ref = (uint64_t)res_var.inner & ~1;
3550 void __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_get_err(uint32_t arg) {
3551 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
3552 CHECK(!val->result_ok);
3553 return *val->contents.err;
3555 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
3556 return RawInvoice_clone(&tuple->a);
3558 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint32_t tuple) {
3559 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
3560 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(tuple_conv);
3561 uint64_t ret_ref = 0;
3562 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3563 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3564 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3565 ret_ref = (uint64_t)ret_var.inner;
3566 if (ret_var.is_owned) {
3572 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
3573 return ThirtyTwoBytes_clone(&tuple->b);
3575 int8_tArray __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint32_t tuple) {
3576 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
3577 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3578 memcpy((uint8_t*)(ret_arr + 4), C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(tuple_conv).data, 32);
3582 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
3583 return InvoiceSignature_clone(&tuple->c);
3585 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint32_t tuple) {
3586 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
3587 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(tuple_conv);
3588 uint64_t ret_ref = 0;
3589 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3590 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3591 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3592 ret_ref = (uint64_t)ret_var.inner;
3593 if (ret_var.is_owned) {
3599 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_get_ok(uint32_t arg) {
3600 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
3601 CHECK(val->result_ok);
3602 LDKPayeePubKey res_var = (*val->contents.result);
3603 uint64_t res_ref = 0;
3604 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3605 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3606 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3607 res_ref = (uint64_t)res_var.inner & ~1;
3610 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_get_err(uint32_t arg) {
3611 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
3612 CHECK(!val->result_ok);
3613 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
3616 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
3617 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
3618 for (size_t i = 0; i < ret.datalen; i++) {
3619 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
3623 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_get_ok(uint32_t arg) {
3624 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
3625 CHECK(val->result_ok);
3626 LDKPositiveTimestamp res_var = (*val->contents.result);
3627 uint64_t res_ref = 0;
3628 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3629 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3630 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3631 res_ref = (uint64_t)res_var.inner & ~1;
3634 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_get_err(uint32_t arg) {
3635 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
3636 CHECK(!val->result_ok);
3637 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3640 void __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_get_ok(uint32_t arg) {
3641 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
3642 CHECK(val->result_ok);
3643 return *val->contents.result;
3645 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_get_err(uint32_t arg) {
3646 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
3647 CHECK(!val->result_ok);
3648 uint32_t err_conv = LDKSemanticError_to_js((*val->contents.err));
3651 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_get_ok(uint32_t arg) {
3652 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
3653 CHECK(val->result_ok);
3654 LDKInvoice res_var = (*val->contents.result);
3655 uint64_t res_ref = 0;
3656 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3657 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3658 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3659 res_ref = (uint64_t)res_var.inner & ~1;
3662 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_get_err(uint32_t arg) {
3663 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
3664 CHECK(!val->result_ok);
3665 uint32_t err_conv = LDKSemanticError_to_js((*val->contents.err));
3668 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_get_ok(uint32_t arg) {
3669 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
3670 CHECK(val->result_ok);
3671 LDKDescription res_var = (*val->contents.result);
3672 uint64_t res_ref = 0;
3673 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3674 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3675 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3676 res_ref = (uint64_t)res_var.inner & ~1;
3679 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_get_err(uint32_t arg) {
3680 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
3681 CHECK(!val->result_ok);
3682 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3685 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_get_ok(uint32_t arg) {
3686 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
3687 CHECK(val->result_ok);
3688 LDKExpiryTime 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 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_get_err(uint32_t arg) {
3697 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
3698 CHECK(!val->result_ok);
3699 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3702 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_get_ok(uint32_t arg) {
3703 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
3704 CHECK(val->result_ok);
3705 LDKPrivateRoute res_var = (*val->contents.result);
3706 uint64_t res_ref = 0;
3707 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3708 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3709 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3710 res_ref = (uint64_t)res_var.inner & ~1;
3713 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_get_err(uint32_t arg) {
3714 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
3715 CHECK(!val->result_ok);
3716 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3719 jstring __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_get_ok(uint32_t arg) {
3720 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
3721 CHECK(val->result_ok);
3722 LDKStr res_str = (*val->contents.result);
3723 jstring res_conv = str_ref_to_ts(res_str.chars, res_str.len);
3726 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_get_err(uint32_t arg) {
3727 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
3728 CHECK(!val->result_ok);
3729 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
3732 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3733 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
3734 CHECK(val->result_ok);
3735 LDKChannelMonitorUpdate res_var = (*val->contents.result);
3736 uint64_t res_ref = 0;
3737 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3738 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3739 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3740 res_ref = (uint64_t)res_var.inner & ~1;
3743 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t arg) {
3744 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
3745 CHECK(!val->result_ok);
3746 LDKDecodeError err_var = (*val->contents.err);
3747 uint64_t err_ref = 0;
3748 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3749 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3750 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
3751 err_ref = (uint64_t)err_var.inner & ~1;
3754 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_MonitorEventZ_ref_from_ptr(uint32_t ptr) {
3755 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
3757 case LDKCOption_MonitorEventZ_Some: {
3758 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
3759 return 0 /* LDKCOption_MonitorEventZ - Some */; (void) some_ref;
3761 case LDKCOption_MonitorEventZ_None: {
3762 return 0 /* LDKCOption_MonitorEventZ - None */;
3767 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint32_t arg) {
3768 LDKCResult_COption_MonitorEventZDecodeErrorZ *val = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
3769 CHECK(val->result_ok);
3770 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
3773 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_MonitorEventZDecodeErrorZ_get_err(uint32_t arg) {
3774 LDKCResult_COption_MonitorEventZDecodeErrorZ *val = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
3775 CHECK(!val->result_ok);
3776 LDKDecodeError err_var = (*val->contents.err);
3777 uint64_t err_ref = 0;
3778 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3779 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3780 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
3781 err_ref = (uint64_t)err_var.inner & ~1;
3784 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3785 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
3786 CHECK(val->result_ok);
3787 LDKHTLCUpdate res_var = (*val->contents.result);
3788 uint64_t res_ref = 0;
3789 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3790 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3791 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3792 res_ref = (uint64_t)res_var.inner & ~1;
3795 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t arg) {
3796 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
3797 CHECK(!val->result_ok);
3798 LDKDecodeError err_var = (*val->contents.err);
3799 uint64_t err_ref = 0;
3800 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3801 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3802 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
3803 err_ref = (uint64_t)err_var.inner & ~1;
3806 void __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_ok(uint32_t arg) {
3807 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
3808 CHECK(val->result_ok);
3809 return *val->contents.result;
3811 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_err(uint32_t arg) {
3812 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
3813 CHECK(!val->result_ok);
3814 LDKMonitorUpdateError err_var = (*val->contents.err);
3815 uint64_t err_ref = 0;
3816 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3817 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3818 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
3819 err_ref = (uint64_t)err_var.inner & ~1;
3822 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){
3823 return OutPoint_clone(&tuple->a);
3825 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_get_a(uint32_t tuple) {
3826 LDKC2Tuple_OutPointScriptZ* tuple_conv = (LDKC2Tuple_OutPointScriptZ*)(tuple & ~1);
3827 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(tuple_conv);
3828 uint64_t ret_ref = 0;
3829 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3830 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3831 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3832 ret_ref = (uint64_t)ret_var.inner;
3833 if (ret_var.is_owned) {
3839 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){
3840 return CVec_u8Z_clone(&tuple->b);
3842 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_get_b(uint32_t tuple) {
3843 LDKC2Tuple_OutPointScriptZ* tuple_conv = (LDKC2Tuple_OutPointScriptZ*)(tuple & ~1);
3844 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(tuple_conv);
3845 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3846 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3847 CVec_u8Z_free(ret_var);
3851 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR tuple){
3854 int32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_get_a(uint32_t tuple) {
3855 LDKC2Tuple_u32ScriptZ* tuple_conv = (LDKC2Tuple_u32ScriptZ*)(tuple & ~1);
3856 int32_t ret_val = C2Tuple_u32ScriptZ_get_a(tuple_conv);
3860 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR tuple){
3861 return CVec_u8Z_clone(&tuple->b);
3863 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_get_b(uint32_t tuple) {
3864 LDKC2Tuple_u32ScriptZ* tuple_conv = (LDKC2Tuple_u32ScriptZ*)(tuple & ~1);
3865 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(tuple_conv);
3866 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3867 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3868 CVec_u8Z_free(ret_var);
3872 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
3873 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
3874 for (size_t i = 0; i < ret.datalen; i++) {
3875 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
3879 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR tuple){
3880 return ThirtyTwoBytes_clone(&tuple->a);
3882 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint32_t tuple) {
3883 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(tuple & ~1);
3884 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3885 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(tuple_conv).data, 32);
3889 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR tuple){
3890 return CVec_C2Tuple_u32ScriptZZ_clone(&tuple->b);
3892 uint32_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint32_t tuple) {
3893 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(tuple & ~1);
3894 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(tuple_conv);
3895 uint32_tArray ret_arr = NULL;
3896 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3897 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
3898 for (size_t v = 0; v < ret_var.datalen; v++) {
3899 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
3900 *ret_conv_21_conv = ret_var.data[v];
3901 ret_arr_ptr[v] = ((uint64_t)ret_conv_21_conv);
3908 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
3909 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 };
3910 for (size_t i = 0; i < ret.datalen; i++) {
3911 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
3915 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
3916 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
3917 for (size_t i = 0; i < ret.datalen; i++) {
3918 ret.data[i] = Event_clone(&orig->data[i]);
3922 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR tuple){
3925 int32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_get_a(uint32_t tuple) {
3926 LDKC2Tuple_u32TxOutZ* tuple_conv = (LDKC2Tuple_u32TxOutZ*)(tuple & ~1);
3927 int32_t ret_val = C2Tuple_u32TxOutZ_get_a(tuple_conv);
3931 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR tuple){
3932 return TxOut_clone(&tuple->b);
3934 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_get_b(uint32_t tuple) {
3935 LDKC2Tuple_u32TxOutZ* tuple_conv = (LDKC2Tuple_u32TxOutZ*)(tuple & ~1);
3936 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3937 *ret_ref = C2Tuple_u32TxOutZ_get_b(tuple_conv);
3938 return (uint64_t)ret_ref;
3941 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
3942 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
3943 for (size_t i = 0; i < ret.datalen; i++) {
3944 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
3948 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR tuple){
3949 return ThirtyTwoBytes_clone(&tuple->a);
3951 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t tuple) {
3952 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(tuple & ~1);
3953 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3954 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(tuple_conv).data, 32);
3958 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR tuple){
3959 return CVec_C2Tuple_u32TxOutZZ_clone(&tuple->b);
3961 uint32_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t tuple) {
3962 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(tuple & ~1);
3963 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(tuple_conv);
3964 uint32_tArray ret_arr = NULL;
3965 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3966 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
3967 for (size_t u = 0; u < ret_var.datalen; u++) {
3968 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
3969 *ret_conv_20_conv = ret_var.data[u];
3970 ret_arr_ptr[u] = ((uint64_t)ret_conv_20_conv);
3977 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
3978 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 };
3979 for (size_t i = 0; i < ret.datalen; i++) {
3980 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
3984 uint32_t __attribute__((visibility("default"))) TS_LDKBalance_ref_from_ptr(uint32_t ptr) {
3985 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
3987 case LDKBalance_ClaimableOnChannelClose: {
3988 return 0 /* LDKBalance - ClaimableOnChannelClose */; (void) obj->claimable_on_channel_close.claimable_amount_satoshis;
3990 case LDKBalance_ClaimableAwaitingConfirmations: {
3991 return 0 /* LDKBalance - ClaimableAwaitingConfirmations */; (void) obj->claimable_awaiting_confirmations.claimable_amount_satoshis; (void) obj->claimable_awaiting_confirmations.confirmation_height;
3993 case LDKBalance_ContentiousClaimable: {
3994 return 0 /* LDKBalance - ContentiousClaimable */; (void) obj->contentious_claimable.claimable_amount_satoshis; (void) obj->contentious_claimable.timeout_height;
3996 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
3997 return 0 /* LDKBalance - MaybeClaimableHTLCAwaitingTimeout */; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
4002 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
4003 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
4004 for (size_t i = 0; i < ret.datalen; i++) {
4005 ret.data[i] = Balance_clone(&orig->data[i]);
4009 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t arg) {
4010 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
4011 CHECK(val->result_ok);
4012 LDKC2Tuple_BlockHashChannelMonitorZ* res_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
4013 *res_conv = (*val->contents.result);
4014 *res_conv = C2Tuple_BlockHashChannelMonitorZ_clone(res_conv);
4015 return ((uint64_t)res_conv);
4017 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t arg) {
4018 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
4019 CHECK(!val->result_ok);
4020 LDKDecodeError err_var = (*val->contents.err);
4021 uint64_t err_ref = 0;
4022 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4023 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4024 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4025 err_ref = (uint64_t)err_var.inner & ~1;
4028 void __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_ok(uint32_t arg) {
4029 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4030 CHECK(val->result_ok);
4031 return *val->contents.result;
4033 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_err(uint32_t arg) {
4034 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4035 CHECK(!val->result_ok);
4036 LDKLightningError err_var = (*val->contents.err);
4037 uint64_t err_ref = 0;
4038 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4039 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4040 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4041 err_ref = (uint64_t)err_var.inner & ~1;
4044 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR tuple){
4047 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint32_t tuple) {
4048 LDKC2Tuple_PublicKeyTypeZ* tuple_conv = (LDKC2Tuple_PublicKeyTypeZ*)(tuple & ~1);
4049 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4050 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PublicKeyTypeZ_get_a(tuple_conv).compressed_form, 33);
4054 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR tuple){
4055 return Type_clone(&tuple->b);
4057 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint32_t tuple) {
4058 LDKC2Tuple_PublicKeyTypeZ* tuple_conv = (LDKC2Tuple_PublicKeyTypeZ*)(tuple & ~1);
4059 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
4060 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(tuple_conv);
4061 return (uint64_t)ret_ret;
4064 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
4065 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
4066 for (size_t i = 0; i < ret.datalen; i++) {
4067 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
4071 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_ok(uint32_t arg) {
4072 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4073 CHECK(val->result_ok);
4074 return *val->contents.result;
4076 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_err(uint32_t arg) {
4077 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4078 CHECK(!val->result_ok);
4079 LDKLightningError err_var = (*val->contents.err);
4080 uint64_t err_ref = 0;
4081 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4082 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4083 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4084 err_ref = (uint64_t)err_var.inner & ~1;
4087 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
4088 return ChannelAnnouncement_clone(&tuple->a);
4090 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t tuple) {
4091 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
4092 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(tuple_conv);
4093 uint64_t ret_ref = 0;
4094 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4095 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4096 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4097 ret_ref = (uint64_t)ret_var.inner;
4098 if (ret_var.is_owned) {
4104 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
4105 return ChannelUpdate_clone(&tuple->b);
4107 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t tuple) {
4108 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
4109 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(tuple_conv);
4110 uint64_t ret_ref = 0;
4111 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4112 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4113 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4114 ret_ref = (uint64_t)ret_var.inner;
4115 if (ret_var.is_owned) {
4121 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
4122 return ChannelUpdate_clone(&tuple->c);
4124 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t tuple) {
4125 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
4126 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(tuple_conv);
4127 uint64_t ret_ref = 0;
4128 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4129 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4130 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4131 ret_ref = (uint64_t)ret_var.inner;
4132 if (ret_var.is_owned) {
4138 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
4139 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
4140 for (size_t i = 0; i < ret.datalen; i++) {
4141 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
4145 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
4146 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
4147 for (size_t i = 0; i < ret.datalen; i++) {
4148 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
4152 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t arg) {
4153 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4154 CHECK(val->result_ok);
4155 LDKCVec_u8Z res_var = (*val->contents.result);
4156 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
4157 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
4160 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t arg) {
4161 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4162 CHECK(!val->result_ok);
4163 LDKPeerHandleError err_var = (*val->contents.err);
4164 uint64_t err_ref = 0;
4165 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4166 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4167 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4168 err_ref = (uint64_t)err_var.inner & ~1;
4171 void __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_ok(uint32_t arg) {
4172 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4173 CHECK(val->result_ok);
4174 return *val->contents.result;
4176 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_err(uint32_t arg) {
4177 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4178 CHECK(!val->result_ok);
4179 LDKPeerHandleError err_var = (*val->contents.err);
4180 uint64_t err_ref = 0;
4181 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4182 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4183 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4184 err_ref = (uint64_t)err_var.inner & ~1;
4187 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_ok(uint32_t arg) {
4188 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4189 CHECK(val->result_ok);
4190 return *val->contents.result;
4192 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_err(uint32_t arg) {
4193 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4194 CHECK(!val->result_ok);
4195 LDKPeerHandleError err_var = (*val->contents.err);
4196 uint64_t err_ref = 0;
4197 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4198 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4199 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4200 err_ref = (uint64_t)err_var.inner & ~1;
4203 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeIdDecodeErrorZ_get_ok(uint32_t arg) {
4204 LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
4205 CHECK(val->result_ok);
4206 LDKNodeId res_var = (*val->contents.result);
4207 uint64_t res_ref = 0;
4208 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4209 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4210 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4211 res_ref = (uint64_t)res_var.inner & ~1;
4214 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeIdDecodeErrorZ_get_err(uint32_t arg) {
4215 LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
4216 CHECK(!val->result_ok);
4217 LDKDecodeError err_var = (*val->contents.err);
4218 uint64_t err_ref = 0;
4219 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4220 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4221 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4222 err_ref = (uint64_t)err_var.inner & ~1;
4225 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint32_t arg) {
4226 LDKCResult_COption_NetworkUpdateZDecodeErrorZ *val = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
4227 CHECK(val->result_ok);
4228 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
4231 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint32_t arg) {
4232 LDKCResult_COption_NetworkUpdateZDecodeErrorZ *val = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
4233 CHECK(!val->result_ok);
4234 LDKDecodeError err_var = (*val->contents.err);
4235 uint64_t err_ref = 0;
4236 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4237 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4238 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4239 err_ref = (uint64_t)err_var.inner & ~1;
4242 typedef struct LDKAccess_JCalls {
4243 atomic_size_t refcnt;
4244 uint32_t get_utxo_meth;
4246 static void LDKAccess_JCalls_free(void* this_arg) {
4247 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4248 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4249 js_free(j_calls->get_utxo_meth);
4253 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
4254 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4255 int8_tArray genesis_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4256 memcpy((uint8_t*)(genesis_hash_arr + 4), *genesis_hash, 32);
4257 uint32_t ret = js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
4258 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
4259 CHECK_ACCESS(ret_ptr);
4260 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
4264 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
4265 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
4266 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4268 static inline LDKAccess LDKAccess_init (/*TODO: JS Object Reference */void* o) {
4269 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
4270 atomic_init(&calls->refcnt, 1);
4271 //TODO: Assign calls->o from o
4274 .this_arg = (void*) calls,
4275 .get_utxo = get_utxo_LDKAccess_jcall,
4276 .free = LDKAccess_JCalls_free,
4280 long __attribute__((visibility("default"))) TS_LDKAccess_new(/*TODO: JS Object Reference */void* o) {
4281 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
4282 *res_ptr = LDKAccess_init(o);
4283 return (long)res_ptr;
4285 uint32_t __attribute__((visibility("default"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
4286 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4287 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4288 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
4289 unsigned char genesis_hash_arr[32];
4290 CHECK(*((uint32_t*)genesis_hash) == 32);
4291 memcpy(genesis_hash_arr, (uint8_t*)(genesis_hash + 4), 32);
4292 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
4293 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4294 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
4295 return (uint64_t)ret_conv;
4298 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_AccessZ_ref_from_ptr(uint32_t ptr) {
4299 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
4301 case LDKCOption_AccessZ_Some: {
4302 LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
4303 *some_ret = obj->some;
4304 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
4305 return 0 /* LDKCOption_AccessZ - Some */; (void) (uint64_t)some_ret;
4307 case LDKCOption_AccessZ_None: {
4308 return 0 /* LDKCOption_AccessZ - None */;
4313 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
4314 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4315 CHECK(val->result_ok);
4316 LDKDirectionalChannelInfo res_var = (*val->contents.result);
4317 uint64_t res_ref = 0;
4318 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4319 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4320 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4321 res_ref = (uint64_t)res_var.inner & ~1;
4324 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
4325 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4326 CHECK(!val->result_ok);
4327 LDKDecodeError err_var = (*val->contents.err);
4328 uint64_t err_ref = 0;
4329 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4330 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4331 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4332 err_ref = (uint64_t)err_var.inner & ~1;
4335 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
4336 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4337 CHECK(val->result_ok);
4338 LDKChannelInfo res_var = (*val->contents.result);
4339 uint64_t res_ref = 0;
4340 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4341 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4342 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4343 res_ref = (uint64_t)res_var.inner & ~1;
4346 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
4347 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4348 CHECK(!val->result_ok);
4349 LDKDecodeError err_var = (*val->contents.err);
4350 uint64_t err_ref = 0;
4351 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4352 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4353 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4354 err_ref = (uint64_t)err_var.inner & ~1;
4357 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t arg) {
4358 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4359 CHECK(val->result_ok);
4360 LDKRoutingFees res_var = (*val->contents.result);
4361 uint64_t res_ref = 0;
4362 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4363 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4364 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4365 res_ref = (uint64_t)res_var.inner & ~1;
4368 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_err(uint32_t arg) {
4369 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4370 CHECK(!val->result_ok);
4371 LDKDecodeError err_var = (*val->contents.err);
4372 uint64_t err_ref = 0;
4373 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4374 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4375 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4376 err_ref = (uint64_t)err_var.inner & ~1;
4379 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t arg) {
4380 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
4381 CHECK(val->result_ok);
4382 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
4383 uint64_t res_ref = 0;
4384 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4385 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4386 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4387 res_ref = (uint64_t)res_var.inner & ~1;
4390 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t arg) {
4391 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
4392 CHECK(!val->result_ok);
4393 LDKDecodeError err_var = (*val->contents.err);
4394 uint64_t err_ref = 0;
4395 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4396 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4397 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4398 err_ref = (uint64_t)err_var.inner & ~1;
4401 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
4402 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
4403 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
4406 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_ok(uint32_t arg) {
4407 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
4408 CHECK(val->result_ok);
4409 LDKNodeInfo res_var = (*val->contents.result);
4410 uint64_t res_ref = 0;
4411 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4412 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4413 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4414 res_ref = (uint64_t)res_var.inner & ~1;
4417 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_err(uint32_t arg) {
4418 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
4419 CHECK(!val->result_ok);
4420 LDKDecodeError err_var = (*val->contents.err);
4421 uint64_t err_ref = 0;
4422 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4423 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4424 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4425 err_ref = (uint64_t)err_var.inner & ~1;
4428 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t arg) {
4429 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
4430 CHECK(val->result_ok);
4431 LDKNetworkGraph res_var = (*val->contents.result);
4432 uint64_t res_ref = 0;
4433 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4434 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4435 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4436 res_ref = (uint64_t)res_var.inner & ~1;
4439 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_err(uint32_t arg) {
4440 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
4441 CHECK(!val->result_ok);
4442 LDKDecodeError err_var = (*val->contents.err);
4443 uint64_t err_ref = 0;
4444 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4445 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4446 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4447 err_ref = (uint64_t)err_var.inner & ~1;
4450 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_CVec_NetAddressZZ_ref_from_ptr(uint32_t ptr) {
4451 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
4453 case LDKCOption_CVec_NetAddressZZ_Some: {
4454 LDKCVec_NetAddressZ some_var = obj->some;
4455 uint32_tArray some_arr = NULL;
4456 some_arr = init_arr(some_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
4457 uint32_t *some_arr_ptr = (uint32_t*)(some_arr + 4);
4458 for (size_t m = 0; m < some_var.datalen; m++) {
4459 uint64_t some_conv_12_ref = ((uint64_t)&some_var.data[m]) | 1;
4460 some_arr_ptr[m] = some_conv_12_ref;
4463 return 0 /* LDKCOption_CVec_NetAddressZZ - Some */; (void) some_arr;
4465 case LDKCOption_CVec_NetAddressZZ_None: {
4466 return 0 /* LDKCOption_CVec_NetAddressZZ - None */;
4471 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_get_ok(uint32_t arg) {
4472 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
4473 CHECK(val->result_ok);
4474 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
4477 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_get_err(uint32_t arg) {
4478 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
4479 CHECK(!val->result_ok);
4480 LDKDecodeError err_var = (*val->contents.err);
4481 uint64_t err_ref = 0;
4482 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4483 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4484 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4485 err_ref = (uint64_t)err_var.inner & ~1;
4488 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
4489 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
4490 for (size_t i = 0; i < ret.datalen; i++) {
4491 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
4495 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
4496 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
4497 for (size_t i = 0; i < ret.datalen; i++) {
4498 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
4502 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
4503 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
4504 for (size_t i = 0; i < ret.datalen; i++) {
4505 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
4509 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
4510 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
4511 for (size_t i = 0; i < ret.datalen; i++) {
4512 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
4516 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t arg) {
4517 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
4518 CHECK(val->result_ok);
4519 LDKAcceptChannel res_var = (*val->contents.result);
4520 uint64_t res_ref = 0;
4521 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4522 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4523 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4524 res_ref = (uint64_t)res_var.inner & ~1;
4527 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_err(uint32_t arg) {
4528 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
4529 CHECK(!val->result_ok);
4530 LDKDecodeError err_var = (*val->contents.err);
4531 uint64_t err_ref = 0;
4532 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4533 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4534 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4535 err_ref = (uint64_t)err_var.inner & ~1;
4538 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t arg) {
4539 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
4540 CHECK(val->result_ok);
4541 LDKAnnouncementSignatures res_var = (*val->contents.result);
4542 uint64_t res_ref = 0;
4543 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4544 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4545 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4546 res_ref = (uint64_t)res_var.inner & ~1;
4549 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t arg) {
4550 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
4551 CHECK(!val->result_ok);
4552 LDKDecodeError err_var = (*val->contents.err);
4553 uint64_t err_ref = 0;
4554 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4555 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4556 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4557 err_ref = (uint64_t)err_var.inner & ~1;
4560 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t arg) {
4561 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
4562 CHECK(val->result_ok);
4563 LDKChannelReestablish res_var = (*val->contents.result);
4564 uint64_t res_ref = 0;
4565 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4566 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4567 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4568 res_ref = (uint64_t)res_var.inner & ~1;
4571 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t arg) {
4572 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
4573 CHECK(!val->result_ok);
4574 LDKDecodeError err_var = (*val->contents.err);
4575 uint64_t err_ref = 0;
4576 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4577 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4578 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4579 err_ref = (uint64_t)err_var.inner & ~1;
4582 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t arg) {
4583 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4584 CHECK(val->result_ok);
4585 LDKClosingSigned res_var = (*val->contents.result);
4586 uint64_t res_ref = 0;
4587 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4588 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4589 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4590 res_ref = (uint64_t)res_var.inner & ~1;
4593 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_err(uint32_t arg) {
4594 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4595 CHECK(!val->result_ok);
4596 LDKDecodeError err_var = (*val->contents.err);
4597 uint64_t err_ref = 0;
4598 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4599 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4600 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4601 err_ref = (uint64_t)err_var.inner & ~1;
4604 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint32_t arg) {
4605 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
4606 CHECK(val->result_ok);
4607 LDKClosingSignedFeeRange res_var = (*val->contents.result);
4608 uint64_t res_ref = 0;
4609 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4610 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4611 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4612 res_ref = (uint64_t)res_var.inner & ~1;
4615 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint32_t arg) {
4616 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
4617 CHECK(!val->result_ok);
4618 LDKDecodeError err_var = (*val->contents.err);
4619 uint64_t err_ref = 0;
4620 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4621 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4622 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4623 err_ref = (uint64_t)err_var.inner & ~1;
4626 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t arg) {
4627 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4628 CHECK(val->result_ok);
4629 LDKCommitmentSigned res_var = (*val->contents.result);
4630 uint64_t res_ref = 0;
4631 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4632 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4633 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4634 res_ref = (uint64_t)res_var.inner & ~1;
4637 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t arg) {
4638 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4639 CHECK(!val->result_ok);
4640 LDKDecodeError err_var = (*val->contents.err);
4641 uint64_t err_ref = 0;
4642 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4643 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4644 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4645 err_ref = (uint64_t)err_var.inner & ~1;
4648 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t arg) {
4649 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4650 CHECK(val->result_ok);
4651 LDKFundingCreated res_var = (*val->contents.result);
4652 uint64_t res_ref = 0;
4653 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4654 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4655 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4656 res_ref = (uint64_t)res_var.inner & ~1;
4659 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_err(uint32_t arg) {
4660 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4661 CHECK(!val->result_ok);
4662 LDKDecodeError err_var = (*val->contents.err);
4663 uint64_t err_ref = 0;
4664 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4665 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4666 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4667 err_ref = (uint64_t)err_var.inner & ~1;
4670 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_ok(uint32_t arg) {
4671 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4672 CHECK(val->result_ok);
4673 LDKFundingSigned res_var = (*val->contents.result);
4674 uint64_t res_ref = 0;
4675 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4676 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4677 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4678 res_ref = (uint64_t)res_var.inner & ~1;
4681 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_err(uint32_t arg) {
4682 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4683 CHECK(!val->result_ok);
4684 LDKDecodeError err_var = (*val->contents.err);
4685 uint64_t err_ref = 0;
4686 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4687 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4688 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4689 err_ref = (uint64_t)err_var.inner & ~1;
4692 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_ok(uint32_t arg) {
4693 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4694 CHECK(val->result_ok);
4695 LDKFundingLocked res_var = (*val->contents.result);
4696 uint64_t res_ref = 0;
4697 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4698 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4699 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4700 res_ref = (uint64_t)res_var.inner & ~1;
4703 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_err(uint32_t arg) {
4704 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4705 CHECK(!val->result_ok);
4706 LDKDecodeError err_var = (*val->contents.err);
4707 uint64_t err_ref = 0;
4708 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4709 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4710 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4711 err_ref = (uint64_t)err_var.inner & ~1;
4714 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_ok(uint32_t arg) {
4715 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4716 CHECK(val->result_ok);
4717 LDKInit res_var = (*val->contents.result);
4718 uint64_t res_ref = 0;
4719 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4720 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4721 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4722 res_ref = (uint64_t)res_var.inner & ~1;
4725 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_err(uint32_t arg) {
4726 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4727 CHECK(!val->result_ok);
4728 LDKDecodeError err_var = (*val->contents.err);
4729 uint64_t err_ref = 0;
4730 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4731 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4732 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4733 err_ref = (uint64_t)err_var.inner & ~1;
4736 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_ok(uint32_t arg) {
4737 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4738 CHECK(val->result_ok);
4739 LDKOpenChannel res_var = (*val->contents.result);
4740 uint64_t res_ref = 0;
4741 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4742 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4743 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4744 res_ref = (uint64_t)res_var.inner & ~1;
4747 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_err(uint32_t arg) {
4748 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4749 CHECK(!val->result_ok);
4750 LDKDecodeError err_var = (*val->contents.err);
4751 uint64_t err_ref = 0;
4752 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4753 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4754 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4755 err_ref = (uint64_t)err_var.inner & ~1;
4758 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t arg) {
4759 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4760 CHECK(val->result_ok);
4761 LDKRevokeAndACK res_var = (*val->contents.result);
4762 uint64_t res_ref = 0;
4763 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4764 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4765 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4766 res_ref = (uint64_t)res_var.inner & ~1;
4769 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t arg) {
4770 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4771 CHECK(!val->result_ok);
4772 LDKDecodeError err_var = (*val->contents.err);
4773 uint64_t err_ref = 0;
4774 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4775 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4776 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4777 err_ref = (uint64_t)err_var.inner & ~1;
4780 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_ok(uint32_t arg) {
4781 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4782 CHECK(val->result_ok);
4783 LDKShutdown res_var = (*val->contents.result);
4784 uint64_t res_ref = 0;
4785 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4786 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4787 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4788 res_ref = (uint64_t)res_var.inner & ~1;
4791 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_err(uint32_t arg) {
4792 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4793 CHECK(!val->result_ok);
4794 LDKDecodeError err_var = (*val->contents.err);
4795 uint64_t err_ref = 0;
4796 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4797 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4798 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4799 err_ref = (uint64_t)err_var.inner & ~1;
4802 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4803 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4804 CHECK(val->result_ok);
4805 LDKUpdateFailHTLC res_var = (*val->contents.result);
4806 uint64_t res_ref = 0;
4807 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4808 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4809 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4810 res_ref = (uint64_t)res_var.inner & ~1;
4813 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t arg) {
4814 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4815 CHECK(!val->result_ok);
4816 LDKDecodeError err_var = (*val->contents.err);
4817 uint64_t err_ref = 0;
4818 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4819 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4820 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4821 err_ref = (uint64_t)err_var.inner & ~1;
4824 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4825 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
4826 CHECK(val->result_ok);
4827 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
4828 uint64_t res_ref = 0;
4829 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4830 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4831 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4832 res_ref = (uint64_t)res_var.inner & ~1;
4835 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t arg) {
4836 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
4837 CHECK(!val->result_ok);
4838 LDKDecodeError err_var = (*val->contents.err);
4839 uint64_t err_ref = 0;
4840 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4841 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4842 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4843 err_ref = (uint64_t)err_var.inner & ~1;
4846 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t arg) {
4847 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
4848 CHECK(val->result_ok);
4849 LDKUpdateFee res_var = (*val->contents.result);
4850 uint64_t res_ref = 0;
4851 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4852 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4853 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4854 res_ref = (uint64_t)res_var.inner & ~1;
4857 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_err(uint32_t arg) {
4858 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
4859 CHECK(!val->result_ok);
4860 LDKDecodeError err_var = (*val->contents.err);
4861 uint64_t err_ref = 0;
4862 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4863 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4864 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4865 err_ref = (uint64_t)err_var.inner & ~1;
4868 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4869 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
4870 CHECK(val->result_ok);
4871 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
4872 uint64_t res_ref = 0;
4873 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4874 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4875 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4876 res_ref = (uint64_t)res_var.inner & ~1;
4879 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t arg) {
4880 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
4881 CHECK(!val->result_ok);
4882 LDKDecodeError err_var = (*val->contents.err);
4883 uint64_t err_ref = 0;
4884 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4885 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4886 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4887 err_ref = (uint64_t)err_var.inner & ~1;
4890 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4891 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
4892 CHECK(val->result_ok);
4893 LDKUpdateAddHTLC res_var = (*val->contents.result);
4894 uint64_t res_ref = 0;
4895 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4896 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4897 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4898 res_ref = (uint64_t)res_var.inner & ~1;
4901 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t arg) {
4902 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
4903 CHECK(!val->result_ok);
4904 LDKDecodeError err_var = (*val->contents.err);
4905 uint64_t err_ref = 0;
4906 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4907 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4908 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4909 err_ref = (uint64_t)err_var.inner & ~1;
4912 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_ok(uint32_t arg) {
4913 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
4914 CHECK(val->result_ok);
4915 LDKPing res_var = (*val->contents.result);
4916 uint64_t res_ref = 0;
4917 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4918 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4919 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4920 res_ref = (uint64_t)res_var.inner & ~1;
4923 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_err(uint32_t arg) {
4924 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
4925 CHECK(!val->result_ok);
4926 LDKDecodeError err_var = (*val->contents.err);
4927 uint64_t err_ref = 0;
4928 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4929 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4930 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4931 err_ref = (uint64_t)err_var.inner & ~1;
4934 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_ok(uint32_t arg) {
4935 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
4936 CHECK(val->result_ok);
4937 LDKPong res_var = (*val->contents.result);
4938 uint64_t res_ref = 0;
4939 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4940 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4941 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4942 res_ref = (uint64_t)res_var.inner & ~1;
4945 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_err(uint32_t arg) {
4946 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
4947 CHECK(!val->result_ok);
4948 LDKDecodeError err_var = (*val->contents.err);
4949 uint64_t err_ref = 0;
4950 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4951 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4952 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4953 err_ref = (uint64_t)err_var.inner & ~1;
4956 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
4957 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4958 CHECK(val->result_ok);
4959 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
4960 uint64_t res_ref = 0;
4961 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4962 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4963 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4964 res_ref = (uint64_t)res_var.inner & ~1;
4967 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
4968 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4969 CHECK(!val->result_ok);
4970 LDKDecodeError err_var = (*val->contents.err);
4971 uint64_t err_ref = 0;
4972 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4973 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4974 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4975 err_ref = (uint64_t)err_var.inner & ~1;
4978 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
4979 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4980 CHECK(val->result_ok);
4981 LDKChannelAnnouncement res_var = (*val->contents.result);
4982 uint64_t res_ref = 0;
4983 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4984 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4985 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4986 res_ref = (uint64_t)res_var.inner & ~1;
4989 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
4990 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4991 CHECK(!val->result_ok);
4992 LDKDecodeError err_var = (*val->contents.err);
4993 uint64_t err_ref = 0;
4994 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4995 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4996 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4997 err_ref = (uint64_t)err_var.inner & ~1;
5000 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
5001 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5002 CHECK(val->result_ok);
5003 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
5004 uint64_t res_ref = 0;
5005 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5006 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5007 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5008 res_ref = (uint64_t)res_var.inner & ~1;
5011 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
5012 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5013 CHECK(!val->result_ok);
5014 LDKDecodeError err_var = (*val->contents.err);
5015 uint64_t err_ref = 0;
5016 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5017 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5018 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5019 err_ref = (uint64_t)err_var.inner & ~1;
5022 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
5023 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
5024 CHECK(val->result_ok);
5025 LDKChannelUpdate res_var = (*val->contents.result);
5026 uint64_t res_ref = 0;
5027 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5028 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5029 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5030 res_ref = (uint64_t)res_var.inner & ~1;
5033 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
5034 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
5035 CHECK(!val->result_ok);
5036 LDKDecodeError err_var = (*val->contents.err);
5037 uint64_t err_ref = 0;
5038 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5039 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5040 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5041 err_ref = (uint64_t)err_var.inner & ~1;
5044 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t arg) {
5045 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
5046 CHECK(val->result_ok);
5047 LDKErrorMessage res_var = (*val->contents.result);
5048 uint64_t res_ref = 0;
5049 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5050 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5051 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5052 res_ref = (uint64_t)res_var.inner & ~1;
5055 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_err(uint32_t arg) {
5056 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
5057 CHECK(!val->result_ok);
5058 LDKDecodeError err_var = (*val->contents.err);
5059 uint64_t err_ref = 0;
5060 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5061 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5062 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5063 err_ref = (uint64_t)err_var.inner & ~1;
5066 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5067 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5068 CHECK(val->result_ok);
5069 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
5070 uint64_t res_ref = 0;
5071 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5072 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5073 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5074 res_ref = (uint64_t)res_var.inner & ~1;
5077 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5078 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5079 CHECK(!val->result_ok);
5080 LDKDecodeError err_var = (*val->contents.err);
5081 uint64_t err_ref = 0;
5082 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5083 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5084 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5085 err_ref = (uint64_t)err_var.inner & ~1;
5088 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5089 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5090 CHECK(val->result_ok);
5091 LDKNodeAnnouncement res_var = (*val->contents.result);
5092 uint64_t res_ref = 0;
5093 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5094 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5095 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5096 res_ref = (uint64_t)res_var.inner & ~1;
5099 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5100 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5101 CHECK(!val->result_ok);
5102 LDKDecodeError err_var = (*val->contents.err);
5103 uint64_t err_ref = 0;
5104 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5105 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5106 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5107 err_ref = (uint64_t)err_var.inner & ~1;
5110 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t arg) {
5111 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5112 CHECK(val->result_ok);
5113 LDKQueryShortChannelIds res_var = (*val->contents.result);
5114 uint64_t res_ref = 0;
5115 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5116 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5117 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5118 res_ref = (uint64_t)res_var.inner & ~1;
5121 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t arg) {
5122 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5123 CHECK(!val->result_ok);
5124 LDKDecodeError err_var = (*val->contents.err);
5125 uint64_t err_ref = 0;
5126 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5127 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5128 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5129 err_ref = (uint64_t)err_var.inner & ~1;
5132 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t arg) {
5133 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5134 CHECK(val->result_ok);
5135 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
5136 uint64_t res_ref = 0;
5137 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5138 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5139 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5140 res_ref = (uint64_t)res_var.inner & ~1;
5143 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t arg) {
5144 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5145 CHECK(!val->result_ok);
5146 LDKDecodeError err_var = (*val->contents.err);
5147 uint64_t err_ref = 0;
5148 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5149 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5150 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5151 err_ref = (uint64_t)err_var.inner & ~1;
5154 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
5155 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5156 CHECK(val->result_ok);
5157 LDKQueryChannelRange res_var = (*val->contents.result);
5158 uint64_t res_ref = 0;
5159 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5160 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5161 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5162 res_ref = (uint64_t)res_var.inner & ~1;
5165 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
5166 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5167 CHECK(!val->result_ok);
5168 LDKDecodeError err_var = (*val->contents.err);
5169 uint64_t err_ref = 0;
5170 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5171 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5172 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5173 err_ref = (uint64_t)err_var.inner & ~1;
5176 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
5177 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5178 CHECK(val->result_ok);
5179 LDKReplyChannelRange res_var = (*val->contents.result);
5180 uint64_t res_ref = 0;
5181 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5182 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5183 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5184 res_ref = (uint64_t)res_var.inner & ~1;
5187 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
5188 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5189 CHECK(!val->result_ok);
5190 LDKDecodeError err_var = (*val->contents.err);
5191 uint64_t err_ref = 0;
5192 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5193 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5194 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5195 err_ref = (uint64_t)err_var.inner & ~1;
5198 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t arg) {
5199 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5200 CHECK(val->result_ok);
5201 LDKGossipTimestampFilter res_var = (*val->contents.result);
5202 uint64_t res_ref = 0;
5203 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5204 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5205 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5206 res_ref = (uint64_t)res_var.inner & ~1;
5209 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t arg) {
5210 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5211 CHECK(!val->result_ok);
5212 LDKDecodeError err_var = (*val->contents.err);
5213 uint64_t err_ref = 0;
5214 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5215 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5216 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5217 err_ref = (uint64_t)err_var.inner & ~1;
5220 uint32_t __attribute__((visibility("default"))) TS_LDKSignOrCreationError_ref_from_ptr(uint32_t ptr) {
5221 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
5223 case LDKSignOrCreationError_SignError: {
5224 return 0 /* LDKSignOrCreationError - SignError */;
5226 case LDKSignOrCreationError_CreationError: {
5227 uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
5228 return 0 /* LDKSignOrCreationError - CreationError */; (void) creation_error_conv;
5233 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_get_ok(uint32_t arg) {
5234 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5235 CHECK(val->result_ok);
5236 LDKInvoice res_var = (*val->contents.result);
5237 uint64_t res_ref = 0;
5238 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5239 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5240 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5241 res_ref = (uint64_t)res_var.inner & ~1;
5244 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_get_err(uint32_t arg) {
5245 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5246 CHECK(!val->result_ok);
5247 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
5250 typedef struct LDKFilter_JCalls {
5251 atomic_size_t refcnt;
5252 uint32_t register_tx_meth;
5253 uint32_t register_output_meth;
5255 static void LDKFilter_JCalls_free(void* this_arg) {
5256 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5257 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5258 js_free(j_calls->register_tx_meth);
5259 js_free(j_calls->register_output_meth);
5263 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
5264 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5265 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5266 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
5267 LDKu8slice script_pubkey_var = script_pubkey;
5268 int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5269 memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
5270 js_invoke_function_2(j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
5272 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
5273 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5274 LDKWatchedOutput output_var = output;
5275 uint64_t output_ref = 0;
5276 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5277 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5278 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
5279 output_ref = (uint64_t)output_var.inner;
5280 if (output_var.is_owned) {
5283 uint32_t ret = js_invoke_function_1(j_calls->register_output_meth, output_ref);
5284 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
5285 CHECK_ACCESS(ret_ptr);
5286 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
5290 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
5291 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
5292 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5294 static inline LDKFilter LDKFilter_init (/*TODO: JS Object Reference */void* o) {
5295 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
5296 atomic_init(&calls->refcnt, 1);
5297 //TODO: Assign calls->o from o
5300 .this_arg = (void*) calls,
5301 .register_tx = register_tx_LDKFilter_jcall,
5302 .register_output = register_output_LDKFilter_jcall,
5303 .free = LDKFilter_JCalls_free,
5307 long __attribute__((visibility("default"))) TS_LDKFilter_new(/*TODO: JS Object Reference */void* o) {
5308 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
5309 *res_ptr = LDKFilter_init(o);
5310 return (long)res_ptr;
5312 void __attribute__((visibility("default"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
5313 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5314 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5315 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
5316 unsigned char txid_arr[32];
5317 CHECK(*((uint32_t*)txid) == 32);
5318 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
5319 unsigned char (*txid_ref)[32] = &txid_arr;
5320 LDKu8slice script_pubkey_ref;
5321 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
5322 script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
5323 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
5326 uint32_t __attribute__((visibility("default"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
5327 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5328 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5329 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
5330 LDKWatchedOutput output_conv;
5331 output_conv.inner = (void*)(output & (~1));
5332 output_conv.is_owned = (output & 1) || (output == 0);
5333 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
5334 output_conv = WatchedOutput_clone(&output_conv);
5335 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
5336 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
5337 uint64_t ret_ref = (uint64_t)ret_copy;
5341 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_FilterZ_ref_from_ptr(uint32_t ptr) {
5342 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
5344 case LDKCOption_FilterZ_Some: {
5345 LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
5346 *some_ret = obj->some;
5347 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
5348 return 0 /* LDKCOption_FilterZ - Some */; (void) (uint64_t)some_ret;
5350 case LDKCOption_FilterZ_None: {
5351 return 0 /* LDKCOption_FilterZ - None */;
5356 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_LockedChannelMonitorNoneZ_get_ok(uint32_t arg) {
5357 LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1);
5358 CHECK(val->result_ok);
5359 LDKLockedChannelMonitor res_var = (*val->contents.result);
5360 uint64_t res_ref = 0;
5361 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5362 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5363 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5364 res_ref = (uint64_t)res_var.inner & ~1;
5367 void __attribute__((visibility("default"))) TS_LDKCResult_LockedChannelMonitorNoneZ_get_err(uint32_t arg) {
5368 LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1);
5369 CHECK(!val->result_ok);
5370 return *val->contents.err;
5372 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
5373 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
5374 for (size_t i = 0; i < ret.datalen; i++) {
5375 ret.data[i] = OutPoint_clone(&orig->data[i]);
5379 typedef struct LDKMessageSendEventsProvider_JCalls {
5380 atomic_size_t refcnt;
5381 uint32_t get_and_clear_pending_msg_events_meth;
5382 } LDKMessageSendEventsProvider_JCalls;
5383 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
5384 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5385 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5386 js_free(j_calls->get_and_clear_pending_msg_events_meth);
5390 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
5391 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5392 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_events_meth);
5393 LDKCVec_MessageSendEventZ ret_constr;
5394 ret_constr.datalen = *((uint32_t*)ret);
5395 if (ret_constr.datalen > 0)
5396 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5398 ret_constr.data = NULL;
5399 uint32_t* ret_vals = (uint32_t*)(ret + 4);
5400 for (size_t s = 0; s < ret_constr.datalen; s++) {
5401 uint32_t ret_conv_18 = ret_vals[s];
5402 void* ret_conv_18_ptr = (void*)(((uint64_t)ret_conv_18) & ~1);
5403 CHECK_ACCESS(ret_conv_18_ptr);
5404 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
5405 FREE((void*)ret_conv_18);
5406 ret_constr.data[s] = ret_conv_18_conv;
5410 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
5411 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
5412 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5414 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (/*TODO: JS Object Reference */void* o) {
5415 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
5416 atomic_init(&calls->refcnt, 1);
5417 //TODO: Assign calls->o from o
5419 LDKMessageSendEventsProvider ret = {
5420 .this_arg = (void*) calls,
5421 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
5422 .free = LDKMessageSendEventsProvider_JCalls_free,
5426 long __attribute__((visibility("default"))) TS_LDKMessageSendEventsProvider_new(/*TODO: JS Object Reference */void* o) {
5427 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
5428 *res_ptr = LDKMessageSendEventsProvider_init(o);
5429 return (long)res_ptr;
5431 uint32_tArray __attribute__((visibility("default"))) TS_MessageSendEventsProvider_get_and_clear_pending_msg_events(uint32_t this_arg) {
5432 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5433 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5434 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
5435 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
5436 uint32_tArray ret_arr = NULL;
5437 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5438 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
5439 for (size_t s = 0; s < ret_var.datalen; s++) {
5440 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
5441 *ret_conv_18_copy = ret_var.data[s];
5442 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
5443 ret_arr_ptr[s] = ret_conv_18_ref;
5450 typedef struct LDKEventHandler_JCalls {
5451 atomic_size_t refcnt;
5452 uint32_t handle_event_meth;
5453 } LDKEventHandler_JCalls;
5454 static void LDKEventHandler_JCalls_free(void* this_arg) {
5455 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
5456 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5457 js_free(j_calls->handle_event_meth);
5461 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
5462 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
5463 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
5464 *ret_event = Event_clone(event);
5465 js_invoke_function_1(j_calls->handle_event_meth, (uint64_t)ret_event);
5467 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
5468 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
5469 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5471 static inline LDKEventHandler LDKEventHandler_init (/*TODO: JS Object Reference */void* o) {
5472 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
5473 atomic_init(&calls->refcnt, 1);
5474 //TODO: Assign calls->o from o
5476 LDKEventHandler ret = {
5477 .this_arg = (void*) calls,
5478 .handle_event = handle_event_LDKEventHandler_jcall,
5479 .free = LDKEventHandler_JCalls_free,
5483 long __attribute__((visibility("default"))) TS_LDKEventHandler_new(/*TODO: JS Object Reference */void* o) {
5484 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
5485 *res_ptr = LDKEventHandler_init(o);
5486 return (long)res_ptr;
5488 void __attribute__((visibility("default"))) TS_EventHandler_handle_event(uint32_t this_arg, uint32_t event) {
5489 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5490 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5491 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
5492 LDKEvent* event_conv = (LDKEvent*)event;
5493 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
5496 typedef struct LDKEventsProvider_JCalls {
5497 atomic_size_t refcnt;
5498 uint32_t process_pending_events_meth;
5499 } LDKEventsProvider_JCalls;
5500 static void LDKEventsProvider_JCalls_free(void* this_arg) {
5501 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
5502 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5503 js_free(j_calls->process_pending_events_meth);
5507 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
5508 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
5509 LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
5510 *handler_ret = handler;
5511 js_invoke_function_1(j_calls->process_pending_events_meth, (uint64_t)handler_ret);
5513 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
5514 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
5515 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5517 static inline LDKEventsProvider LDKEventsProvider_init (/*TODO: JS Object Reference */void* o) {
5518 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
5519 atomic_init(&calls->refcnt, 1);
5520 //TODO: Assign calls->o from o
5522 LDKEventsProvider ret = {
5523 .this_arg = (void*) calls,
5524 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
5525 .free = LDKEventsProvider_JCalls_free,
5529 long __attribute__((visibility("default"))) TS_LDKEventsProvider_new(/*TODO: JS Object Reference */void* o) {
5530 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
5531 *res_ptr = LDKEventsProvider_init(o);
5532 return (long)res_ptr;
5534 void __attribute__((visibility("default"))) TS_EventsProvider_process_pending_events(uint32_t this_arg, uint32_t handler) {
5535 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5536 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5537 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
5538 void* handler_ptr = (void*)(((uint64_t)handler) & ~1);
5539 CHECK_ACCESS(handler_ptr);
5540 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
5541 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
5544 typedef struct LDKListen_JCalls {
5545 atomic_size_t refcnt;
5546 uint32_t block_connected_meth;
5547 uint32_t block_disconnected_meth;
5549 static void LDKListen_JCalls_free(void* this_arg) {
5550 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
5551 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5552 js_free(j_calls->block_connected_meth);
5553 js_free(j_calls->block_disconnected_meth);
5557 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
5558 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
5559 LDKu8slice block_var = block;
5560 int8_tArray block_arr = init_arr(block_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5561 memcpy((uint8_t*)(block_arr + 4), block_var.data, block_var.datalen);
5562 js_invoke_function_2(j_calls->block_connected_meth, block_arr, height);
5564 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
5565 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
5566 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5567 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5568 js_invoke_function_2(j_calls->block_disconnected_meth, header_arr, height);
5570 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
5571 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
5572 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5574 static inline LDKListen LDKListen_init (/*TODO: JS Object Reference */void* o) {
5575 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
5576 atomic_init(&calls->refcnt, 1);
5577 //TODO: Assign calls->o from o
5580 .this_arg = (void*) calls,
5581 .block_connected = block_connected_LDKListen_jcall,
5582 .block_disconnected = block_disconnected_LDKListen_jcall,
5583 .free = LDKListen_JCalls_free,
5587 long __attribute__((visibility("default"))) TS_LDKListen_new(/*TODO: JS Object Reference */void* o) {
5588 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
5589 *res_ptr = LDKListen_init(o);
5590 return (long)res_ptr;
5592 void __attribute__((visibility("default"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
5593 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5594 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5595 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
5596 LDKu8slice block_ref;
5597 block_ref.datalen = *((uint32_t*)block);
5598 block_ref.data = (int8_t*)(block + 4);
5599 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
5602 void __attribute__((visibility("default"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
5603 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5604 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5605 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
5606 unsigned char header_arr[80];
5607 CHECK(*((uint32_t*)header) == 80);
5608 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5609 unsigned char (*header_ref)[80] = &header_arr;
5610 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
5613 typedef struct LDKConfirm_JCalls {
5614 atomic_size_t refcnt;
5615 uint32_t transactions_confirmed_meth;
5616 uint32_t transaction_unconfirmed_meth;
5617 uint32_t best_block_updated_meth;
5618 uint32_t get_relevant_txids_meth;
5619 } LDKConfirm_JCalls;
5620 static void LDKConfirm_JCalls_free(void* this_arg) {
5621 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5622 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5623 js_free(j_calls->transactions_confirmed_meth);
5624 js_free(j_calls->transaction_unconfirmed_meth);
5625 js_free(j_calls->best_block_updated_meth);
5626 js_free(j_calls->get_relevant_txids_meth);
5630 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
5631 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5632 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5633 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5634 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
5635 uint32_tArray txdata_arr = NULL;
5636 txdata_arr = init_arr(txdata_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5637 uint32_t *txdata_arr_ptr = (uint32_t*)(txdata_arr + 4);
5638 for (size_t c = 0; c < txdata_var.datalen; c++) {
5639 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5640 *txdata_conv_28_conv = txdata_var.data[c];
5641 txdata_arr_ptr[c] = ((uint64_t)txdata_conv_28_conv);
5644 FREE(txdata_var.data);
5645 js_invoke_function_3(j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
5647 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
5648 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5649 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5650 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
5651 js_invoke_function_1(j_calls->transaction_unconfirmed_meth, txid_arr);
5653 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
5654 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5655 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5656 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5657 js_invoke_function_2(j_calls->best_block_updated_meth, header_arr, height);
5659 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
5660 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5661 ptrArray ret = js_invoke_function_0(j_calls->get_relevant_txids_meth);
5662 LDKCVec_TxidZ ret_constr;
5663 ret_constr.datalen = *((uint32_t*)ret);
5664 if (ret_constr.datalen > 0)
5665 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
5667 ret_constr.data = NULL;
5668 int8_tArray* ret_vals = (int8_tArray*)(ret + 4);
5669 for (size_t m = 0; m < ret_constr.datalen; m++) {
5670 int8_tArray ret_conv_12 = ret_vals[m];
5671 LDKThirtyTwoBytes ret_conv_12_ref;
5672 CHECK(*((uint32_t*)ret_conv_12) == 32);
5673 memcpy(ret_conv_12_ref.data, (uint8_t*)(ret_conv_12 + 4), 32);
5674 ret_constr.data[m] = ret_conv_12_ref;
5678 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
5679 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
5680 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5682 static inline LDKConfirm LDKConfirm_init (/*TODO: JS Object Reference */void* o) {
5683 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
5684 atomic_init(&calls->refcnt, 1);
5685 //TODO: Assign calls->o from o
5688 .this_arg = (void*) calls,
5689 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
5690 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
5691 .best_block_updated = best_block_updated_LDKConfirm_jcall,
5692 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
5693 .free = LDKConfirm_JCalls_free,
5697 long __attribute__((visibility("default"))) TS_LDKConfirm_new(/*TODO: JS Object Reference */void* o) {
5698 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
5699 *res_ptr = LDKConfirm_init(o);
5700 return (long)res_ptr;
5702 void __attribute__((visibility("default"))) TS_Confirm_transactions_confirmed(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
5703 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5704 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5705 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
5706 unsigned char header_arr[80];
5707 CHECK(*((uint32_t*)header) == 80);
5708 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5709 unsigned char (*header_ref)[80] = &header_arr;
5710 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
5711 txdata_constr.datalen = *((uint32_t*)txdata);
5712 if (txdata_constr.datalen > 0)
5713 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5715 txdata_constr.data = NULL;
5716 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
5717 for (size_t c = 0; c < txdata_constr.datalen; c++) {
5718 uint32_t txdata_conv_28 = txdata_vals[c];
5719 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
5720 CHECK_ACCESS(txdata_conv_28_ptr);
5721 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
5722 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
5723 txdata_constr.data[c] = txdata_conv_28_conv;
5725 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
5728 void __attribute__((visibility("default"))) TS_Confirm_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid) {
5729 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5730 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5731 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
5732 unsigned char txid_arr[32];
5733 CHECK(*((uint32_t*)txid) == 32);
5734 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
5735 unsigned char (*txid_ref)[32] = &txid_arr;
5736 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
5739 void __attribute__((visibility("default"))) TS_Confirm_best_block_updated(uint32_t this_arg, int8_tArray header, int32_t height) {
5740 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5741 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5742 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
5743 unsigned char header_arr[80];
5744 CHECK(*((uint32_t*)header) == 80);
5745 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5746 unsigned char (*header_ref)[80] = &header_arr;
5747 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
5750 ptrArray __attribute__((visibility("default"))) TS_Confirm_get_relevant_txids(uint32_t this_arg) {
5751 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5752 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5753 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
5754 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
5755 ptrArray ret_arr = NULL;
5756 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
5757 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
5758 for (size_t m = 0; m < ret_var.datalen; m++) {
5759 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5760 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
5761 ret_arr_ptr[m] = ret_conv_12_arr;
5768 typedef struct LDKPersist_JCalls {
5769 atomic_size_t refcnt;
5770 uint32_t persist_new_channel_meth;
5771 uint32_t update_persisted_channel_meth;
5772 } LDKPersist_JCalls;
5773 static void LDKPersist_JCalls_free(void* this_arg) {
5774 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5775 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5776 js_free(j_calls->persist_new_channel_meth);
5777 js_free(j_calls->update_persisted_channel_meth);
5781 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
5782 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5783 LDKOutPoint channel_id_var = channel_id;
5784 uint64_t channel_id_ref = 0;
5785 CHECK((((uint64_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5786 CHECK((((uint64_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5787 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
5788 channel_id_ref = (uint64_t)channel_id_var.inner;
5789 if (channel_id_var.is_owned) {
5790 channel_id_ref |= 1;
5792 LDKChannelMonitor data_var = *data;
5793 uint64_t data_ref = 0;
5794 data_var = ChannelMonitor_clone(data);
5795 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5796 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5797 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
5798 data_ref = (uint64_t)data_var.inner;
5799 if (data_var.is_owned) {
5802 LDKMonitorUpdateId update_id_var = update_id;
5803 uint64_t update_id_ref = 0;
5804 CHECK((((uint64_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5805 CHECK((((uint64_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5806 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
5807 update_id_ref = (uint64_t)update_id_var.inner;
5808 if (update_id_var.is_owned) {
5811 uint32_t ret = js_invoke_function_3(j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
5812 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
5813 CHECK_ACCESS(ret_ptr);
5814 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5818 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
5819 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5820 LDKOutPoint channel_id_var = channel_id;
5821 uint64_t channel_id_ref = 0;
5822 CHECK((((uint64_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5823 CHECK((((uint64_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5824 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
5825 channel_id_ref = (uint64_t)channel_id_var.inner;
5826 if (channel_id_var.is_owned) {
5827 channel_id_ref |= 1;
5829 LDKChannelMonitorUpdate update_var = *update;
5830 uint64_t update_ref = 0;
5831 if ((uint64_t)update_var.inner > 4096) {
5832 update_var = ChannelMonitorUpdate_clone(update);
5833 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5834 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5835 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
5836 update_ref = (uint64_t)update_var.inner;
5837 if (update_var.is_owned) {
5841 LDKChannelMonitor data_var = *data;
5842 uint64_t data_ref = 0;
5843 data_var = ChannelMonitor_clone(data);
5844 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5845 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5846 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
5847 data_ref = (uint64_t)data_var.inner;
5848 if (data_var.is_owned) {
5851 LDKMonitorUpdateId update_id_var = update_id;
5852 uint64_t update_id_ref = 0;
5853 CHECK((((uint64_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5854 CHECK((((uint64_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5855 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
5856 update_id_ref = (uint64_t)update_id_var.inner;
5857 if (update_id_var.is_owned) {
5860 uint32_t ret = js_invoke_function_4(j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
5861 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
5862 CHECK_ACCESS(ret_ptr);
5863 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5867 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
5868 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
5869 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5871 static inline LDKPersist LDKPersist_init (/*TODO: JS Object Reference */void* o) {
5872 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
5873 atomic_init(&calls->refcnt, 1);
5874 //TODO: Assign calls->o from o
5877 .this_arg = (void*) calls,
5878 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
5879 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
5880 .free = LDKPersist_JCalls_free,
5884 long __attribute__((visibility("default"))) TS_LDKPersist_new(/*TODO: JS Object Reference */void* o) {
5885 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
5886 *res_ptr = LDKPersist_init(o);
5887 return (long)res_ptr;
5889 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) {
5890 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5891 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5892 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
5893 LDKOutPoint channel_id_conv;
5894 channel_id_conv.inner = (void*)(channel_id & (~1));
5895 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
5896 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
5897 channel_id_conv = OutPoint_clone(&channel_id_conv);
5898 LDKChannelMonitor data_conv;
5899 data_conv.inner = (void*)(data & (~1));
5900 data_conv.is_owned = false;
5901 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
5902 LDKMonitorUpdateId update_id_conv;
5903 update_id_conv.inner = (void*)(update_id & (~1));
5904 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
5905 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
5906 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
5907 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5908 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
5909 return (uint64_t)ret_conv;
5912 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) {
5913 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5914 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5915 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
5916 LDKOutPoint channel_id_conv;
5917 channel_id_conv.inner = (void*)(channel_id & (~1));
5918 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
5919 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
5920 channel_id_conv = OutPoint_clone(&channel_id_conv);
5921 LDKChannelMonitorUpdate update_conv;
5922 update_conv.inner = (void*)(update & (~1));
5923 update_conv.is_owned = false;
5924 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5925 LDKChannelMonitor data_conv;
5926 data_conv.inner = (void*)(data & (~1));
5927 data_conv.is_owned = false;
5928 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
5929 LDKMonitorUpdateId update_id_conv;
5930 update_id_conv.inner = (void*)(update_id & (~1));
5931 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
5932 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
5933 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
5934 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5935 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
5936 return (uint64_t)ret_conv;
5939 typedef struct LDKChannelMessageHandler_JCalls {
5940 atomic_size_t refcnt;
5941 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
5942 uint32_t handle_open_channel_meth;
5943 uint32_t handle_accept_channel_meth;
5944 uint32_t handle_funding_created_meth;
5945 uint32_t handle_funding_signed_meth;
5946 uint32_t handle_funding_locked_meth;
5947 uint32_t handle_shutdown_meth;
5948 uint32_t handle_closing_signed_meth;
5949 uint32_t handle_update_add_htlc_meth;
5950 uint32_t handle_update_fulfill_htlc_meth;
5951 uint32_t handle_update_fail_htlc_meth;
5952 uint32_t handle_update_fail_malformed_htlc_meth;
5953 uint32_t handle_commitment_signed_meth;
5954 uint32_t handle_revoke_and_ack_meth;
5955 uint32_t handle_update_fee_meth;
5956 uint32_t handle_announcement_signatures_meth;
5957 uint32_t peer_disconnected_meth;
5958 uint32_t peer_connected_meth;
5959 uint32_t handle_channel_reestablish_meth;
5960 uint32_t handle_channel_update_meth;
5961 uint32_t handle_error_meth;
5962 } LDKChannelMessageHandler_JCalls;
5963 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
5964 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5965 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5966 js_free(j_calls->handle_open_channel_meth);
5967 js_free(j_calls->handle_accept_channel_meth);
5968 js_free(j_calls->handle_funding_created_meth);
5969 js_free(j_calls->handle_funding_signed_meth);
5970 js_free(j_calls->handle_funding_locked_meth);
5971 js_free(j_calls->handle_shutdown_meth);
5972 js_free(j_calls->handle_closing_signed_meth);
5973 js_free(j_calls->handle_update_add_htlc_meth);
5974 js_free(j_calls->handle_update_fulfill_htlc_meth);
5975 js_free(j_calls->handle_update_fail_htlc_meth);
5976 js_free(j_calls->handle_update_fail_malformed_htlc_meth);
5977 js_free(j_calls->handle_commitment_signed_meth);
5978 js_free(j_calls->handle_revoke_and_ack_meth);
5979 js_free(j_calls->handle_update_fee_meth);
5980 js_free(j_calls->handle_announcement_signatures_meth);
5981 js_free(j_calls->peer_disconnected_meth);
5982 js_free(j_calls->peer_connected_meth);
5983 js_free(j_calls->handle_channel_reestablish_meth);
5984 js_free(j_calls->handle_channel_update_meth);
5985 js_free(j_calls->handle_error_meth);
5989 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
5990 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5991 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5992 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5993 LDKInitFeatures their_features_var = their_features;
5994 uint64_t their_features_ref = 0;
5995 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5996 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5997 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
5998 their_features_ref = (uint64_t)their_features_var.inner;
5999 if (their_features_var.is_owned) {
6000 their_features_ref |= 1;
6002 LDKOpenChannel msg_var = *msg;
6003 uint64_t msg_ref = 0;
6004 msg_var = OpenChannel_clone(msg);
6005 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6006 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6007 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6008 msg_ref = (uint64_t)msg_var.inner;
6009 if (msg_var.is_owned) {
6012 js_invoke_function_3(j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
6014 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
6015 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6016 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6017 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6018 LDKInitFeatures their_features_var = their_features;
6019 uint64_t their_features_ref = 0;
6020 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6021 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6022 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
6023 their_features_ref = (uint64_t)their_features_var.inner;
6024 if (their_features_var.is_owned) {
6025 their_features_ref |= 1;
6027 LDKAcceptChannel msg_var = *msg;
6028 uint64_t msg_ref = 0;
6029 msg_var = AcceptChannel_clone(msg);
6030 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6031 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6032 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6033 msg_ref = (uint64_t)msg_var.inner;
6034 if (msg_var.is_owned) {
6037 js_invoke_function_3(j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
6039 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
6040 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6041 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6042 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6043 LDKFundingCreated msg_var = *msg;
6044 uint64_t msg_ref = 0;
6045 msg_var = FundingCreated_clone(msg);
6046 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6047 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6048 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6049 msg_ref = (uint64_t)msg_var.inner;
6050 if (msg_var.is_owned) {
6053 js_invoke_function_2(j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
6055 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
6056 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6057 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6058 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6059 LDKFundingSigned msg_var = *msg;
6060 uint64_t msg_ref = 0;
6061 msg_var = FundingSigned_clone(msg);
6062 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6063 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6064 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6065 msg_ref = (uint64_t)msg_var.inner;
6066 if (msg_var.is_owned) {
6069 js_invoke_function_2(j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
6071 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
6072 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6073 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6074 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6075 LDKFundingLocked msg_var = *msg;
6076 uint64_t msg_ref = 0;
6077 msg_var = FundingLocked_clone(msg);
6078 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6079 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6080 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6081 msg_ref = (uint64_t)msg_var.inner;
6082 if (msg_var.is_owned) {
6085 js_invoke_function_2(j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
6087 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
6088 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6089 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6090 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6091 LDKInitFeatures their_features_var = *their_features;
6092 uint64_t their_features_ref = 0;
6093 their_features_var = InitFeatures_clone(their_features);
6094 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6095 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6096 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
6097 their_features_ref = (uint64_t)their_features_var.inner;
6098 if (their_features_var.is_owned) {
6099 their_features_ref |= 1;
6101 LDKShutdown msg_var = *msg;
6102 uint64_t msg_ref = 0;
6103 msg_var = Shutdown_clone(msg);
6104 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6105 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6106 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6107 msg_ref = (uint64_t)msg_var.inner;
6108 if (msg_var.is_owned) {
6111 js_invoke_function_3(j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
6113 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
6114 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6115 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6116 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6117 LDKClosingSigned msg_var = *msg;
6118 uint64_t msg_ref = 0;
6119 msg_var = ClosingSigned_clone(msg);
6120 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6121 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6122 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6123 msg_ref = (uint64_t)msg_var.inner;
6124 if (msg_var.is_owned) {
6127 js_invoke_function_2(j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
6129 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
6130 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6131 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6132 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6133 LDKUpdateAddHTLC msg_var = *msg;
6134 uint64_t msg_ref = 0;
6135 msg_var = UpdateAddHTLC_clone(msg);
6136 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6137 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6138 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6139 msg_ref = (uint64_t)msg_var.inner;
6140 if (msg_var.is_owned) {
6143 js_invoke_function_2(j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
6145 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
6146 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6147 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6148 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6149 LDKUpdateFulfillHTLC msg_var = *msg;
6150 uint64_t msg_ref = 0;
6151 msg_var = UpdateFulfillHTLC_clone(msg);
6152 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6153 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6154 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6155 msg_ref = (uint64_t)msg_var.inner;
6156 if (msg_var.is_owned) {
6159 js_invoke_function_2(j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
6161 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
6162 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6163 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6164 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6165 LDKUpdateFailHTLC msg_var = *msg;
6166 uint64_t msg_ref = 0;
6167 msg_var = UpdateFailHTLC_clone(msg);
6168 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6169 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6170 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6171 msg_ref = (uint64_t)msg_var.inner;
6172 if (msg_var.is_owned) {
6175 js_invoke_function_2(j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
6177 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
6178 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6179 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6180 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6181 LDKUpdateFailMalformedHTLC msg_var = *msg;
6182 uint64_t msg_ref = 0;
6183 msg_var = UpdateFailMalformedHTLC_clone(msg);
6184 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6185 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6186 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6187 msg_ref = (uint64_t)msg_var.inner;
6188 if (msg_var.is_owned) {
6191 js_invoke_function_2(j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
6193 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
6194 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6195 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6196 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6197 LDKCommitmentSigned msg_var = *msg;
6198 uint64_t msg_ref = 0;
6199 msg_var = CommitmentSigned_clone(msg);
6200 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6201 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6202 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6203 msg_ref = (uint64_t)msg_var.inner;
6204 if (msg_var.is_owned) {
6207 js_invoke_function_2(j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
6209 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
6210 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6211 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6212 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6213 LDKRevokeAndACK msg_var = *msg;
6214 uint64_t msg_ref = 0;
6215 msg_var = RevokeAndACK_clone(msg);
6216 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6217 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6218 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6219 msg_ref = (uint64_t)msg_var.inner;
6220 if (msg_var.is_owned) {
6223 js_invoke_function_2(j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
6225 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
6226 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6227 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6228 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6229 LDKUpdateFee msg_var = *msg;
6230 uint64_t msg_ref = 0;
6231 msg_var = UpdateFee_clone(msg);
6232 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6233 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6234 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6235 msg_ref = (uint64_t)msg_var.inner;
6236 if (msg_var.is_owned) {
6239 js_invoke_function_2(j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
6241 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
6242 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6243 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6244 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6245 LDKAnnouncementSignatures msg_var = *msg;
6246 uint64_t msg_ref = 0;
6247 msg_var = AnnouncementSignatures_clone(msg);
6248 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6249 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6250 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6251 msg_ref = (uint64_t)msg_var.inner;
6252 if (msg_var.is_owned) {
6255 js_invoke_function_2(j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
6257 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
6258 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6259 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6260 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6261 js_invoke_function_2(j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
6263 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
6264 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6265 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6266 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6267 LDKInit msg_var = *msg;
6268 uint64_t msg_ref = 0;
6269 msg_var = Init_clone(msg);
6270 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6271 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6272 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6273 msg_ref = (uint64_t)msg_var.inner;
6274 if (msg_var.is_owned) {
6277 js_invoke_function_2(j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
6279 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
6280 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6281 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6282 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6283 LDKChannelReestablish msg_var = *msg;
6284 uint64_t msg_ref = 0;
6285 msg_var = ChannelReestablish_clone(msg);
6286 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6287 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6288 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6289 msg_ref = (uint64_t)msg_var.inner;
6290 if (msg_var.is_owned) {
6293 js_invoke_function_2(j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
6295 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
6296 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6297 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6298 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6299 LDKChannelUpdate msg_var = *msg;
6300 uint64_t msg_ref = 0;
6301 msg_var = ChannelUpdate_clone(msg);
6302 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6303 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6304 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6305 msg_ref = (uint64_t)msg_var.inner;
6306 if (msg_var.is_owned) {
6309 js_invoke_function_2(j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
6311 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
6312 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6313 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6314 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6315 LDKErrorMessage msg_var = *msg;
6316 uint64_t msg_ref = 0;
6317 msg_var = ErrorMessage_clone(msg);
6318 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6319 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6320 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6321 msg_ref = (uint64_t)msg_var.inner;
6322 if (msg_var.is_owned) {
6325 js_invoke_function_2(j_calls->handle_error_meth, their_node_id_arr, msg_ref);
6327 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
6328 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
6329 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6330 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
6332 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
6333 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
6334 atomic_init(&calls->refcnt, 1);
6335 //TODO: Assign calls->o from o
6337 LDKChannelMessageHandler ret = {
6338 .this_arg = (void*) calls,
6339 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
6340 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
6341 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
6342 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
6343 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
6344 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
6345 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
6346 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
6347 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
6348 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
6349 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
6350 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
6351 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
6352 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
6353 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
6354 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
6355 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
6356 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
6357 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
6358 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
6359 .free = LDKChannelMessageHandler_JCalls_free,
6360 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
6362 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
6365 long __attribute__((visibility("default"))) TS_LDKChannelMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
6366 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
6367 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
6368 return (long)res_ptr;
6370 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) {
6371 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6372 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6373 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6374 LDKPublicKey their_node_id_ref;
6375 CHECK(*((uint32_t*)their_node_id) == 33);
6376 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6377 LDKInitFeatures their_features_conv;
6378 their_features_conv.inner = (void*)(their_features & (~1));
6379 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
6380 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
6381 their_features_conv = InitFeatures_clone(&their_features_conv);
6382 LDKOpenChannel msg_conv;
6383 msg_conv.inner = (void*)(msg & (~1));
6384 msg_conv.is_owned = false;
6385 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6386 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
6389 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) {
6390 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6391 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6392 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6393 LDKPublicKey their_node_id_ref;
6394 CHECK(*((uint32_t*)their_node_id) == 33);
6395 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6396 LDKInitFeatures their_features_conv;
6397 their_features_conv.inner = (void*)(their_features & (~1));
6398 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
6399 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
6400 their_features_conv = InitFeatures_clone(&their_features_conv);
6401 LDKAcceptChannel msg_conv;
6402 msg_conv.inner = (void*)(msg & (~1));
6403 msg_conv.is_owned = false;
6404 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6405 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
6408 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_created(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6409 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6410 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6411 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6412 LDKPublicKey their_node_id_ref;
6413 CHECK(*((uint32_t*)their_node_id) == 33);
6414 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6415 LDKFundingCreated msg_conv;
6416 msg_conv.inner = (void*)(msg & (~1));
6417 msg_conv.is_owned = false;
6418 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6419 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6422 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6423 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6424 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6425 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6426 LDKPublicKey their_node_id_ref;
6427 CHECK(*((uint32_t*)their_node_id) == 33);
6428 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6429 LDKFundingSigned msg_conv;
6430 msg_conv.inner = (void*)(msg & (~1));
6431 msg_conv.is_owned = false;
6432 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6433 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6436 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_locked(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6437 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6438 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6439 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6440 LDKPublicKey their_node_id_ref;
6441 CHECK(*((uint32_t*)their_node_id) == 33);
6442 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6443 LDKFundingLocked msg_conv;
6444 msg_conv.inner = (void*)(msg & (~1));
6445 msg_conv.is_owned = false;
6446 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6447 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6450 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_shutdown(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
6451 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6452 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6453 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6454 LDKPublicKey their_node_id_ref;
6455 CHECK(*((uint32_t*)their_node_id) == 33);
6456 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6457 LDKInitFeatures their_features_conv;
6458 their_features_conv.inner = (void*)(their_features & (~1));
6459 their_features_conv.is_owned = false;
6460 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
6461 LDKShutdown msg_conv;
6462 msg_conv.inner = (void*)(msg & (~1));
6463 msg_conv.is_owned = false;
6464 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6465 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
6468 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_closing_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6469 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6470 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6471 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6472 LDKPublicKey their_node_id_ref;
6473 CHECK(*((uint32_t*)their_node_id) == 33);
6474 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6475 LDKClosingSigned msg_conv;
6476 msg_conv.inner = (void*)(msg & (~1));
6477 msg_conv.is_owned = false;
6478 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6479 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6482 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_add_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6483 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6484 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6485 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6486 LDKPublicKey their_node_id_ref;
6487 CHECK(*((uint32_t*)their_node_id) == 33);
6488 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6489 LDKUpdateAddHTLC msg_conv;
6490 msg_conv.inner = (void*)(msg & (~1));
6491 msg_conv.is_owned = false;
6492 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6493 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6496 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fulfill_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6497 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6498 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6499 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6500 LDKPublicKey their_node_id_ref;
6501 CHECK(*((uint32_t*)their_node_id) == 33);
6502 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6503 LDKUpdateFulfillHTLC msg_conv;
6504 msg_conv.inner = (void*)(msg & (~1));
6505 msg_conv.is_owned = false;
6506 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6507 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6510 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6511 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6512 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6513 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6514 LDKPublicKey their_node_id_ref;
6515 CHECK(*((uint32_t*)their_node_id) == 33);
6516 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6517 LDKUpdateFailHTLC msg_conv;
6518 msg_conv.inner = (void*)(msg & (~1));
6519 msg_conv.is_owned = false;
6520 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6521 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6524 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_malformed_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6525 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6526 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6527 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6528 LDKPublicKey their_node_id_ref;
6529 CHECK(*((uint32_t*)their_node_id) == 33);
6530 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6531 LDKUpdateFailMalformedHTLC 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_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6538 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_commitment_signed(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 LDKCommitmentSigned 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_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6552 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_revoke_and_ack(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 LDKRevokeAndACK 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_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6566 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fee(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 LDKUpdateFee 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_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6580 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_announcement_signatures(uint32_t this_arg, int8_tArray their_node_id, 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 LDKAnnouncementSignatures msg_conv;
6588 msg_conv.inner = (void*)(msg & (~1));
6589 msg_conv.is_owned = false;
6590 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6591 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6594 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_disconnected(uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
6595 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6596 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6597 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6598 LDKPublicKey their_node_id_ref;
6599 CHECK(*((uint32_t*)their_node_id) == 33);
6600 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6601 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
6604 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6605 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6606 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6607 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6608 LDKPublicKey their_node_id_ref;
6609 CHECK(*((uint32_t*)their_node_id) == 33);
6610 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6612 msg_conv.inner = (void*)(msg & (~1));
6613 msg_conv.is_owned = false;
6614 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6615 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6618 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_reestablish(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6619 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6620 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6621 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6622 LDKPublicKey their_node_id_ref;
6623 CHECK(*((uint32_t*)their_node_id) == 33);
6624 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6625 LDKChannelReestablish msg_conv;
6626 msg_conv.inner = (void*)(msg & (~1));
6627 msg_conv.is_owned = false;
6628 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6629 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6632 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_update(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6633 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6634 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6635 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6636 LDKPublicKey their_node_id_ref;
6637 CHECK(*((uint32_t*)their_node_id) == 33);
6638 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6639 LDKChannelUpdate msg_conv;
6640 msg_conv.inner = (void*)(msg & (~1));
6641 msg_conv.is_owned = false;
6642 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6643 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6646 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6647 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6648 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6649 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6650 LDKPublicKey their_node_id_ref;
6651 CHECK(*((uint32_t*)their_node_id) == 33);
6652 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6653 LDKErrorMessage msg_conv;
6654 msg_conv.inner = (void*)(msg & (~1));
6655 msg_conv.is_owned = false;
6656 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6657 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6660 typedef struct LDKRoutingMessageHandler_JCalls {
6661 atomic_size_t refcnt;
6662 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
6663 uint32_t handle_node_announcement_meth;
6664 uint32_t handle_channel_announcement_meth;
6665 uint32_t handle_channel_update_meth;
6666 uint32_t get_next_channel_announcements_meth;
6667 uint32_t get_next_node_announcements_meth;
6668 uint32_t sync_routing_table_meth;
6669 uint32_t handle_reply_channel_range_meth;
6670 uint32_t handle_reply_short_channel_ids_end_meth;
6671 uint32_t handle_query_channel_range_meth;
6672 uint32_t handle_query_short_channel_ids_meth;
6673 } LDKRoutingMessageHandler_JCalls;
6674 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
6675 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6676 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6677 js_free(j_calls->handle_node_announcement_meth);
6678 js_free(j_calls->handle_channel_announcement_meth);
6679 js_free(j_calls->handle_channel_update_meth);
6680 js_free(j_calls->get_next_channel_announcements_meth);
6681 js_free(j_calls->get_next_node_announcements_meth);
6682 js_free(j_calls->sync_routing_table_meth);
6683 js_free(j_calls->handle_reply_channel_range_meth);
6684 js_free(j_calls->handle_reply_short_channel_ids_end_meth);
6685 js_free(j_calls->handle_query_channel_range_meth);
6686 js_free(j_calls->handle_query_short_channel_ids_meth);
6690 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
6691 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6692 LDKNodeAnnouncement msg_var = *msg;
6693 uint64_t msg_ref = 0;
6694 msg_var = NodeAnnouncement_clone(msg);
6695 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6696 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6697 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6698 msg_ref = (uint64_t)msg_var.inner;
6699 if (msg_var.is_owned) {
6702 uint32_t ret = js_invoke_function_1(j_calls->handle_node_announcement_meth, msg_ref);
6703 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6704 CHECK_ACCESS(ret_ptr);
6705 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
6709 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
6710 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6711 LDKChannelAnnouncement msg_var = *msg;
6712 uint64_t msg_ref = 0;
6713 msg_var = ChannelAnnouncement_clone(msg);
6714 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6715 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6716 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6717 msg_ref = (uint64_t)msg_var.inner;
6718 if (msg_var.is_owned) {
6721 uint32_t ret = js_invoke_function_1(j_calls->handle_channel_announcement_meth, msg_ref);
6722 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6723 CHECK_ACCESS(ret_ptr);
6724 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
6728 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
6729 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6730 LDKChannelUpdate msg_var = *msg;
6731 uint64_t msg_ref = 0;
6732 msg_var = ChannelUpdate_clone(msg);
6733 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6734 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6735 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6736 msg_ref = (uint64_t)msg_var.inner;
6737 if (msg_var.is_owned) {
6740 uint32_t ret = js_invoke_function_1(j_calls->handle_channel_update_meth, msg_ref);
6741 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6742 CHECK_ACCESS(ret_ptr);
6743 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
6747 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
6748 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6749 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
6750 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
6751 ret_constr.datalen = *((uint32_t*)ret);
6752 if (ret_constr.datalen > 0)
6753 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
6755 ret_constr.data = NULL;
6756 uint32_t* ret_vals = (uint32_t*)(ret + 4);
6757 for (size_t h = 0; h < ret_constr.datalen; h++) {
6758 uint32_t ret_conv_59 = ret_vals[h];
6759 void* ret_conv_59_ptr = (void*)(((uint64_t)ret_conv_59) & ~1);
6760 CHECK_ACCESS(ret_conv_59_ptr);
6761 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
6762 FREE((void*)ret_conv_59);
6763 ret_constr.data[h] = ret_conv_59_conv;
6767 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
6768 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6769 int8_tArray starting_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6770 memcpy((uint8_t*)(starting_point_arr + 4), starting_point.compressed_form, 33);
6771 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
6772 LDKCVec_NodeAnnouncementZ ret_constr;
6773 ret_constr.datalen = *((uint32_t*)ret);
6774 if (ret_constr.datalen > 0)
6775 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
6777 ret_constr.data = NULL;
6778 uint32_t* ret_vals = (uint32_t*)(ret + 4);
6779 for (size_t s = 0; s < ret_constr.datalen; s++) {
6780 uint32_t ret_conv_18 = ret_vals[s];
6781 LDKNodeAnnouncement ret_conv_18_conv;
6782 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
6783 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
6784 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
6785 ret_constr.data[s] = ret_conv_18_conv;
6789 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
6790 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6791 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6792 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6793 LDKInit init_var = *init;
6794 uint64_t init_ref = 0;
6795 init_var = Init_clone(init);
6796 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6797 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6798 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
6799 init_ref = (uint64_t)init_var.inner;
6800 if (init_var.is_owned) {
6803 js_invoke_function_2(j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
6805 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
6806 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6807 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6808 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6809 LDKReplyChannelRange msg_var = msg;
6810 uint64_t msg_ref = 0;
6811 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6812 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6813 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6814 msg_ref = (uint64_t)msg_var.inner;
6815 if (msg_var.is_owned) {
6818 uint32_t ret = js_invoke_function_2(j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
6819 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6820 CHECK_ACCESS(ret_ptr);
6821 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
6825 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
6826 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6827 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6828 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6829 LDKReplyShortChannelIdsEnd msg_var = msg;
6830 uint64_t msg_ref = 0;
6831 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6832 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6833 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6834 msg_ref = (uint64_t)msg_var.inner;
6835 if (msg_var.is_owned) {
6838 uint32_t ret = js_invoke_function_2(j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
6839 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6840 CHECK_ACCESS(ret_ptr);
6841 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
6845 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
6846 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6847 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6848 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6849 LDKQueryChannelRange msg_var = msg;
6850 uint64_t msg_ref = 0;
6851 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6852 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6853 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6854 msg_ref = (uint64_t)msg_var.inner;
6855 if (msg_var.is_owned) {
6858 uint32_t ret = js_invoke_function_2(j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
6859 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6860 CHECK_ACCESS(ret_ptr);
6861 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
6865 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
6866 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6867 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6868 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6869 LDKQueryShortChannelIds msg_var = msg;
6870 uint64_t msg_ref = 0;
6871 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6872 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6873 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6874 msg_ref = (uint64_t)msg_var.inner;
6875 if (msg_var.is_owned) {
6878 uint32_t ret = js_invoke_function_2(j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
6879 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6880 CHECK_ACCESS(ret_ptr);
6881 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
6885 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
6886 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
6887 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6888 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
6890 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
6891 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
6892 atomic_init(&calls->refcnt, 1);
6893 //TODO: Assign calls->o from o
6895 LDKRoutingMessageHandler ret = {
6896 .this_arg = (void*) calls,
6897 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
6898 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
6899 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
6900 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
6901 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
6902 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
6903 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
6904 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
6905 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
6906 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
6907 .free = LDKRoutingMessageHandler_JCalls_free,
6908 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
6910 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
6913 long __attribute__((visibility("default"))) TS_LDKRoutingMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
6914 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
6915 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
6916 return (long)res_ptr;
6918 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
6919 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6920 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6921 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
6922 LDKNodeAnnouncement msg_conv;
6923 msg_conv.inner = (void*)(msg & (~1));
6924 msg_conv.is_owned = false;
6925 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6926 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6927 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
6928 return (uint64_t)ret_conv;
6931 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
6932 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6933 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6934 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
6935 LDKChannelAnnouncement msg_conv;
6936 msg_conv.inner = (void*)(msg & (~1));
6937 msg_conv.is_owned = false;
6938 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6939 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6940 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
6941 return (uint64_t)ret_conv;
6944 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
6945 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6946 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6947 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
6948 LDKChannelUpdate msg_conv;
6949 msg_conv.inner = (void*)(msg & (~1));
6950 msg_conv.is_owned = false;
6951 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6952 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6953 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
6954 return (uint64_t)ret_conv;
6957 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_channel_announcements(uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
6958 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6959 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6960 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
6961 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
6962 uint32_tArray ret_arr = NULL;
6963 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
6964 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
6965 for (size_t h = 0; h < ret_var.datalen; h++) {
6966 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6967 *ret_conv_59_conv = ret_var.data[h];
6968 ret_arr_ptr[h] = ((uint64_t)ret_conv_59_conv);
6975 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_node_announcements(uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
6976 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6977 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6978 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
6979 LDKPublicKey starting_point_ref;
6980 CHECK(*((uint32_t*)starting_point) == 33);
6981 memcpy(starting_point_ref.compressed_form, (uint8_t*)(starting_point + 4), 33);
6982 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
6983 uint32_tArray ret_arr = NULL;
6984 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
6985 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
6986 for (size_t s = 0; s < ret_var.datalen; s++) {
6987 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
6988 uint64_t ret_conv_18_ref = 0;
6989 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6990 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6991 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
6992 ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
6993 if (ret_conv_18_var.is_owned) {
6994 ret_conv_18_ref |= 1;
6996 ret_arr_ptr[s] = ret_conv_18_ref;
7003 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_sync_routing_table(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
7004 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7005 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7006 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7007 LDKPublicKey their_node_id_ref;
7008 CHECK(*((uint32_t*)their_node_id) == 33);
7009 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7011 init_conv.inner = (void*)(init & (~1));
7012 init_conv.is_owned = false;
7013 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
7014 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
7017 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_reply_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7018 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7019 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7020 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7021 LDKPublicKey their_node_id_ref;
7022 CHECK(*((uint32_t*)their_node_id) == 33);
7023 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7024 LDKReplyChannelRange msg_conv;
7025 msg_conv.inner = (void*)(msg & (~1));
7026 msg_conv.is_owned = (msg & 1) || (msg == 0);
7027 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7028 msg_conv = ReplyChannelRange_clone(&msg_conv);
7029 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7030 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7031 return (uint64_t)ret_conv;
7034 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) {
7035 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7036 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7037 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7038 LDKPublicKey their_node_id_ref;
7039 CHECK(*((uint32_t*)their_node_id) == 33);
7040 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7041 LDKReplyShortChannelIdsEnd msg_conv;
7042 msg_conv.inner = (void*)(msg & (~1));
7043 msg_conv.is_owned = (msg & 1) || (msg == 0);
7044 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7045 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
7046 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7047 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7048 return (uint64_t)ret_conv;
7051 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7052 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7053 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7054 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7055 LDKPublicKey their_node_id_ref;
7056 CHECK(*((uint32_t*)their_node_id) == 33);
7057 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7058 LDKQueryChannelRange msg_conv;
7059 msg_conv.inner = (void*)(msg & (~1));
7060 msg_conv.is_owned = (msg & 1) || (msg == 0);
7061 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7062 msg_conv = QueryChannelRange_clone(&msg_conv);
7063 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7064 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7065 return (uint64_t)ret_conv;
7068 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_short_channel_ids(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7069 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7070 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7071 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7072 LDKPublicKey their_node_id_ref;
7073 CHECK(*((uint32_t*)their_node_id) == 33);
7074 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7075 LDKQueryShortChannelIds msg_conv;
7076 msg_conv.inner = (void*)(msg & (~1));
7077 msg_conv.is_owned = (msg & 1) || (msg == 0);
7078 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7079 msg_conv = QueryShortChannelIds_clone(&msg_conv);
7080 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7081 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7082 return (uint64_t)ret_conv;
7085 typedef struct LDKCustomMessageReader_JCalls {
7086 atomic_size_t refcnt;
7088 } LDKCustomMessageReader_JCalls;
7089 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
7090 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
7091 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7092 js_free(j_calls->read_meth);
7096 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
7097 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
7098 LDKu8slice buffer_var = buffer;
7099 int8_tArray buffer_arr = init_arr(buffer_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7100 memcpy((uint8_t*)(buffer_arr + 4), buffer_var.data, buffer_var.datalen);
7101 uint32_t ret = js_invoke_function_2(j_calls->read_meth, message_type, buffer_arr);
7102 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7103 CHECK_ACCESS(ret_ptr);
7104 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
7108 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
7109 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
7110 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7112 static inline LDKCustomMessageReader LDKCustomMessageReader_init (/*TODO: JS Object Reference */void* o) {
7113 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
7114 atomic_init(&calls->refcnt, 1);
7115 //TODO: Assign calls->o from o
7117 LDKCustomMessageReader ret = {
7118 .this_arg = (void*) calls,
7119 .read = read_LDKCustomMessageReader_jcall,
7120 .free = LDKCustomMessageReader_JCalls_free,
7124 long __attribute__((visibility("default"))) TS_LDKCustomMessageReader_new(/*TODO: JS Object Reference */void* o) {
7125 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
7126 *res_ptr = LDKCustomMessageReader_init(o);
7127 return (long)res_ptr;
7129 uint32_t __attribute__((visibility("default"))) TS_CustomMessageReader_read(uint32_t this_arg, int16_t message_type, int8_tArray buffer) {
7130 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7131 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7132 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
7133 LDKu8slice buffer_ref;
7134 buffer_ref.datalen = *((uint32_t*)buffer);
7135 buffer_ref.data = (int8_t*)(buffer + 4);
7136 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
7137 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
7138 return (uint64_t)ret_conv;
7141 typedef struct LDKCustomMessageHandler_JCalls {
7142 atomic_size_t refcnt;
7143 LDKCustomMessageReader_JCalls* CustomMessageReader;
7144 uint32_t handle_custom_message_meth;
7145 uint32_t get_and_clear_pending_msg_meth;
7146 } LDKCustomMessageHandler_JCalls;
7147 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
7148 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
7149 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7150 js_free(j_calls->handle_custom_message_meth);
7151 js_free(j_calls->get_and_clear_pending_msg_meth);
7155 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
7156 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
7157 LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
7159 int8_tArray sender_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
7160 memcpy((uint8_t*)(sender_node_id_arr + 4), sender_node_id.compressed_form, 33);
7161 uint32_t ret = js_invoke_function_2(j_calls->handle_custom_message_meth, (uint64_t)msg_ret, sender_node_id_arr);
7162 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7163 CHECK_ACCESS(ret_ptr);
7164 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
7168 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
7169 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
7170 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_meth);
7171 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
7172 ret_constr.datalen = *((uint32_t*)ret);
7173 if (ret_constr.datalen > 0)
7174 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
7176 ret_constr.data = NULL;
7177 uint32_t* ret_vals = (uint32_t*)(ret + 4);
7178 for (size_t z = 0; z < ret_constr.datalen; z++) {
7179 uint32_t ret_conv_25 = ret_vals[z];
7180 void* ret_conv_25_ptr = (void*)(((uint64_t)ret_conv_25) & ~1);
7181 CHECK_ACCESS(ret_conv_25_ptr);
7182 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
7183 FREE((void*)ret_conv_25);
7184 ret_constr.data[z] = ret_conv_25_conv;
7188 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
7189 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
7190 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7191 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
7193 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* CustomMessageReader) {
7194 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
7195 atomic_init(&calls->refcnt, 1);
7196 //TODO: Assign calls->o from o
7198 LDKCustomMessageHandler ret = {
7199 .this_arg = (void*) calls,
7200 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
7201 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
7202 .free = LDKCustomMessageHandler_JCalls_free,
7203 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
7205 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
7208 long __attribute__((visibility("default"))) TS_LDKCustomMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* CustomMessageReader) {
7209 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
7210 *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
7211 return (long)res_ptr;
7213 uint32_t __attribute__((visibility("default"))) TS_CustomMessageHandler_handle_custom_message(uint32_t this_arg, uint32_t msg, int8_tArray sender_node_id) {
7214 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7215 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7216 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
7217 void* msg_ptr = (void*)(((uint64_t)msg) & ~1);
7218 CHECK_ACCESS(msg_ptr);
7219 LDKType msg_conv = *(LDKType*)(msg_ptr);
7220 LDKPublicKey sender_node_id_ref;
7221 CHECK(*((uint32_t*)sender_node_id) == 33);
7222 memcpy(sender_node_id_ref.compressed_form, (uint8_t*)(sender_node_id + 4), 33);
7223 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7224 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
7225 return (uint64_t)ret_conv;
7228 uint32_tArray __attribute__((visibility("default"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint32_t this_arg) {
7229 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7230 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7231 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
7232 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
7233 uint32_tArray ret_arr = NULL;
7234 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
7235 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
7236 for (size_t z = 0; z < ret_var.datalen; z++) {
7237 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
7238 *ret_conv_25_conv = ret_var.data[z];
7239 ret_arr_ptr[z] = ((uint64_t)ret_conv_25_conv);
7246 typedef struct LDKSocketDescriptor_JCalls {
7247 atomic_size_t refcnt;
7248 uint32_t send_data_meth;
7249 uint32_t disconnect_socket_meth;
7252 } LDKSocketDescriptor_JCalls;
7253 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
7254 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7255 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7256 js_free(j_calls->send_data_meth);
7257 js_free(j_calls->disconnect_socket_meth);
7258 js_free(j_calls->eq_meth);
7259 js_free(j_calls->hash_meth);
7263 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
7264 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7265 LDKu8slice data_var = data;
7266 int8_tArray data_arr = init_arr(data_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7267 memcpy((uint8_t*)(data_arr + 4), data_var.data, data_var.datalen);
7268 return js_invoke_function_2(j_calls->send_data_meth, data_arr, resume_read);
7270 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
7271 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7272 js_invoke_function_0(j_calls->disconnect_socket_meth);
7274 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
7275 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7276 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
7277 *other_arg_clone = SocketDescriptor_clone(other_arg);
7278 return js_invoke_function_1(j_calls->eq_meth, (uint64_t)other_arg_clone);
7280 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
7281 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7282 return js_invoke_function_0(j_calls->hash_meth);
7284 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
7285 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
7286 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7288 static inline LDKSocketDescriptor LDKSocketDescriptor_init (/*TODO: JS Object Reference */void* o) {
7289 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
7290 atomic_init(&calls->refcnt, 1);
7291 //TODO: Assign calls->o from o
7293 LDKSocketDescriptor ret = {
7294 .this_arg = (void*) calls,
7295 .send_data = send_data_LDKSocketDescriptor_jcall,
7296 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
7297 .eq = eq_LDKSocketDescriptor_jcall,
7298 .hash = hash_LDKSocketDescriptor_jcall,
7299 .cloned = LDKSocketDescriptor_JCalls_cloned,
7300 .free = LDKSocketDescriptor_JCalls_free,
7304 long __attribute__((visibility("default"))) TS_LDKSocketDescriptor_new(/*TODO: JS Object Reference */void* o) {
7305 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
7306 *res_ptr = LDKSocketDescriptor_init(o);
7307 return (long)res_ptr;
7309 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
7310 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7311 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7312 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
7313 LDKu8slice data_ref;
7314 data_ref.datalen = *((uint32_t*)data);
7315 data_ref.data = (int8_t*)(data + 4);
7316 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
7320 void __attribute__((visibility("default"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
7321 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7322 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7323 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
7324 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
7327 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
7328 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7329 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7330 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
7331 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
7335 typedef struct LDKScore_JCalls {
7336 atomic_size_t refcnt;
7337 uint32_t channel_penalty_msat_meth;
7338 uint32_t payment_path_failed_meth;
7339 uint32_t write_meth;
7341 static void LDKScore_JCalls_free(void* this_arg) {
7342 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7343 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7344 js_free(j_calls->channel_penalty_msat_meth);
7345 js_free(j_calls->payment_path_failed_meth);
7346 js_free(j_calls->write_meth);
7350 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target) {
7351 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7352 LDKNodeId source_var = *source;
7353 uint64_t source_ref = 0;
7354 source_var = NodeId_clone(source);
7355 CHECK((((uint64_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7356 CHECK((((uint64_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7357 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
7358 source_ref = (uint64_t)source_var.inner;
7359 if (source_var.is_owned) {
7362 LDKNodeId target_var = *target;
7363 uint64_t target_ref = 0;
7364 target_var = NodeId_clone(target);
7365 CHECK((((uint64_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7366 CHECK((((uint64_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7367 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
7368 target_ref = (uint64_t)target_var.inner;
7369 if (target_var.is_owned) {
7372 return js_invoke_function_3(j_calls->channel_penalty_msat_meth, short_channel_id, source_ref, target_ref);
7374 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
7375 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7376 LDKCVec_RouteHopZ path_var = path;
7377 uint32_tArray path_arr = NULL;
7378 path_arr = init_arr(path_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
7379 uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4);
7380 for (size_t k = 0; k < path_var.datalen; k++) {
7381 LDKRouteHop path_conv_10_var = path_var.data[k];
7382 uint64_t path_conv_10_ref = 0;
7383 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7384 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7385 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
7386 path_conv_10_ref = (uint64_t)path_conv_10_var.inner;
7387 if (path_conv_10_var.is_owned) {
7388 path_conv_10_ref |= 1;
7390 path_arr_ptr[k] = path_conv_10_ref;
7393 FREE(path_var.data);
7394 js_invoke_function_2(j_calls->payment_path_failed_meth, path_arr, short_channel_id);
7396 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
7397 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7398 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
7399 LDKCVec_u8Z ret_ref;
7400 ret_ref.datalen = *((uint32_t*)ret);
7401 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
7402 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
7405 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
7406 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
7407 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7409 static inline LDKScore LDKScore_init (/*TODO: JS Object Reference */void* o) {
7410 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
7411 atomic_init(&calls->refcnt, 1);
7412 //TODO: Assign calls->o from o
7415 .this_arg = (void*) calls,
7416 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
7417 .payment_path_failed = payment_path_failed_LDKScore_jcall,
7418 .write = write_LDKScore_jcall,
7419 .free = LDKScore_JCalls_free,
7423 long __attribute__((visibility("default"))) TS_LDKScore_new(/*TODO: JS Object Reference */void* o) {
7424 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
7425 *res_ptr = LDKScore_init(o);
7426 return (long)res_ptr;
7428 int64_t __attribute__((visibility("default"))) TS_Score_channel_penalty_msat(uint32_t this_arg, int64_t short_channel_id, uint32_t source, uint32_t target) {
7429 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7430 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7431 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
7432 LDKNodeId source_conv;
7433 source_conv.inner = (void*)(source & (~1));
7434 source_conv.is_owned = false;
7435 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
7436 LDKNodeId target_conv;
7437 target_conv.inner = (void*)(target & (~1));
7438 target_conv.is_owned = false;
7439 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
7440 int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv);
7444 void __attribute__((visibility("default"))) TS_Score_payment_path_failed(uint32_t this_arg, uint32_tArray path, int64_t short_channel_id) {
7445 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7446 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7447 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
7448 LDKCVec_RouteHopZ path_constr;
7449 path_constr.datalen = *((uint32_t*)path);
7450 if (path_constr.datalen > 0)
7451 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7453 path_constr.data = NULL;
7454 uint32_t* path_vals = (uint32_t*)(path + 4);
7455 for (size_t k = 0; k < path_constr.datalen; k++) {
7456 uint32_t path_conv_10 = path_vals[k];
7457 LDKRouteHop path_conv_10_conv;
7458 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
7459 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
7460 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
7461 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
7462 path_constr.data[k] = path_conv_10_conv;
7464 (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
7467 int8_tArray __attribute__((visibility("default"))) TS_Score_write(uint32_t this_arg) {
7468 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7469 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7470 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
7471 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
7472 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7473 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
7474 CVec_u8Z_free(ret_var);
7478 typedef struct LDKChannelManagerPersister_JCalls {
7479 atomic_size_t refcnt;
7480 uint32_t persist_manager_meth;
7481 } LDKChannelManagerPersister_JCalls;
7482 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
7483 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
7484 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7485 js_free(j_calls->persist_manager_meth);
7489 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
7490 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
7491 LDKChannelManager channel_manager_var = *channel_manager;
7492 uint64_t channel_manager_ref = 0;
7493 // Warning: we may need a move here but no clone is available for LDKChannelManager
7494 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7495 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7496 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
7497 channel_manager_ref = (uint64_t)channel_manager_var.inner;
7498 if (channel_manager_var.is_owned) {
7499 channel_manager_ref |= 1;
7501 uint32_t ret = js_invoke_function_1(j_calls->persist_manager_meth, channel_manager_ref);
7502 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7503 CHECK_ACCESS(ret_ptr);
7504 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
7508 static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) {
7509 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg;
7510 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7512 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (/*TODO: JS Object Reference */void* o) {
7513 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
7514 atomic_init(&calls->refcnt, 1);
7515 //TODO: Assign calls->o from o
7517 LDKChannelManagerPersister ret = {
7518 .this_arg = (void*) calls,
7519 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
7520 .free = LDKChannelManagerPersister_JCalls_free,
7524 long __attribute__((visibility("default"))) TS_LDKChannelManagerPersister_new(/*TODO: JS Object Reference */void* o) {
7525 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
7526 *res_ptr = LDKChannelManagerPersister_init(o);
7527 return (long)res_ptr;
7529 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerPersister_persist_manager(uint32_t this_arg, uint32_t channel_manager) {
7530 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7531 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7532 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)this_arg_ptr;
7533 LDKChannelManager channel_manager_conv;
7534 channel_manager_conv.inner = (void*)(channel_manager & (~1));
7535 channel_manager_conv.is_owned = false;
7536 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
7537 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
7538 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
7539 return (uint64_t)ret_conv;
7542 uint32_t __attribute__((visibility("default"))) TS_LDKFallback_ref_from_ptr(uint32_t ptr) {
7543 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
7545 case LDKFallback_SegWitProgram: {
7546 uint8_t version_val = obj->seg_wit_program.version._0;
7547 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
7548 int8_tArray program_arr = init_arr(program_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7549 memcpy((uint8_t*)(program_arr + 4), program_var.data, program_var.datalen);
7550 return 0 /* LDKFallback - SegWitProgram */; (void) version_val; (void) program_arr;
7552 case LDKFallback_PubKeyHash: {
7553 int8_tArray pub_key_hash_arr = init_arr(20, sizeof(uint8_t), "Native int8_tArray Bytes");
7554 memcpy((uint8_t*)(pub_key_hash_arr + 4), obj->pub_key_hash.data, 20);
7555 return 0 /* LDKFallback - PubKeyHash */; (void) pub_key_hash_arr;
7557 case LDKFallback_ScriptHash: {
7558 int8_tArray script_hash_arr = init_arr(20, sizeof(uint8_t), "Native int8_tArray Bytes");
7559 memcpy((uint8_t*)(script_hash_arr + 4), obj->script_hash.data, 20);
7560 return 0 /* LDKFallback - ScriptHash */; (void) script_hash_arr;
7565 typedef struct LDKPayer_JCalls {
7566 atomic_size_t refcnt;
7567 uint32_t node_id_meth;
7568 uint32_t first_hops_meth;
7569 uint32_t send_payment_meth;
7570 uint32_t retry_payment_meth;
7572 static void LDKPayer_JCalls_free(void* this_arg) {
7573 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
7574 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7575 js_free(j_calls->node_id_meth);
7576 js_free(j_calls->first_hops_meth);
7577 js_free(j_calls->send_payment_meth);
7578 js_free(j_calls->retry_payment_meth);
7582 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
7583 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
7584 int8_tArray ret = js_invoke_function_0(j_calls->node_id_meth);
7585 LDKPublicKey ret_ref;
7586 CHECK(*((uint32_t*)ret) == 33);
7587 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
7590 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
7591 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
7592 uint32_tArray ret = js_invoke_function_0(j_calls->first_hops_meth);
7593 LDKCVec_ChannelDetailsZ ret_constr;
7594 ret_constr.datalen = *((uint32_t*)ret);
7595 if (ret_constr.datalen > 0)
7596 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7598 ret_constr.data = NULL;
7599 uint32_t* ret_vals = (uint32_t*)(ret + 4);
7600 for (size_t q = 0; q < ret_constr.datalen; q++) {
7601 uint32_t ret_conv_16 = ret_vals[q];
7602 LDKChannelDetails ret_conv_16_conv;
7603 ret_conv_16_conv.inner = (void*)(ret_conv_16 & (~1));
7604 ret_conv_16_conv.is_owned = (ret_conv_16 & 1) || (ret_conv_16 == 0);
7605 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
7606 ret_constr.data[q] = ret_conv_16_conv;
7610 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
7611 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
7612 LDKRoute route_var = *route;
7613 uint64_t route_ref = 0;
7614 route_var = Route_clone(route);
7615 CHECK((((uint64_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7616 CHECK((((uint64_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7617 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
7618 route_ref = (uint64_t)route_var.inner;
7619 if (route_var.is_owned) {
7622 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
7623 memcpy((uint8_t*)(payment_hash_arr + 4), payment_hash.data, 32);
7624 int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
7625 memcpy((uint8_t*)(payment_secret_arr + 4), payment_secret.data, 32);
7626 uint32_t ret = js_invoke_function_3(j_calls->send_payment_meth, route_ref, payment_hash_arr, payment_secret_arr);
7627 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7628 CHECK_ACCESS(ret_ptr);
7629 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
7633 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
7634 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
7635 LDKRoute route_var = *route;
7636 uint64_t route_ref = 0;
7637 route_var = Route_clone(route);
7638 CHECK((((uint64_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7639 CHECK((((uint64_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7640 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
7641 route_ref = (uint64_t)route_var.inner;
7642 if (route_var.is_owned) {
7645 int8_tArray payment_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
7646 memcpy((uint8_t*)(payment_id_arr + 4), payment_id.data, 32);
7647 uint32_t ret = js_invoke_function_2(j_calls->retry_payment_meth, route_ref, payment_id_arr);
7648 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7649 CHECK_ACCESS(ret_ptr);
7650 LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
7654 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
7655 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
7656 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7658 static inline LDKPayer LDKPayer_init (/*TODO: JS Object Reference */void* o) {
7659 LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
7660 atomic_init(&calls->refcnt, 1);
7661 //TODO: Assign calls->o from o
7664 .this_arg = (void*) calls,
7665 .node_id = node_id_LDKPayer_jcall,
7666 .first_hops = first_hops_LDKPayer_jcall,
7667 .send_payment = send_payment_LDKPayer_jcall,
7668 .retry_payment = retry_payment_LDKPayer_jcall,
7669 .free = LDKPayer_JCalls_free,
7673 long __attribute__((visibility("default"))) TS_LDKPayer_new(/*TODO: JS Object Reference */void* o) {
7674 LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
7675 *res_ptr = LDKPayer_init(o);
7676 return (long)res_ptr;
7678 int8_tArray __attribute__((visibility("default"))) TS_Payer_node_id(uint32_t this_arg) {
7679 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7680 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7681 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
7682 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
7683 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form, 33);
7687 uint32_tArray __attribute__((visibility("default"))) TS_Payer_first_hops(uint32_t this_arg) {
7688 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7689 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7690 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
7691 LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
7692 uint32_tArray ret_arr = NULL;
7693 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
7694 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
7695 for (size_t q = 0; q < ret_var.datalen; q++) {
7696 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
7697 uint64_t ret_conv_16_ref = 0;
7698 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7699 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7700 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
7701 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
7702 if (ret_conv_16_var.is_owned) {
7703 ret_conv_16_ref |= 1;
7705 ret_arr_ptr[q] = ret_conv_16_ref;
7712 uint32_t __attribute__((visibility("default"))) TS_Payer_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
7713 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7714 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7715 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
7716 LDKRoute route_conv;
7717 route_conv.inner = (void*)(route & (~1));
7718 route_conv.is_owned = false;
7719 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
7720 LDKThirtyTwoBytes payment_hash_ref;
7721 CHECK(*((uint32_t*)payment_hash) == 32);
7722 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
7723 LDKThirtyTwoBytes payment_secret_ref;
7724 CHECK(*((uint32_t*)payment_secret) == 32);
7725 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
7726 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
7727 *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
7728 return (uint64_t)ret_conv;
7731 uint32_t __attribute__((visibility("default"))) TS_Payer_retry_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_id) {
7732 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7733 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7734 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
7735 LDKRoute route_conv;
7736 route_conv.inner = (void*)(route & (~1));
7737 route_conv.is_owned = false;
7738 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
7739 LDKThirtyTwoBytes payment_id_ref;
7740 CHECK(*((uint32_t*)payment_id) == 32);
7741 memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32);
7742 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
7743 *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
7744 return (uint64_t)ret_conv;
7747 typedef struct LDKRouter_JCalls {
7748 atomic_size_t refcnt;
7749 uint32_t find_route_meth;
7751 static void LDKRouter_JCalls_free(void* this_arg) {
7752 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7753 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7754 js_free(j_calls->find_route_meth);
7758 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * params, LDKCVec_ChannelDetailsZ * first_hops, const LDKScore * scorer) {
7759 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7760 int8_tArray payer_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
7761 memcpy((uint8_t*)(payer_arr + 4), payer.compressed_form, 33);
7762 LDKRouteParameters params_var = *params;
7763 uint64_t params_ref = 0;
7764 params_var = RouteParameters_clone(params);
7765 CHECK((((uint64_t)params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7766 CHECK((((uint64_t)¶ms_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7767 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_var);
7768 params_ref = (uint64_t)params_var.inner;
7769 if (params_var.is_owned) {
7772 LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
7773 uint32_tArray first_hops_arr = NULL;
7774 if (first_hops != NULL) {
7775 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
7776 first_hops_arr = init_arr(first_hops_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
7777 uint32_t *first_hops_arr_ptr = (uint32_t*)(first_hops_arr + 4);
7778 for (size_t q = 0; q < first_hops_var.datalen; q++) {
7779 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
7780 uint64_t first_hops_conv_16_ref = 0;
7781 CHECK((((uint64_t)first_hops_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7782 CHECK((((uint64_t)&first_hops_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7783 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
7784 first_hops_conv_16_ref = (uint64_t)first_hops_conv_16_var.inner;
7785 if (first_hops_conv_16_var.is_owned) {
7786 first_hops_conv_16_ref |= 1;
7788 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
7792 // WARNING: This object doesn't live past this scope, needs clone!
7793 uint64_t ret_scorer = ((uint64_t)scorer) | 1;
7794 uint32_t ret = js_invoke_function_4(j_calls->find_route_meth, payer_arr, params_ref, first_hops_arr, ret_scorer);
7795 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7796 CHECK_ACCESS(ret_ptr);
7797 LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
7801 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
7802 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
7803 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7805 static inline LDKRouter LDKRouter_init (/*TODO: JS Object Reference */void* o) {
7806 LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
7807 atomic_init(&calls->refcnt, 1);
7808 //TODO: Assign calls->o from o
7811 .this_arg = (void*) calls,
7812 .find_route = find_route_LDKRouter_jcall,
7813 .free = LDKRouter_JCalls_free,
7817 long __attribute__((visibility("default"))) TS_LDKRouter_new(/*TODO: JS Object Reference */void* o) {
7818 LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
7819 *res_ptr = LDKRouter_init(o);
7820 return (long)res_ptr;
7822 uint32_t __attribute__((visibility("default"))) TS_Router_find_route(uint32_t this_arg, int8_tArray payer, uint32_t params, uint32_tArray first_hops, uint32_t scorer) {
7823 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7824 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7825 LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
7826 LDKPublicKey payer_ref;
7827 CHECK(*((uint32_t*)payer) == 33);
7828 memcpy(payer_ref.compressed_form, (uint8_t*)(payer + 4), 33);
7829 LDKRouteParameters params_conv;
7830 params_conv.inner = (void*)(params & (~1));
7831 params_conv.is_owned = false;
7832 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
7833 LDKCVec_ChannelDetailsZ first_hops_constr;
7834 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
7835 if (first_hops != 0) {
7836 first_hops_constr.datalen = *((uint32_t*)first_hops);
7837 if (first_hops_constr.datalen > 0)
7838 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7840 first_hops_constr.data = NULL;
7841 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
7842 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
7843 uint32_t first_hops_conv_16 = first_hops_vals[q];
7844 LDKChannelDetails first_hops_conv_16_conv;
7845 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
7846 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
7847 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
7848 first_hops_constr.data[q] = first_hops_conv_16_conv;
7850 first_hops_ptr = &first_hops_constr;
7852 void* scorer_ptr = (void*)(((uint64_t)scorer) & ~1);
7853 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
7854 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
7855 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7856 *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, ¶ms_conv, first_hops_ptr, scorer_conv);
7857 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
7858 return (uint64_t)ret_conv;
7861 jstring __attribute__((visibility("default"))) TS__ldk_get_compiled_version() {
7862 LDKStr ret_str = _ldk_get_compiled_version();
7863 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
7868 jstring __attribute__((visibility("default"))) TS__ldk_c_bindings_get_compiled_version() {
7869 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
7870 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
7875 void __attribute__((visibility("default"))) TS_Transaction_free(int8_tArray _res) {
7876 LDKTransaction _res_ref;
7877 _res_ref.datalen = *((uint32_t*)_res);
7878 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
7879 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
7880 _res_ref.data_is_owned = true;
7881 Transaction_free(_res_ref);
7884 uint32_t __attribute__((visibility("default"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
7885 LDKCVec_u8Z script_pubkey_ref;
7886 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
7887 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
7888 memcpy(script_pubkey_ref.data, (uint8_t*)(script_pubkey + 4), script_pubkey_ref.datalen);
7889 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7890 *ret_ref = TxOut_new(script_pubkey_ref, value);
7891 return (uint64_t)ret_ref;
7894 void __attribute__((visibility("default"))) TS_TxOut_free(uint32_t _res) {
7895 if ((_res & 1) != 0) return;
7896 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7897 CHECK_ACCESS(_res_ptr);
7898 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
7900 TxOut_free(_res_conv);
7903 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
7904 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7905 *ret_ref = TxOut_clone(arg);
7906 return (uint64_t)ret_ref;
7908 int64_t __attribute__((visibility("default"))) TS_TxOut_clone_ptr(uint32_t arg) {
7909 LDKTxOut* arg_conv = (LDKTxOut*)(arg & ~1);
7910 int64_t ret_val = TxOut_clone_ptr(arg_conv);
7914 uint32_t __attribute__((visibility("default"))) TS_TxOut_clone(uint32_t orig) {
7915 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
7916 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7917 *ret_ref = TxOut_clone(orig_conv);
7918 return (uint64_t)ret_ref;
7921 void __attribute__((visibility("default"))) TS_Str_free(jstring _res) {
7922 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
7926 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
7928 CHECK(*((uint32_t*)o) == 32);
7929 memcpy(o_ref.bytes, (uint8_t*)(o + 4), 32);
7930 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
7931 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
7932 return (uint64_t)ret_conv;
7935 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
7936 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
7937 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
7938 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
7939 return (uint64_t)ret_conv;
7942 jboolean __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_is_ok(uint32_t o) {
7943 LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)(o & ~1);
7944 jboolean ret_val = CResult_SecretKeyErrorZ_is_ok(o_conv);
7948 void __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
7949 if ((_res & 1) != 0) return;
7950 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7951 CHECK_ACCESS(_res_ptr);
7952 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
7954 CResult_SecretKeyErrorZ_free(_res_conv);
7957 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
7959 CHECK(*((uint32_t*)o) == 33);
7960 memcpy(o_ref.compressed_form, (uint8_t*)(o + 4), 33);
7961 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
7962 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
7963 return (uint64_t)ret_conv;
7966 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
7967 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
7968 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
7969 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
7970 return (uint64_t)ret_conv;
7973 jboolean __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_is_ok(uint32_t o) {
7974 LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)(o & ~1);
7975 jboolean ret_val = CResult_PublicKeyErrorZ_is_ok(o_conv);
7979 void __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
7980 if ((_res & 1) != 0) return;
7981 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7982 CHECK_ACCESS(_res_ptr);
7983 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
7985 CResult_PublicKeyErrorZ_free(_res_conv);
7988 static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
7989 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
7990 *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
7991 return (uint64_t)ret_conv;
7993 int64_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint32_t arg) {
7994 LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
7995 int64_t ret_val = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
7999 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_clone(uint32_t orig) {
8000 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
8001 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8002 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
8003 return (uint64_t)ret_conv;
8006 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
8007 LDKTxCreationKeys o_conv;
8008 o_conv.inner = (void*)(o & (~1));
8009 o_conv.is_owned = (o & 1) || (o == 0);
8010 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8011 o_conv = TxCreationKeys_clone(&o_conv);
8012 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8013 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
8014 return (uint64_t)ret_conv;
8017 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
8018 LDKDecodeError e_conv;
8019 e_conv.inner = (void*)(e & (~1));
8020 e_conv.is_owned = (e & 1) || (e == 0);
8021 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8022 e_conv = DecodeError_clone(&e_conv);
8023 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8024 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
8025 return (uint64_t)ret_conv;
8028 jboolean __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint32_t o) {
8029 LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(o & ~1);
8030 jboolean ret_val = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
8034 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
8035 if ((_res & 1) != 0) return;
8036 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8037 CHECK_ACCESS(_res_ptr);
8038 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
8040 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
8043 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
8044 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8045 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
8046 return (uint64_t)ret_conv;
8048 int64_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint32_t arg) {
8049 LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
8050 int64_t ret_val = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
8054 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
8055 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
8056 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8057 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
8058 return (uint64_t)ret_conv;
8061 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
8062 LDKChannelPublicKeys o_conv;
8063 o_conv.inner = (void*)(o & (~1));
8064 o_conv.is_owned = (o & 1) || (o == 0);
8065 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8066 o_conv = ChannelPublicKeys_clone(&o_conv);
8067 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8068 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
8069 return (uint64_t)ret_conv;
8072 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
8073 LDKDecodeError e_conv;
8074 e_conv.inner = (void*)(e & (~1));
8075 e_conv.is_owned = (e & 1) || (e == 0);
8076 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8077 e_conv = DecodeError_clone(&e_conv);
8078 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8079 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
8080 return (uint64_t)ret_conv;
8083 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint32_t o) {
8084 LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(o & ~1);
8085 jboolean ret_val = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
8089 void __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
8090 if ((_res & 1) != 0) return;
8091 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8092 CHECK_ACCESS(_res_ptr);
8093 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
8095 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
8098 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
8099 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8100 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
8101 return (uint64_t)ret_conv;
8103 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint32_t arg) {
8104 LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
8105 int64_t ret_val = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
8109 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
8110 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
8111 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8112 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
8113 return (uint64_t)ret_conv;
8116 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
8117 LDKTxCreationKeys o_conv;
8118 o_conv.inner = (void*)(o & (~1));
8119 o_conv.is_owned = (o & 1) || (o == 0);
8120 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8121 o_conv = TxCreationKeys_clone(&o_conv);
8122 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8123 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
8124 return (uint64_t)ret_conv;
8127 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
8128 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
8129 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8130 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
8131 return (uint64_t)ret_conv;
8134 jboolean __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_is_ok(uint32_t o) {
8135 LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)(o & ~1);
8136 jboolean ret_val = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
8140 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
8141 if ((_res & 1) != 0) return;
8142 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8143 CHECK_ACCESS(_res_ptr);
8144 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
8146 CResult_TxCreationKeysErrorZ_free(_res_conv);
8149 static inline uint64_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
8150 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8151 *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
8152 return (uint64_t)ret_conv;
8154 int64_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_clone_ptr(uint32_t arg) {
8155 LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
8156 int64_t ret_val = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
8160 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_clone(uint32_t orig) {
8161 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
8162 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8163 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
8164 return (uint64_t)ret_conv;
8167 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_some(int32_t o) {
8168 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
8169 *ret_copy = COption_u32Z_some(o);
8170 uint64_t ret_ref = (uint64_t)ret_copy;
8174 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_none() {
8175 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
8176 *ret_copy = COption_u32Z_none();
8177 uint64_t ret_ref = (uint64_t)ret_copy;
8181 void __attribute__((visibility("default"))) TS_COption_u32Z_free(uint32_t _res) {
8182 if ((_res & 1) != 0) return;
8183 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8184 CHECK_ACCESS(_res_ptr);
8185 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
8187 COption_u32Z_free(_res_conv);
8190 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
8191 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
8192 *ret_copy = COption_u32Z_clone(arg);
8193 uint64_t ret_ref = (uint64_t)ret_copy;
8196 int64_t __attribute__((visibility("default"))) TS_COption_u32Z_clone_ptr(uint32_t arg) {
8197 LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)arg;
8198 int64_t ret_val = COption_u32Z_clone_ptr(arg_conv);
8202 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_clone(uint32_t orig) {
8203 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
8204 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
8205 *ret_copy = COption_u32Z_clone(orig_conv);
8206 uint64_t ret_ref = (uint64_t)ret_copy;
8210 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
8211 LDKHTLCOutputInCommitment o_conv;
8212 o_conv.inner = (void*)(o & (~1));
8213 o_conv.is_owned = (o & 1) || (o == 0);
8214 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8215 o_conv = HTLCOutputInCommitment_clone(&o_conv);
8216 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
8217 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
8218 return (uint64_t)ret_conv;
8221 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
8222 LDKDecodeError e_conv;
8223 e_conv.inner = (void*)(e & (~1));
8224 e_conv.is_owned = (e & 1) || (e == 0);
8225 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8226 e_conv = DecodeError_clone(&e_conv);
8227 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
8228 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
8229 return (uint64_t)ret_conv;
8232 jboolean __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint32_t o) {
8233 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(o & ~1);
8234 jboolean ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
8238 void __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
8239 if ((_res & 1) != 0) return;
8240 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8241 CHECK_ACCESS(_res_ptr);
8242 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
8244 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
8247 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
8248 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
8249 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
8250 return (uint64_t)ret_conv;
8252 int64_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint32_t arg) {
8253 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
8254 int64_t ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
8258 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
8259 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
8260 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
8261 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
8262 return (uint64_t)ret_conv;
8265 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
8266 LDKCounterpartyChannelTransactionParameters o_conv;
8267 o_conv.inner = (void*)(o & (~1));
8268 o_conv.is_owned = (o & 1) || (o == 0);
8269 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8270 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
8271 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
8272 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
8273 return (uint64_t)ret_conv;
8276 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
8277 LDKDecodeError e_conv;
8278 e_conv.inner = (void*)(e & (~1));
8279 e_conv.is_owned = (e & 1) || (e == 0);
8280 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8281 e_conv = DecodeError_clone(&e_conv);
8282 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
8283 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
8284 return (uint64_t)ret_conv;
8287 jboolean __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint32_t o) {
8288 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(o & ~1);
8289 jboolean ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
8293 void __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
8294 if ((_res & 1) != 0) return;
8295 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8296 CHECK_ACCESS(_res_ptr);
8297 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
8299 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
8302 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
8303 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
8304 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
8305 return (uint64_t)ret_conv;
8307 int64_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
8308 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
8309 int64_t ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
8313 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
8314 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
8315 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
8316 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
8317 return (uint64_t)ret_conv;
8320 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
8321 LDKChannelTransactionParameters o_conv;
8322 o_conv.inner = (void*)(o & (~1));
8323 o_conv.is_owned = (o & 1) || (o == 0);
8324 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8325 o_conv = ChannelTransactionParameters_clone(&o_conv);
8326 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
8327 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
8328 return (uint64_t)ret_conv;
8331 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
8332 LDKDecodeError e_conv;
8333 e_conv.inner = (void*)(e & (~1));
8334 e_conv.is_owned = (e & 1) || (e == 0);
8335 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8336 e_conv = DecodeError_clone(&e_conv);
8337 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
8338 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
8339 return (uint64_t)ret_conv;
8342 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint32_t o) {
8343 LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(o & ~1);
8344 jboolean ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
8348 void __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
8349 if ((_res & 1) != 0) return;
8350 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8351 CHECK_ACCESS(_res_ptr);
8352 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
8354 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
8357 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
8358 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
8359 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
8360 return (uint64_t)ret_conv;
8362 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
8363 LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
8364 int64_t ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
8368 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
8369 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
8370 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
8371 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
8372 return (uint64_t)ret_conv;
8375 void __attribute__((visibility("default"))) TS_CVec_SignatureZ_free(ptrArray _res) {
8376 LDKCVec_SignatureZ _res_constr;
8377 _res_constr.datalen = *((uint32_t*)_res);
8378 if (_res_constr.datalen > 0)
8379 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8381 _res_constr.data = NULL;
8382 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
8383 for (size_t m = 0; m < _res_constr.datalen; m++) {
8384 int8_tArray _res_conv_12 = _res_vals[m];
8385 LDKSignature _res_conv_12_ref;
8386 CHECK(*((uint32_t*)_res_conv_12) == 64);
8387 memcpy(_res_conv_12_ref.compact_form, (uint8_t*)(_res_conv_12 + 4), 64);
8388 _res_constr.data[m] = _res_conv_12_ref;
8390 CVec_SignatureZ_free(_res_constr);
8393 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
8394 LDKHolderCommitmentTransaction o_conv;
8395 o_conv.inner = (void*)(o & (~1));
8396 o_conv.is_owned = (o & 1) || (o == 0);
8397 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8398 o_conv = HolderCommitmentTransaction_clone(&o_conv);
8399 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
8400 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
8401 return (uint64_t)ret_conv;
8404 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
8405 LDKDecodeError e_conv;
8406 e_conv.inner = (void*)(e & (~1));
8407 e_conv.is_owned = (e & 1) || (e == 0);
8408 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8409 e_conv = DecodeError_clone(&e_conv);
8410 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
8411 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
8412 return (uint64_t)ret_conv;
8415 jboolean __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
8416 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(o & ~1);
8417 jboolean ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
8421 void __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
8422 if ((_res & 1) != 0) return;
8423 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8424 CHECK_ACCESS(_res_ptr);
8425 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
8427 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
8430 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
8431 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
8432 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
8433 return (uint64_t)ret_conv;
8435 int64_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
8436 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
8437 int64_t ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
8441 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
8442 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
8443 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
8444 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
8445 return (uint64_t)ret_conv;
8448 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
8449 LDKBuiltCommitmentTransaction o_conv;
8450 o_conv.inner = (void*)(o & (~1));
8451 o_conv.is_owned = (o & 1) || (o == 0);
8452 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8453 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
8454 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
8455 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
8456 return (uint64_t)ret_conv;
8459 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
8460 LDKDecodeError e_conv;
8461 e_conv.inner = (void*)(e & (~1));
8462 e_conv.is_owned = (e & 1) || (e == 0);
8463 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8464 e_conv = DecodeError_clone(&e_conv);
8465 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
8466 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
8467 return (uint64_t)ret_conv;
8470 jboolean __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
8471 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(o & ~1);
8472 jboolean ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
8476 void __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
8477 if ((_res & 1) != 0) return;
8478 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8479 CHECK_ACCESS(_res_ptr);
8480 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
8482 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
8485 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
8486 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
8487 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
8488 return (uint64_t)ret_conv;
8490 int64_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
8491 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
8492 int64_t ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
8496 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
8497 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
8498 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
8499 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
8500 return (uint64_t)ret_conv;
8503 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint32_t o) {
8504 LDKTrustedClosingTransaction o_conv;
8505 o_conv.inner = (void*)(o & (~1));
8506 o_conv.is_owned = (o & 1) || (o == 0);
8507 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8508 // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction
8509 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
8510 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
8511 return (uint64_t)ret_conv;
8514 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
8515 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
8516 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
8517 return (uint64_t)ret_conv;
8520 jboolean __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint32_t o) {
8521 LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(o & ~1);
8522 jboolean ret_val = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
8526 void __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint32_t _res) {
8527 if ((_res & 1) != 0) return;
8528 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8529 CHECK_ACCESS(_res_ptr);
8530 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
8532 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
8535 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
8536 LDKCommitmentTransaction o_conv;
8537 o_conv.inner = (void*)(o & (~1));
8538 o_conv.is_owned = (o & 1) || (o == 0);
8539 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8540 o_conv = CommitmentTransaction_clone(&o_conv);
8541 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
8542 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
8543 return (uint64_t)ret_conv;
8546 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
8547 LDKDecodeError e_conv;
8548 e_conv.inner = (void*)(e & (~1));
8549 e_conv.is_owned = (e & 1) || (e == 0);
8550 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8551 e_conv = DecodeError_clone(&e_conv);
8552 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
8553 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
8554 return (uint64_t)ret_conv;
8557 jboolean __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
8558 LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(o & ~1);
8559 jboolean ret_val = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
8563 void __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
8564 if ((_res & 1) != 0) return;
8565 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8566 CHECK_ACCESS(_res_ptr);
8567 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
8569 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
8572 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
8573 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
8574 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
8575 return (uint64_t)ret_conv;
8577 int64_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
8578 LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
8579 int64_t ret_val = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
8583 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
8584 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
8585 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
8586 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
8587 return (uint64_t)ret_conv;
8590 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
8591 LDKTrustedCommitmentTransaction o_conv;
8592 o_conv.inner = (void*)(o & (~1));
8593 o_conv.is_owned = (o & 1) || (o == 0);
8594 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8595 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
8596 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
8597 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
8598 return (uint64_t)ret_conv;
8601 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
8602 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
8603 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
8604 return (uint64_t)ret_conv;
8607 jboolean __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint32_t o) {
8608 LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(o & ~1);
8609 jboolean ret_val = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
8613 void __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
8614 if ((_res & 1) != 0) return;
8615 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8616 CHECK_ACCESS(_res_ptr);
8617 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
8619 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
8622 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
8623 LDKCVec_SignatureZ o_constr;
8624 o_constr.datalen = *((uint32_t*)o);
8625 if (o_constr.datalen > 0)
8626 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8628 o_constr.data = NULL;
8629 int8_tArray* o_vals = (int8_tArray*)(o + 4);
8630 for (size_t m = 0; m < o_constr.datalen; m++) {
8631 int8_tArray o_conv_12 = o_vals[m];
8632 LDKSignature o_conv_12_ref;
8633 CHECK(*((uint32_t*)o_conv_12) == 64);
8634 memcpy(o_conv_12_ref.compact_form, (uint8_t*)(o_conv_12 + 4), 64);
8635 o_constr.data[m] = o_conv_12_ref;
8637 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
8638 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
8639 return (uint64_t)ret_conv;
8642 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_err() {
8643 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
8644 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
8645 return (uint64_t)ret_conv;
8648 jboolean __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_is_ok(uint32_t o) {
8649 LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)(o & ~1);
8650 jboolean ret_val = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
8654 void __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
8655 if ((_res & 1) != 0) return;
8656 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8657 CHECK_ACCESS(_res_ptr);
8658 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
8660 CResult_CVec_SignatureZNoneZ_free(_res_conv);
8663 static inline uint64_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
8664 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
8665 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
8666 return (uint64_t)ret_conv;
8668 int64_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_clone_ptr(uint32_t arg) {
8669 LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
8670 int64_t ret_val = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
8674 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
8675 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
8676 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
8677 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
8678 return (uint64_t)ret_conv;
8681 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint32_t o) {
8682 LDKShutdownScript o_conv;
8683 o_conv.inner = (void*)(o & (~1));
8684 o_conv.is_owned = (o & 1) || (o == 0);
8685 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8686 o_conv = ShutdownScript_clone(&o_conv);
8687 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
8688 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
8689 return (uint64_t)ret_conv;
8692 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint32_t e) {
8693 LDKDecodeError e_conv;
8694 e_conv.inner = (void*)(e & (~1));
8695 e_conv.is_owned = (e & 1) || (e == 0);
8696 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8697 e_conv = DecodeError_clone(&e_conv);
8698 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
8699 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
8700 return (uint64_t)ret_conv;
8703 jboolean __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint32_t o) {
8704 LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(o & ~1);
8705 jboolean ret_val = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
8709 void __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint32_t _res) {
8710 if ((_res & 1) != 0) return;
8711 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8712 CHECK_ACCESS(_res_ptr);
8713 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
8715 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
8718 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
8719 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
8720 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
8721 return (uint64_t)ret_conv;
8723 int64_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint32_t arg) {
8724 LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
8725 int64_t ret_val = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
8729 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint32_t orig) {
8730 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
8731 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
8732 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
8733 return (uint64_t)ret_conv;
8736 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint32_t o) {
8737 LDKShutdownScript o_conv;
8738 o_conv.inner = (void*)(o & (~1));
8739 o_conv.is_owned = (o & 1) || (o == 0);
8740 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8741 o_conv = ShutdownScript_clone(&o_conv);
8742 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
8743 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
8744 return (uint64_t)ret_conv;
8747 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint32_t e) {
8748 LDKInvalidShutdownScript e_conv;
8749 e_conv.inner = (void*)(e & (~1));
8750 e_conv.is_owned = (e & 1) || (e == 0);
8751 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8752 e_conv = InvalidShutdownScript_clone(&e_conv);
8753 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
8754 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
8755 return (uint64_t)ret_conv;
8758 jboolean __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint32_t o) {
8759 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(o & ~1);
8760 jboolean ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
8764 void __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint32_t _res) {
8765 if ((_res & 1) != 0) return;
8766 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8767 CHECK_ACCESS(_res_ptr);
8768 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
8770 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
8773 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
8774 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
8775 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
8776 return (uint64_t)ret_conv;
8778 int64_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint32_t arg) {
8779 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
8780 int64_t ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
8784 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint32_t orig) {
8785 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
8786 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
8787 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
8788 return (uint64_t)ret_conv;
8791 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_ok() {
8792 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8793 *ret_conv = CResult_NoneErrorZ_ok();
8794 return (uint64_t)ret_conv;
8797 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
8798 LDKIOError e_conv = LDKIOError_from_js(e);
8799 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8800 *ret_conv = CResult_NoneErrorZ_err(e_conv);
8801 return (uint64_t)ret_conv;
8804 jboolean __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_is_ok(uint32_t o) {
8805 LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)(o & ~1);
8806 jboolean ret_val = CResult_NoneErrorZ_is_ok(o_conv);
8810 void __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_free(uint32_t _res) {
8811 if ((_res & 1) != 0) return;
8812 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8813 CHECK_ACCESS(_res_ptr);
8814 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
8816 CResult_NoneErrorZ_free(_res_conv);
8819 static inline uint64_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
8820 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8821 *ret_conv = CResult_NoneErrorZ_clone(arg);
8822 return (uint64_t)ret_conv;
8824 int64_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_clone_ptr(uint32_t arg) {
8825 LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)(arg & ~1);
8826 int64_t ret_val = CResult_NoneErrorZ_clone_ptr(arg_conv);
8830 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_clone(uint32_t orig) {
8831 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
8832 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8833 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
8834 return (uint64_t)ret_conv;
8837 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint32_t o) {
8839 o_conv.inner = (void*)(o & (~1));
8840 o_conv.is_owned = (o & 1) || (o == 0);
8841 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8842 o_conv = RouteHop_clone(&o_conv);
8843 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
8844 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
8845 return (uint64_t)ret_conv;
8848 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_err(uint32_t e) {
8849 LDKDecodeError e_conv;
8850 e_conv.inner = (void*)(e & (~1));
8851 e_conv.is_owned = (e & 1) || (e == 0);
8852 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8853 e_conv = DecodeError_clone(&e_conv);
8854 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
8855 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
8856 return (uint64_t)ret_conv;
8859 jboolean __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint32_t o) {
8860 LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)(o & ~1);
8861 jboolean ret_val = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
8865 void __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_free(uint32_t _res) {
8866 if ((_res & 1) != 0) return;
8867 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8868 CHECK_ACCESS(_res_ptr);
8869 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
8871 CResult_RouteHopDecodeErrorZ_free(_res_conv);
8874 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
8875 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
8876 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
8877 return (uint64_t)ret_conv;
8879 int64_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint32_t arg) {
8880 LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
8881 int64_t ret_val = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
8885 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint32_t orig) {
8886 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
8887 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
8888 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
8889 return (uint64_t)ret_conv;
8892 void __attribute__((visibility("default"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
8893 LDKCVec_RouteHopZ _res_constr;
8894 _res_constr.datalen = *((uint32_t*)_res);
8895 if (_res_constr.datalen > 0)
8896 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8898 _res_constr.data = NULL;
8899 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8900 for (size_t k = 0; k < _res_constr.datalen; k++) {
8901 uint32_t _res_conv_10 = _res_vals[k];
8902 LDKRouteHop _res_conv_10_conv;
8903 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
8904 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
8905 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
8906 _res_constr.data[k] = _res_conv_10_conv;
8908 CVec_RouteHopZ_free(_res_constr);
8911 void __attribute__((visibility("default"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
8912 LDKCVec_CVec_RouteHopZZ _res_constr;
8913 _res_constr.datalen = *((uint32_t*)_res);
8914 if (_res_constr.datalen > 0)
8915 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
8917 _res_constr.data = NULL;
8918 uint32_tArray* _res_vals = (uint32_tArray*)(_res + 4);
8919 for (size_t m = 0; m < _res_constr.datalen; m++) {
8920 uint32_tArray _res_conv_12 = _res_vals[m];
8921 LDKCVec_RouteHopZ _res_conv_12_constr;
8922 _res_conv_12_constr.datalen = *((uint32_t*)_res_conv_12);
8923 if (_res_conv_12_constr.datalen > 0)
8924 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8926 _res_conv_12_constr.data = NULL;
8927 uint32_t* _res_conv_12_vals = (uint32_t*)(_res_conv_12 + 4);
8928 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
8929 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
8930 LDKRouteHop _res_conv_12_conv_10_conv;
8931 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
8932 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
8933 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
8934 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
8936 _res_constr.data[m] = _res_conv_12_constr;
8938 CVec_CVec_RouteHopZZ_free(_res_constr);
8941 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
8943 o_conv.inner = (void*)(o & (~1));
8944 o_conv.is_owned = (o & 1) || (o == 0);
8945 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8946 o_conv = Route_clone(&o_conv);
8947 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8948 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
8949 return (uint64_t)ret_conv;
8952 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
8953 LDKDecodeError e_conv;
8954 e_conv.inner = (void*)(e & (~1));
8955 e_conv.is_owned = (e & 1) || (e == 0);
8956 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8957 e_conv = DecodeError_clone(&e_conv);
8958 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8959 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
8960 return (uint64_t)ret_conv;
8963 jboolean __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint32_t o) {
8964 LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)(o & ~1);
8965 jboolean ret_val = CResult_RouteDecodeErrorZ_is_ok(o_conv);
8969 void __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_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_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
8975 CResult_RouteDecodeErrorZ_free(_res_conv);
8978 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
8979 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8980 *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
8981 return (uint64_t)ret_conv;
8983 int64_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint32_t arg) {
8984 LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
8985 int64_t ret_val = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
8989 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
8990 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
8991 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8992 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
8993 return (uint64_t)ret_conv;
8996 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint32_t o) {
8997 LDKRouteParameters 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 = RouteParameters_clone(&o_conv);
9002 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
9003 *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
9004 return (uint64_t)ret_conv;
9007 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_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_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
9014 *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
9015 return (uint64_t)ret_conv;
9018 jboolean __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint32_t o) {
9019 LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(o & ~1);
9020 jboolean ret_val = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
9024 void __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_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_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
9030 CResult_RouteParametersDecodeErrorZ_free(_res_conv);
9033 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
9034 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
9035 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
9036 return (uint64_t)ret_conv;
9038 int64_t __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
9039 LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
9040 int64_t ret_val = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
9044 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint32_t orig) {
9045 LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(orig & ~1);
9046 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
9047 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
9048 return (uint64_t)ret_conv;
9051 void __attribute__((visibility("default"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
9052 LDKCVec_RouteHintZ _res_constr;
9053 _res_constr.datalen = *((uint32_t*)_res);
9054 if (_res_constr.datalen > 0)
9055 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
9057 _res_constr.data = NULL;
9058 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9059 for (size_t l = 0; l < _res_constr.datalen; l++) {
9060 uint32_t _res_conv_11 = _res_vals[l];
9061 LDKRouteHint _res_conv_11_conv;
9062 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
9063 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
9064 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
9065 _res_constr.data[l] = _res_conv_11_conv;
9067 CVec_RouteHintZ_free(_res_constr);
9070 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_some(int64_t o) {
9071 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9072 *ret_copy = COption_u64Z_some(o);
9073 uint64_t ret_ref = (uint64_t)ret_copy;
9077 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_none() {
9078 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9079 *ret_copy = COption_u64Z_none();
9080 uint64_t ret_ref = (uint64_t)ret_copy;
9084 void __attribute__((visibility("default"))) TS_COption_u64Z_free(uint32_t _res) {
9085 if ((_res & 1) != 0) return;
9086 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9087 CHECK_ACCESS(_res_ptr);
9088 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
9090 COption_u64Z_free(_res_conv);
9093 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
9094 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9095 *ret_copy = COption_u64Z_clone(arg);
9096 uint64_t ret_ref = (uint64_t)ret_copy;
9099 int64_t __attribute__((visibility("default"))) TS_COption_u64Z_clone_ptr(uint32_t arg) {
9100 LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)arg;
9101 int64_t ret_val = COption_u64Z_clone_ptr(arg_conv);
9105 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_clone(uint32_t orig) {
9106 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
9107 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9108 *ret_copy = COption_u64Z_clone(orig_conv);
9109 uint64_t ret_ref = (uint64_t)ret_copy;
9113 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_ok(uint32_t o) {
9115 o_conv.inner = (void*)(o & (~1));
9116 o_conv.is_owned = (o & 1) || (o == 0);
9117 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9118 o_conv = Payee_clone(&o_conv);
9119 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
9120 *ret_conv = CResult_PayeeDecodeErrorZ_ok(o_conv);
9121 return (uint64_t)ret_conv;
9124 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_err(uint32_t e) {
9125 LDKDecodeError e_conv;
9126 e_conv.inner = (void*)(e & (~1));
9127 e_conv.is_owned = (e & 1) || (e == 0);
9128 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9129 e_conv = DecodeError_clone(&e_conv);
9130 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
9131 *ret_conv = CResult_PayeeDecodeErrorZ_err(e_conv);
9132 return (uint64_t)ret_conv;
9135 jboolean __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_is_ok(uint32_t o) {
9136 LDKCResult_PayeeDecodeErrorZ* o_conv = (LDKCResult_PayeeDecodeErrorZ*)(o & ~1);
9137 jboolean ret_val = CResult_PayeeDecodeErrorZ_is_ok(o_conv);
9141 void __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_free(uint32_t _res) {
9142 if ((_res & 1) != 0) return;
9143 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9144 CHECK_ACCESS(_res_ptr);
9145 LDKCResult_PayeeDecodeErrorZ _res_conv = *(LDKCResult_PayeeDecodeErrorZ*)(_res_ptr);
9147 CResult_PayeeDecodeErrorZ_free(_res_conv);
9150 static inline uint64_t CResult_PayeeDecodeErrorZ_clone_ptr(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR arg) {
9151 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
9152 *ret_conv = CResult_PayeeDecodeErrorZ_clone(arg);
9153 return (uint64_t)ret_conv;
9155 int64_t __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_clone_ptr(uint32_t arg) {
9156 LDKCResult_PayeeDecodeErrorZ* arg_conv = (LDKCResult_PayeeDecodeErrorZ*)(arg & ~1);
9157 int64_t ret_val = CResult_PayeeDecodeErrorZ_clone_ptr(arg_conv);
9161 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_clone(uint32_t orig) {
9162 LDKCResult_PayeeDecodeErrorZ* orig_conv = (LDKCResult_PayeeDecodeErrorZ*)(orig & ~1);
9163 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
9164 *ret_conv = CResult_PayeeDecodeErrorZ_clone(orig_conv);
9165 return (uint64_t)ret_conv;
9168 void __attribute__((visibility("default"))) TS_CVec_RouteHintHopZ_free(uint32_tArray _res) {
9169 LDKCVec_RouteHintHopZ _res_constr;
9170 _res_constr.datalen = *((uint32_t*)_res);
9171 if (_res_constr.datalen > 0)
9172 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
9174 _res_constr.data = NULL;
9175 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9176 for (size_t o = 0; o < _res_constr.datalen; o++) {
9177 uint32_t _res_conv_14 = _res_vals[o];
9178 LDKRouteHintHop _res_conv_14_conv;
9179 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
9180 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
9181 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
9182 _res_constr.data[o] = _res_conv_14_conv;
9184 CVec_RouteHintHopZ_free(_res_constr);
9187 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint32_t o) {
9188 LDKRouteHint o_conv;
9189 o_conv.inner = (void*)(o & (~1));
9190 o_conv.is_owned = (o & 1) || (o == 0);
9191 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9192 o_conv = RouteHint_clone(&o_conv);
9193 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
9194 *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
9195 return (uint64_t)ret_conv;
9198 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_err(uint32_t e) {
9199 LDKDecodeError e_conv;
9200 e_conv.inner = (void*)(e & (~1));
9201 e_conv.is_owned = (e & 1) || (e == 0);
9202 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9203 e_conv = DecodeError_clone(&e_conv);
9204 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
9205 *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
9206 return (uint64_t)ret_conv;
9209 jboolean __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint32_t o) {
9210 LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)(o & ~1);
9211 jboolean ret_val = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
9215 void __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_free(uint32_t _res) {
9216 if ((_res & 1) != 0) return;
9217 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9218 CHECK_ACCESS(_res_ptr);
9219 LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
9221 CResult_RouteHintDecodeErrorZ_free(_res_conv);
9224 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
9225 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
9226 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
9227 return (uint64_t)ret_conv;
9229 int64_t __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint32_t arg) {
9230 LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
9231 int64_t ret_val = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
9235 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint32_t orig) {
9236 LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)(orig & ~1);
9237 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
9238 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
9239 return (uint64_t)ret_conv;
9242 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint32_t o) {
9243 LDKRouteHintHop o_conv;
9244 o_conv.inner = (void*)(o & (~1));
9245 o_conv.is_owned = (o & 1) || (o == 0);
9246 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9247 o_conv = RouteHintHop_clone(&o_conv);
9248 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
9249 *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
9250 return (uint64_t)ret_conv;
9253 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint32_t e) {
9254 LDKDecodeError e_conv;
9255 e_conv.inner = (void*)(e & (~1));
9256 e_conv.is_owned = (e & 1) || (e == 0);
9257 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9258 e_conv = DecodeError_clone(&e_conv);
9259 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
9260 *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
9261 return (uint64_t)ret_conv;
9264 jboolean __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint32_t o) {
9265 LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(o & ~1);
9266 jboolean ret_val = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
9270 void __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint32_t _res) {
9271 if ((_res & 1) != 0) return;
9272 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9273 CHECK_ACCESS(_res_ptr);
9274 LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
9276 CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
9279 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
9280 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
9281 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
9282 return (uint64_t)ret_conv;
9284 int64_t __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint32_t arg) {
9285 LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
9286 int64_t ret_val = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
9290 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint32_t orig) {
9291 LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(orig & ~1);
9292 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
9293 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
9294 return (uint64_t)ret_conv;
9297 void __attribute__((visibility("default"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
9298 LDKCVec_ChannelDetailsZ _res_constr;
9299 _res_constr.datalen = *((uint32_t*)_res);
9300 if (_res_constr.datalen > 0)
9301 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
9303 _res_constr.data = NULL;
9304 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9305 for (size_t q = 0; q < _res_constr.datalen; q++) {
9306 uint32_t _res_conv_16 = _res_vals[q];
9307 LDKChannelDetails _res_conv_16_conv;
9308 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
9309 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
9310 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
9311 _res_constr.data[q] = _res_conv_16_conv;
9313 CVec_ChannelDetailsZ_free(_res_constr);
9316 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
9318 o_conv.inner = (void*)(o & (~1));
9319 o_conv.is_owned = (o & 1) || (o == 0);
9320 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9321 o_conv = Route_clone(&o_conv);
9322 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9323 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
9324 return (uint64_t)ret_conv;
9327 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
9328 LDKLightningError e_conv;
9329 e_conv.inner = (void*)(e & (~1));
9330 e_conv.is_owned = (e & 1) || (e == 0);
9331 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9332 e_conv = LightningError_clone(&e_conv);
9333 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9334 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
9335 return (uint64_t)ret_conv;
9338 jboolean __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_is_ok(uint32_t o) {
9339 LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)(o & ~1);
9340 jboolean ret_val = CResult_RouteLightningErrorZ_is_ok(o_conv);
9344 void __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
9345 if ((_res & 1) != 0) return;
9346 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9347 CHECK_ACCESS(_res_ptr);
9348 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
9350 CResult_RouteLightningErrorZ_free(_res_conv);
9353 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
9354 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9355 *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
9356 return (uint64_t)ret_conv;
9358 int64_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint32_t arg) {
9359 LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
9360 int64_t ret_val = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
9364 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
9365 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
9366 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9367 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
9368 return (uint64_t)ret_conv;
9371 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
9372 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9373 CHECK_ACCESS(o_ptr);
9374 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
9375 o_conv = TxOut_clone((LDKTxOut*)(((uint64_t)o) & ~1));
9376 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9377 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
9378 return (uint64_t)ret_conv;
9381 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
9382 LDKAccessError e_conv = LDKAccessError_from_js(e);
9383 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9384 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
9385 return (uint64_t)ret_conv;
9388 jboolean __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_is_ok(uint32_t o) {
9389 LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)(o & ~1);
9390 jboolean ret_val = CResult_TxOutAccessErrorZ_is_ok(o_conv);
9394 void __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
9395 if ((_res & 1) != 0) return;
9396 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9397 CHECK_ACCESS(_res_ptr);
9398 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
9400 CResult_TxOutAccessErrorZ_free(_res_conv);
9403 static inline uint64_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
9404 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9405 *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
9406 return (uint64_t)ret_conv;
9408 int64_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_clone_ptr(uint32_t arg) {
9409 LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
9410 int64_t ret_val = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
9414 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
9415 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
9416 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9417 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
9418 return (uint64_t)ret_conv;
9421 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
9422 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9423 *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
9424 return ((uint64_t)ret_conv);
9426 int64_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint32_t arg) {
9427 LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)(arg & ~1);
9428 int64_t ret_val = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
9432 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_clone(uint32_t orig) {
9433 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
9434 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9435 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
9436 return ((uint64_t)ret_conv);
9439 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
9440 LDKTransaction b_ref;
9441 b_ref.datalen = *((uint32_t*)b);
9442 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
9443 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
9444 b_ref.data_is_owned = true;
9445 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9446 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
9447 return ((uint64_t)ret_conv);
9450 void __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
9451 if ((_res & 1) != 0) return;
9452 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9453 CHECK_ACCESS(_res_ptr);
9454 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
9456 C2Tuple_usizeTransactionZ_free(_res_conv);
9459 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
9460 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
9461 _res_constr.datalen = *((uint32_t*)_res);
9462 if (_res_constr.datalen > 0)
9463 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9465 _res_constr.data = NULL;
9466 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9467 for (size_t c = 0; c < _res_constr.datalen; c++) {
9468 uint32_t _res_conv_28 = _res_vals[c];
9469 void* _res_conv_28_ptr = (void*)(((uint64_t)_res_conv_28) & ~1);
9470 CHECK_ACCESS(_res_conv_28_ptr);
9471 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
9472 FREE((void*)_res_conv_28);
9473 _res_constr.data[c] = _res_conv_28_conv;
9475 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
9478 void __attribute__((visibility("default"))) TS_CVec_TxidZ_free(ptrArray _res) {
9479 LDKCVec_TxidZ _res_constr;
9480 _res_constr.datalen = *((uint32_t*)_res);
9481 if (_res_constr.datalen > 0)
9482 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
9484 _res_constr.data = NULL;
9485 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
9486 for (size_t m = 0; m < _res_constr.datalen; m++) {
9487 int8_tArray _res_conv_12 = _res_vals[m];
9488 LDKThirtyTwoBytes _res_conv_12_ref;
9489 CHECK(*((uint32_t*)_res_conv_12) == 32);
9490 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), 32);
9491 _res_constr.data[m] = _res_conv_12_ref;
9493 CVec_TxidZ_free(_res_constr);
9496 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
9497 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9498 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
9499 return (uint64_t)ret_conv;
9502 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
9503 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
9504 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9505 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
9506 return (uint64_t)ret_conv;
9509 jboolean __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok(uint32_t o) {
9510 LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(o & ~1);
9511 jboolean ret_val = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
9515 void __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
9516 if ((_res & 1) != 0) return;
9517 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9518 CHECK_ACCESS(_res_ptr);
9519 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
9521 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
9524 static inline uint64_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
9525 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9526 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
9527 return (uint64_t)ret_conv;
9529 int64_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(uint32_t arg) {
9530 LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
9531 int64_t ret_val = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
9535 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
9536 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
9537 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9538 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
9539 return (uint64_t)ret_conv;
9542 void __attribute__((visibility("default"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
9543 LDKCVec_MonitorEventZ _res_constr;
9544 _res_constr.datalen = *((uint32_t*)_res);
9545 if (_res_constr.datalen > 0)
9546 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
9548 _res_constr.data = NULL;
9549 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9550 for (size_t o = 0; o < _res_constr.datalen; o++) {
9551 uint32_t _res_conv_14 = _res_vals[o];
9552 void* _res_conv_14_ptr = (void*)(((uint64_t)_res_conv_14) & ~1);
9553 CHECK_ACCESS(_res_conv_14_ptr);
9554 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
9555 FREE((void*)_res_conv_14);
9556 _res_constr.data[o] = _res_conv_14_conv;
9558 CVec_MonitorEventZ_free(_res_constr);
9561 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
9562 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9563 CHECK_ACCESS(o_ptr);
9564 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
9565 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1));
9566 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9567 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
9568 uint64_t ret_ref = (uint64_t)ret_copy;
9572 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
9573 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9574 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
9575 uint64_t ret_ref = (uint64_t)ret_copy;
9579 void __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint32_t _res) {
9580 if ((_res & 1) != 0) return;
9581 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9582 CHECK_ACCESS(_res_ptr);
9583 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
9585 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
9588 static inline uint64_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
9589 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9590 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
9591 uint64_t ret_ref = (uint64_t)ret_copy;
9594 int64_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_clone_ptr(uint32_t arg) {
9595 LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)arg;
9596 int64_t ret_val = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
9600 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_clone(uint32_t orig) {
9601 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
9602 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9603 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
9604 uint64_t ret_ref = (uint64_t)ret_copy;
9608 uint32_t __attribute__((visibility("default"))) TS_COption_ClosureReasonZ_some(uint32_t o) {
9609 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9610 CHECK_ACCESS(o_ptr);
9611 LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
9612 o_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)o) & ~1));
9613 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
9614 *ret_copy = COption_ClosureReasonZ_some(o_conv);
9615 uint64_t ret_ref = (uint64_t)ret_copy;
9619 uint32_t __attribute__((visibility("default"))) TS_COption_ClosureReasonZ_none() {
9620 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
9621 *ret_copy = COption_ClosureReasonZ_none();
9622 uint64_t ret_ref = (uint64_t)ret_copy;
9626 void __attribute__((visibility("default"))) TS_COption_ClosureReasonZ_free(uint32_t _res) {
9627 if ((_res & 1) != 0) return;
9628 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9629 CHECK_ACCESS(_res_ptr);
9630 LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
9632 COption_ClosureReasonZ_free(_res_conv);
9635 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
9636 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
9637 *ret_copy = COption_ClosureReasonZ_clone(arg);
9638 uint64_t ret_ref = (uint64_t)ret_copy;
9641 int64_t __attribute__((visibility("default"))) TS_COption_ClosureReasonZ_clone_ptr(uint32_t arg) {
9642 LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)arg;
9643 int64_t ret_val = COption_ClosureReasonZ_clone_ptr(arg_conv);
9647 uint32_t __attribute__((visibility("default"))) TS_COption_ClosureReasonZ_clone(uint32_t orig) {
9648 LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)orig;
9649 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
9650 *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
9651 uint64_t ret_ref = (uint64_t)ret_copy;
9655 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint32_t o) {
9656 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9657 CHECK_ACCESS(o_ptr);
9658 LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
9659 o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)(((uint64_t)o) & ~1));
9660 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
9661 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
9662 return (uint64_t)ret_conv;
9665 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint32_t e) {
9666 LDKDecodeError e_conv;
9667 e_conv.inner = (void*)(e & (~1));
9668 e_conv.is_owned = (e & 1) || (e == 0);
9669 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9670 e_conv = DecodeError_clone(&e_conv);
9671 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
9672 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
9673 return (uint64_t)ret_conv;
9676 jboolean __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint32_t o) {
9677 LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(o & ~1);
9678 jboolean ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
9682 void __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint32_t _res) {
9683 if ((_res & 1) != 0) return;
9684 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9685 CHECK_ACCESS(_res_ptr);
9686 LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
9688 CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
9691 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
9692 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
9693 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
9694 return (uint64_t)ret_conv;
9696 int64_t __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint32_t arg) {
9697 LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
9698 int64_t ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
9702 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint32_t orig) {
9703 LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(orig & ~1);
9704 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
9705 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
9706 return (uint64_t)ret_conv;
9709 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_some(uint32_t o) {
9710 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9711 CHECK_ACCESS(o_ptr);
9712 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
9713 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uint64_t)o) & ~1));
9714 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
9715 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
9716 uint64_t ret_ref = (uint64_t)ret_copy;
9720 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_none() {
9721 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
9722 *ret_copy = COption_NetworkUpdateZ_none();
9723 uint64_t ret_ref = (uint64_t)ret_copy;
9727 void __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_free(uint32_t _res) {
9728 if ((_res & 1) != 0) return;
9729 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9730 CHECK_ACCESS(_res_ptr);
9731 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
9733 COption_NetworkUpdateZ_free(_res_conv);
9736 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
9737 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
9738 *ret_copy = COption_NetworkUpdateZ_clone(arg);
9739 uint64_t ret_ref = (uint64_t)ret_copy;
9742 int64_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_clone_ptr(uint32_t arg) {
9743 LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)arg;
9744 int64_t ret_val = COption_NetworkUpdateZ_clone_ptr(arg_conv);
9748 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_clone(uint32_t orig) {
9749 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
9750 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
9751 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
9752 uint64_t ret_ref = (uint64_t)ret_copy;
9756 void __attribute__((visibility("default"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
9757 LDKCVec_SpendableOutputDescriptorZ _res_constr;
9758 _res_constr.datalen = *((uint32_t*)_res);
9759 if (_res_constr.datalen > 0)
9760 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
9762 _res_constr.data = NULL;
9763 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9764 for (size_t b = 0; b < _res_constr.datalen; b++) {
9765 uint32_t _res_conv_27 = _res_vals[b];
9766 void* _res_conv_27_ptr = (void*)(((uint64_t)_res_conv_27) & ~1);
9767 CHECK_ACCESS(_res_conv_27_ptr);
9768 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
9769 FREE((void*)_res_conv_27);
9770 _res_constr.data[b] = _res_conv_27_conv;
9772 CVec_SpendableOutputDescriptorZ_free(_res_constr);
9775 uint32_t __attribute__((visibility("default"))) TS_COption_EventZ_some(uint32_t o) {
9776 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9777 CHECK_ACCESS(o_ptr);
9778 LDKEvent o_conv = *(LDKEvent*)(o_ptr);
9779 o_conv = Event_clone((LDKEvent*)(((uint64_t)o) & ~1));
9780 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
9781 *ret_copy = COption_EventZ_some(o_conv);
9782 uint64_t ret_ref = (uint64_t)ret_copy;
9786 uint32_t __attribute__((visibility("default"))) TS_COption_EventZ_none() {
9787 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
9788 *ret_copy = COption_EventZ_none();
9789 uint64_t ret_ref = (uint64_t)ret_copy;
9793 void __attribute__((visibility("default"))) TS_COption_EventZ_free(uint32_t _res) {
9794 if ((_res & 1) != 0) return;
9795 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9796 CHECK_ACCESS(_res_ptr);
9797 LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
9799 COption_EventZ_free(_res_conv);
9802 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
9803 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
9804 *ret_copy = COption_EventZ_clone(arg);
9805 uint64_t ret_ref = (uint64_t)ret_copy;
9808 int64_t __attribute__((visibility("default"))) TS_COption_EventZ_clone_ptr(uint32_t arg) {
9809 LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)arg;
9810 int64_t ret_val = COption_EventZ_clone_ptr(arg_conv);
9814 uint32_t __attribute__((visibility("default"))) TS_COption_EventZ_clone(uint32_t orig) {
9815 LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)orig;
9816 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
9817 *ret_copy = COption_EventZ_clone(orig_conv);
9818 uint64_t ret_ref = (uint64_t)ret_copy;
9822 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint32_t o) {
9823 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9824 CHECK_ACCESS(o_ptr);
9825 LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
9826 o_conv = COption_EventZ_clone((LDKCOption_EventZ*)(((uint64_t)o) & ~1));
9827 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
9828 *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
9829 return (uint64_t)ret_conv;
9832 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint32_t e) {
9833 LDKDecodeError e_conv;
9834 e_conv.inner = (void*)(e & (~1));
9835 e_conv.is_owned = (e & 1) || (e == 0);
9836 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9837 e_conv = DecodeError_clone(&e_conv);
9838 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
9839 *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
9840 return (uint64_t)ret_conv;
9843 jboolean __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint32_t o) {
9844 LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(o & ~1);
9845 jboolean ret_val = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
9849 void __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint32_t _res) {
9850 if ((_res & 1) != 0) return;
9851 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9852 CHECK_ACCESS(_res_ptr);
9853 LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
9855 CResult_COption_EventZDecodeErrorZ_free(_res_conv);
9858 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
9859 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
9860 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
9861 return (uint64_t)ret_conv;
9863 int64_t __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint32_t arg) {
9864 LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
9865 int64_t ret_val = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
9869 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint32_t orig) {
9870 LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(orig & ~1);
9871 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
9872 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
9873 return (uint64_t)ret_conv;
9876 void __attribute__((visibility("default"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
9877 LDKCVec_MessageSendEventZ _res_constr;
9878 _res_constr.datalen = *((uint32_t*)_res);
9879 if (_res_constr.datalen > 0)
9880 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
9882 _res_constr.data = NULL;
9883 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9884 for (size_t s = 0; s < _res_constr.datalen; s++) {
9885 uint32_t _res_conv_18 = _res_vals[s];
9886 void* _res_conv_18_ptr = (void*)(((uint64_t)_res_conv_18) & ~1);
9887 CHECK_ACCESS(_res_conv_18_ptr);
9888 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
9889 FREE((void*)_res_conv_18);
9890 _res_constr.data[s] = _res_conv_18_conv;
9892 CVec_MessageSendEventZ_free(_res_constr);
9895 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
9896 LDKInitFeatures o_conv;
9897 o_conv.inner = (void*)(o & (~1));
9898 o_conv.is_owned = (o & 1) || (o == 0);
9899 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9900 o_conv = InitFeatures_clone(&o_conv);
9901 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
9902 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
9903 return (uint64_t)ret_conv;
9906 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
9907 LDKDecodeError e_conv;
9908 e_conv.inner = (void*)(e & (~1));
9909 e_conv.is_owned = (e & 1) || (e == 0);
9910 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9911 e_conv = DecodeError_clone(&e_conv);
9912 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
9913 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
9914 return (uint64_t)ret_conv;
9917 jboolean __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint32_t o) {
9918 LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1);
9919 jboolean ret_val = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
9923 void __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
9924 if ((_res & 1) != 0) return;
9925 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9926 CHECK_ACCESS(_res_ptr);
9927 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
9929 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
9932 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
9933 LDKNodeFeatures o_conv;
9934 o_conv.inner = (void*)(o & (~1));
9935 o_conv.is_owned = (o & 1) || (o == 0);
9936 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9937 o_conv = NodeFeatures_clone(&o_conv);
9938 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
9939 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
9940 return (uint64_t)ret_conv;
9943 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
9944 LDKDecodeError e_conv;
9945 e_conv.inner = (void*)(e & (~1));
9946 e_conv.is_owned = (e & 1) || (e == 0);
9947 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9948 e_conv = DecodeError_clone(&e_conv);
9949 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
9950 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
9951 return (uint64_t)ret_conv;
9954 jboolean __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint32_t o) {
9955 LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1);
9956 jboolean ret_val = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
9960 void __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
9961 if ((_res & 1) != 0) return;
9962 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9963 CHECK_ACCESS(_res_ptr);
9964 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
9966 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
9969 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
9970 LDKChannelFeatures o_conv;
9971 o_conv.inner = (void*)(o & (~1));
9972 o_conv.is_owned = (o & 1) || (o == 0);
9973 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9974 o_conv = ChannelFeatures_clone(&o_conv);
9975 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
9976 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
9977 return (uint64_t)ret_conv;
9980 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_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_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
9987 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
9988 return (uint64_t)ret_conv;
9991 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint32_t o) {
9992 LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(o & ~1);
9993 jboolean ret_val = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
9997 void __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_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_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
10003 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
10006 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) {
10007 LDKInvoiceFeatures o_conv;
10008 o_conv.inner = (void*)(o & (~1));
10009 o_conv.is_owned = (o & 1) || (o == 0);
10010 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10011 o_conv = InvoiceFeatures_clone(&o_conv);
10012 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
10013 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
10014 return (uint64_t)ret_conv;
10017 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) {
10018 LDKDecodeError e_conv;
10019 e_conv.inner = (void*)(e & (~1));
10020 e_conv.is_owned = (e & 1) || (e == 0);
10021 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10022 e_conv = DecodeError_clone(&e_conv);
10023 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
10024 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
10025 return (uint64_t)ret_conv;
10028 jboolean __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint32_t o) {
10029 LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1);
10030 jboolean ret_val = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
10034 void __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) {
10035 if ((_res & 1) != 0) return;
10036 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10037 CHECK_ACCESS(_res_ptr);
10038 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
10040 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
10043 uint32_t __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_ok(uint32_t o) {
10044 LDKScoringParameters o_conv;
10045 o_conv.inner = (void*)(o & (~1));
10046 o_conv.is_owned = (o & 1) || (o == 0);
10047 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10048 // Warning: we need a move here but no clone is available for LDKScoringParameters
10049 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
10050 *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv);
10051 return (uint64_t)ret_conv;
10054 uint32_t __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_err(uint32_t e) {
10055 LDKDecodeError e_conv;
10056 e_conv.inner = (void*)(e & (~1));
10057 e_conv.is_owned = (e & 1) || (e == 0);
10058 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10059 e_conv = DecodeError_clone(&e_conv);
10060 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
10061 *ret_conv = CResult_ScoringParametersDecodeErrorZ_err(e_conv);
10062 return (uint64_t)ret_conv;
10065 jboolean __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_is_ok(uint32_t o) {
10066 LDKCResult_ScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(o & ~1);
10067 jboolean ret_val = CResult_ScoringParametersDecodeErrorZ_is_ok(o_conv);
10071 void __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_free(uint32_t _res) {
10072 if ((_res & 1) != 0) return;
10073 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10074 CHECK_ACCESS(_res_ptr);
10075 LDKCResult_ScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ScoringParametersDecodeErrorZ*)(_res_ptr);
10077 CResult_ScoringParametersDecodeErrorZ_free(_res_conv);
10080 uint32_t __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_ok(uint32_t o) {
10082 o_conv.inner = (void*)(o & (~1));
10083 o_conv.is_owned = (o & 1) || (o == 0);
10084 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10085 // Warning: we need a move here but no clone is available for LDKScorer
10086 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
10087 *ret_conv = CResult_ScorerDecodeErrorZ_ok(o_conv);
10088 return (uint64_t)ret_conv;
10091 uint32_t __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_err(uint32_t e) {
10092 LDKDecodeError e_conv;
10093 e_conv.inner = (void*)(e & (~1));
10094 e_conv.is_owned = (e & 1) || (e == 0);
10095 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10096 e_conv = DecodeError_clone(&e_conv);
10097 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
10098 *ret_conv = CResult_ScorerDecodeErrorZ_err(e_conv);
10099 return (uint64_t)ret_conv;
10102 jboolean __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_is_ok(uint32_t o) {
10103 LDKCResult_ScorerDecodeErrorZ* o_conv = (LDKCResult_ScorerDecodeErrorZ*)(o & ~1);
10104 jboolean ret_val = CResult_ScorerDecodeErrorZ_is_ok(o_conv);
10108 void __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_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 LDKCResult_ScorerDecodeErrorZ _res_conv = *(LDKCResult_ScorerDecodeErrorZ*)(_res_ptr);
10114 CResult_ScorerDecodeErrorZ_free(_res_conv);
10117 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
10118 LDKDelayedPaymentOutputDescriptor o_conv;
10119 o_conv.inner = (void*)(o & (~1));
10120 o_conv.is_owned = (o & 1) || (o == 0);
10121 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10122 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
10123 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
10124 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
10125 return (uint64_t)ret_conv;
10128 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
10129 LDKDecodeError e_conv;
10130 e_conv.inner = (void*)(e & (~1));
10131 e_conv.is_owned = (e & 1) || (e == 0);
10132 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10133 e_conv = DecodeError_clone(&e_conv);
10134 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
10135 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
10136 return (uint64_t)ret_conv;
10139 jboolean __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
10140 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
10141 jboolean ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
10145 void __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
10146 if ((_res & 1) != 0) return;
10147 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10148 CHECK_ACCESS(_res_ptr);
10149 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
10151 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
10154 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
10155 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
10156 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
10157 return (uint64_t)ret_conv;
10159 int64_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
10160 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
10161 int64_t ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
10165 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
10166 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
10167 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
10168 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
10169 return (uint64_t)ret_conv;
10172 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
10173 LDKStaticPaymentOutputDescriptor o_conv;
10174 o_conv.inner = (void*)(o & (~1));
10175 o_conv.is_owned = (o & 1) || (o == 0);
10176 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10177 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
10178 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
10179 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
10180 return (uint64_t)ret_conv;
10183 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
10184 LDKDecodeError e_conv;
10185 e_conv.inner = (void*)(e & (~1));
10186 e_conv.is_owned = (e & 1) || (e == 0);
10187 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10188 e_conv = DecodeError_clone(&e_conv);
10189 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
10190 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
10191 return (uint64_t)ret_conv;
10194 jboolean __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
10195 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
10196 jboolean ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
10200 void __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
10201 if ((_res & 1) != 0) return;
10202 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10203 CHECK_ACCESS(_res_ptr);
10204 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
10206 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
10209 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
10210 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
10211 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
10212 return (uint64_t)ret_conv;
10214 int64_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
10215 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
10216 int64_t ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
10220 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
10221 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
10222 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
10223 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
10224 return (uint64_t)ret_conv;
10227 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
10228 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10229 CHECK_ACCESS(o_ptr);
10230 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
10231 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1));
10232 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10233 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
10234 return (uint64_t)ret_conv;
10237 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
10238 LDKDecodeError e_conv;
10239 e_conv.inner = (void*)(e & (~1));
10240 e_conv.is_owned = (e & 1) || (e == 0);
10241 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10242 e_conv = DecodeError_clone(&e_conv);
10243 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10244 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
10245 return (uint64_t)ret_conv;
10248 jboolean __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
10249 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(o & ~1);
10250 jboolean ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
10254 void __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
10255 if ((_res & 1) != 0) return;
10256 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10257 CHECK_ACCESS(_res_ptr);
10258 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
10260 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
10263 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
10264 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10265 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
10266 return (uint64_t)ret_conv;
10268 int64_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
10269 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
10270 int64_t ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
10274 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
10275 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
10276 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10277 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
10278 return (uint64_t)ret_conv;
10281 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_ok() {
10282 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10283 *ret_conv = CResult_NoneNoneZ_ok();
10284 return (uint64_t)ret_conv;
10287 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_err() {
10288 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10289 *ret_conv = CResult_NoneNoneZ_err();
10290 return (uint64_t)ret_conv;
10293 jboolean __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_is_ok(uint32_t o) {
10294 LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)(o & ~1);
10295 jboolean ret_val = CResult_NoneNoneZ_is_ok(o_conv);
10299 void __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_free(uint32_t _res) {
10300 if ((_res & 1) != 0) return;
10301 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10302 CHECK_ACCESS(_res_ptr);
10303 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
10305 CResult_NoneNoneZ_free(_res_conv);
10308 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
10309 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10310 *ret_conv = CResult_NoneNoneZ_clone(arg);
10311 return (uint64_t)ret_conv;
10313 int64_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_clone_ptr(uint32_t arg) {
10314 LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)(arg & ~1);
10315 int64_t ret_val = CResult_NoneNoneZ_clone_ptr(arg_conv);
10319 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_clone(uint32_t orig) {
10320 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
10321 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10322 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
10323 return (uint64_t)ret_conv;
10326 static inline uint64_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
10327 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
10328 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
10329 return ((uint64_t)ret_conv);
10331 int64_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(uint32_t arg) {
10332 LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(arg & ~1);
10333 int64_t ret_val = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
10337 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
10338 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
10339 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
10340 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
10341 return ((uint64_t)ret_conv);
10344 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
10345 LDKSignature a_ref;
10346 CHECK(*((uint32_t*)a) == 64);
10347 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
10348 LDKCVec_SignatureZ b_constr;
10349 b_constr.datalen = *((uint32_t*)b);
10350 if (b_constr.datalen > 0)
10351 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
10353 b_constr.data = NULL;
10354 int8_tArray* b_vals = (int8_tArray*)(b + 4);
10355 for (size_t m = 0; m < b_constr.datalen; m++) {
10356 int8_tArray b_conv_12 = b_vals[m];
10357 LDKSignature b_conv_12_ref;
10358 CHECK(*((uint32_t*)b_conv_12) == 64);
10359 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
10360 b_constr.data[m] = b_conv_12_ref;
10362 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
10363 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
10364 return ((uint64_t)ret_conv);
10367 void __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
10368 if ((_res & 1) != 0) return;
10369 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10370 CHECK_ACCESS(_res_ptr);
10371 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
10373 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
10376 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
10377 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10378 CHECK_ACCESS(o_ptr);
10379 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
10380 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1));
10381 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10382 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
10383 return (uint64_t)ret_conv;
10386 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
10387 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10388 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
10389 return (uint64_t)ret_conv;
10392 jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(uint32_t o) {
10393 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(o & ~1);
10394 jboolean ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
10398 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
10399 if ((_res & 1) != 0) return;
10400 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10401 CHECK_ACCESS(_res_ptr);
10402 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
10404 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
10407 static inline uint64_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
10408 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10409 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
10410 return (uint64_t)ret_conv;
10412 int64_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(uint32_t arg) {
10413 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
10414 int64_t ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
10418 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
10419 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
10420 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10421 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
10422 return (uint64_t)ret_conv;
10425 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
10426 LDKSignature o_ref;
10427 CHECK(*((uint32_t*)o) == 64);
10428 memcpy(o_ref.compact_form, (uint8_t*)(o + 4), 64);
10429 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10430 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
10431 return (uint64_t)ret_conv;
10434 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_err() {
10435 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10436 *ret_conv = CResult_SignatureNoneZ_err();
10437 return (uint64_t)ret_conv;
10440 jboolean __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_is_ok(uint32_t o) {
10441 LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)(o & ~1);
10442 jboolean ret_val = CResult_SignatureNoneZ_is_ok(o_conv);
10446 void __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
10447 if ((_res & 1) != 0) return;
10448 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10449 CHECK_ACCESS(_res_ptr);
10450 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
10452 CResult_SignatureNoneZ_free(_res_conv);
10455 static inline uint64_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
10456 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10457 *ret_conv = CResult_SignatureNoneZ_clone(arg);
10458 return (uint64_t)ret_conv;
10460 int64_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone_ptr(uint32_t arg) {
10461 LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)(arg & ~1);
10462 int64_t ret_val = CResult_SignatureNoneZ_clone_ptr(arg_conv);
10466 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
10467 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
10468 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10469 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
10470 return (uint64_t)ret_conv;
10473 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
10474 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10475 CHECK_ACCESS(o_ptr);
10476 LDKSign o_conv = *(LDKSign*)(o_ptr);
10477 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10478 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
10479 return (uint64_t)ret_conv;
10482 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
10483 LDKDecodeError e_conv;
10484 e_conv.inner = (void*)(e & (~1));
10485 e_conv.is_owned = (e & 1) || (e == 0);
10486 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10487 e_conv = DecodeError_clone(&e_conv);
10488 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10489 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
10490 return (uint64_t)ret_conv;
10493 jboolean __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_is_ok(uint32_t o) {
10494 LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)(o & ~1);
10495 jboolean ret_val = CResult_SignDecodeErrorZ_is_ok(o_conv);
10499 void __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
10500 if ((_res & 1) != 0) return;
10501 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10502 CHECK_ACCESS(_res_ptr);
10503 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
10505 CResult_SignDecodeErrorZ_free(_res_conv);
10508 static inline uint64_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
10509 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10510 *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
10511 return (uint64_t)ret_conv;
10513 int64_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_clone_ptr(uint32_t arg) {
10514 LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
10515 int64_t ret_val = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
10519 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
10520 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
10521 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10522 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
10523 return (uint64_t)ret_conv;
10526 void __attribute__((visibility("default"))) TS_CVec_u8Z_free(int8_tArray _res) {
10527 LDKCVec_u8Z _res_ref;
10528 _res_ref.datalen = *((uint32_t*)_res);
10529 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
10530 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
10531 CVec_u8Z_free(_res_ref);
10534 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray arg) {
10535 LDKRecoverableSignature arg_ref;
10536 CHECK(*((uint32_t*)arg) == 68);
10537 memcpy(arg_ref.serialized_form, (uint8_t*)(arg + 4), 68);
10538 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10539 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
10540 return (uint64_t)ret_conv;
10543 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_err() {
10544 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10545 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
10546 return (uint64_t)ret_conv;
10549 jboolean __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint32_t o) {
10550 LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)(o & ~1);
10551 jboolean ret_val = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
10555 void __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_free(uint32_t _res) {
10556 if ((_res & 1) != 0) return;
10557 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10558 CHECK_ACCESS(_res_ptr);
10559 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
10561 CResult_RecoverableSignatureNoneZ_free(_res_conv);
10564 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
10565 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10566 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
10567 return (uint64_t)ret_conv;
10569 int64_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint32_t arg) {
10570 LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
10571 int64_t ret_val = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
10575 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint32_t orig) {
10576 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
10577 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10578 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
10579 return (uint64_t)ret_conv;
10582 void __attribute__((visibility("default"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
10583 LDKCVec_CVec_u8ZZ _res_constr;
10584 _res_constr.datalen = *((uint32_t*)_res);
10585 if (_res_constr.datalen > 0)
10586 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
10588 _res_constr.data = NULL;
10589 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
10590 for (size_t m = 0; m < _res_constr.datalen; m++) {
10591 int8_tArray _res_conv_12 = _res_vals[m];
10592 LDKCVec_u8Z _res_conv_12_ref;
10593 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
10594 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
10595 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
10596 _res_constr.data[m] = _res_conv_12_ref;
10598 CVec_CVec_u8ZZ_free(_res_constr);
10601 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
10602 LDKCVec_CVec_u8ZZ o_constr;
10603 o_constr.datalen = *((uint32_t*)o);
10604 if (o_constr.datalen > 0)
10605 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
10607 o_constr.data = NULL;
10608 int8_tArray* o_vals = (int8_tArray*)(o + 4);
10609 for (size_t m = 0; m < o_constr.datalen; m++) {
10610 int8_tArray o_conv_12 = o_vals[m];
10611 LDKCVec_u8Z o_conv_12_ref;
10612 o_conv_12_ref.datalen = *((uint32_t*)o_conv_12);
10613 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
10614 memcpy(o_conv_12_ref.data, (uint8_t*)(o_conv_12 + 4), o_conv_12_ref.datalen);
10615 o_constr.data[m] = o_conv_12_ref;
10617 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10618 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
10619 return (uint64_t)ret_conv;
10622 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
10623 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10624 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
10625 return (uint64_t)ret_conv;
10628 jboolean __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint32_t o) {
10629 LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(o & ~1);
10630 jboolean ret_val = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
10634 void __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
10635 if ((_res & 1) != 0) return;
10636 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10637 CHECK_ACCESS(_res_ptr);
10638 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
10640 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
10643 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
10644 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10645 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
10646 return (uint64_t)ret_conv;
10648 int64_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint32_t arg) {
10649 LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
10650 int64_t ret_val = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
10654 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
10655 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
10656 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10657 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
10658 return (uint64_t)ret_conv;
10661 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
10662 LDKInMemorySigner o_conv;
10663 o_conv.inner = (void*)(o & (~1));
10664 o_conv.is_owned = (o & 1) || (o == 0);
10665 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10666 o_conv = InMemorySigner_clone(&o_conv);
10667 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10668 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
10669 return (uint64_t)ret_conv;
10672 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
10673 LDKDecodeError e_conv;
10674 e_conv.inner = (void*)(e & (~1));
10675 e_conv.is_owned = (e & 1) || (e == 0);
10676 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10677 e_conv = DecodeError_clone(&e_conv);
10678 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10679 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
10680 return (uint64_t)ret_conv;
10683 jboolean __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint32_t o) {
10684 LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(o & ~1);
10685 jboolean ret_val = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
10689 void __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
10690 if ((_res & 1) != 0) return;
10691 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10692 CHECK_ACCESS(_res_ptr);
10693 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
10695 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
10698 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
10699 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10700 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
10701 return (uint64_t)ret_conv;
10703 int64_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint32_t arg) {
10704 LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
10705 int64_t ret_val = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
10709 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
10710 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
10711 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10712 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
10713 return (uint64_t)ret_conv;
10716 void __attribute__((visibility("default"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
10717 LDKCVec_TxOutZ _res_constr;
10718 _res_constr.datalen = *((uint32_t*)_res);
10719 if (_res_constr.datalen > 0)
10720 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
10722 _res_constr.data = NULL;
10723 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10724 for (size_t h = 0; h < _res_constr.datalen; h++) {
10725 uint32_t _res_conv_7 = _res_vals[h];
10726 void* _res_conv_7_ptr = (void*)(((uint64_t)_res_conv_7) & ~1);
10727 CHECK_ACCESS(_res_conv_7_ptr);
10728 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
10729 FREE((void*)_res_conv_7);
10730 _res_constr.data[h] = _res_conv_7_conv;
10732 CVec_TxOutZ_free(_res_constr);
10735 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
10736 LDKTransaction o_ref;
10737 o_ref.datalen = *((uint32_t*)o);
10738 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
10739 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
10740 o_ref.data_is_owned = true;
10741 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10742 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
10743 return (uint64_t)ret_conv;
10746 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_err() {
10747 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10748 *ret_conv = CResult_TransactionNoneZ_err();
10749 return (uint64_t)ret_conv;
10752 jboolean __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_is_ok(uint32_t o) {
10753 LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)(o & ~1);
10754 jboolean ret_val = CResult_TransactionNoneZ_is_ok(o_conv);
10758 void __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
10759 if ((_res & 1) != 0) return;
10760 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10761 CHECK_ACCESS(_res_ptr);
10762 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
10764 CResult_TransactionNoneZ_free(_res_conv);
10767 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
10768 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10769 *ret_conv = CResult_TransactionNoneZ_clone(arg);
10770 return (uint64_t)ret_conv;
10772 int64_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_clone_ptr(uint32_t arg) {
10773 LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)(arg & ~1);
10774 int64_t ret_val = CResult_TransactionNoneZ_clone_ptr(arg_conv);
10778 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_clone(uint32_t orig) {
10779 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
10780 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10781 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
10782 return (uint64_t)ret_conv;
10785 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
10786 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10787 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
10788 return ((uint64_t)ret_conv);
10790 int64_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint32_t arg) {
10791 LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(arg & ~1);
10792 int64_t ret_val = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
10796 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint32_t orig) {
10797 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
10798 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10799 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
10800 return ((uint64_t)ret_conv);
10803 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
10804 LDKThirtyTwoBytes a_ref;
10805 CHECK(*((uint32_t*)a) == 32);
10806 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
10807 LDKChannelMonitor b_conv;
10808 b_conv.inner = (void*)(b & (~1));
10809 b_conv.is_owned = (b & 1) || (b == 0);
10810 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
10811 b_conv = ChannelMonitor_clone(&b_conv);
10812 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10813 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
10814 return ((uint64_t)ret_conv);
10817 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
10818 if ((_res & 1) != 0) return;
10819 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10820 CHECK_ACCESS(_res_ptr);
10821 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
10823 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
10826 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_BlockHashChannelMonitorZZ_free(uint32_tArray _res) {
10827 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
10828 _res_constr.datalen = *((uint32_t*)_res);
10829 if (_res_constr.datalen > 0)
10830 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
10832 _res_constr.data = NULL;
10833 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10834 for (size_t j = 0; j < _res_constr.datalen; j++) {
10835 uint32_t _res_conv_35 = _res_vals[j];
10836 void* _res_conv_35_ptr = (void*)(((uint64_t)_res_conv_35) & ~1);
10837 CHECK_ACCESS(_res_conv_35_ptr);
10838 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_conv_35_ptr);
10839 FREE((void*)_res_conv_35);
10840 _res_constr.data[j] = _res_conv_35_conv;
10842 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
10845 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(uint32_tArray o) {
10846 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
10847 o_constr.datalen = *((uint32_t*)o);
10848 if (o_constr.datalen > 0)
10849 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
10851 o_constr.data = NULL;
10852 uint32_t* o_vals = (uint32_t*)(o + 4);
10853 for (size_t j = 0; j < o_constr.datalen; j++) {
10854 uint32_t o_conv_35 = o_vals[j];
10855 void* o_conv_35_ptr = (void*)(((uint64_t)o_conv_35) & ~1);
10856 CHECK_ACCESS(o_conv_35_ptr);
10857 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_conv_35_ptr);
10858 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_35) & ~1));
10859 o_constr.data[j] = o_conv_35_conv;
10861 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10862 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
10863 return (uint64_t)ret_conv;
10866 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(uint32_t e) {
10867 LDKIOError e_conv = LDKIOError_from_js(e);
10868 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10869 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
10870 return (uint64_t)ret_conv;
10873 jboolean __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(uint32_t o) {
10874 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(o & ~1);
10875 jboolean ret_val = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o_conv);
10879 void __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(uint32_t _res) {
10880 if ((_res & 1) != 0) return;
10881 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10882 CHECK_ACCESS(_res_ptr);
10883 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(_res_ptr);
10885 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
10888 static inline uint64_t CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR arg) {
10889 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10890 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(arg);
10891 return (uint64_t)ret_conv;
10893 int64_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(uint32_t arg) {
10894 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
10895 int64_t ret_val = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(arg_conv);
10899 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(uint32_t orig) {
10900 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(orig & ~1);
10901 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10902 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
10903 return (uint64_t)ret_conv;
10906 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_some(int16_t o) {
10907 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
10908 *ret_copy = COption_u16Z_some(o);
10909 uint64_t ret_ref = (uint64_t)ret_copy;
10913 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_none() {
10914 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
10915 *ret_copy = COption_u16Z_none();
10916 uint64_t ret_ref = (uint64_t)ret_copy;
10920 void __attribute__((visibility("default"))) TS_COption_u16Z_free(uint32_t _res) {
10921 if ((_res & 1) != 0) return;
10922 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10923 CHECK_ACCESS(_res_ptr);
10924 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
10926 COption_u16Z_free(_res_conv);
10929 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
10930 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
10931 *ret_copy = COption_u16Z_clone(arg);
10932 uint64_t ret_ref = (uint64_t)ret_copy;
10935 int64_t __attribute__((visibility("default"))) TS_COption_u16Z_clone_ptr(uint32_t arg) {
10936 LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)arg;
10937 int64_t ret_val = COption_u16Z_clone_ptr(arg_conv);
10941 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_clone(uint32_t orig) {
10942 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
10943 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
10944 *ret_copy = COption_u16Z_clone(orig_conv);
10945 uint64_t ret_ref = (uint64_t)ret_copy;
10949 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_ok() {
10950 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10951 *ret_conv = CResult_NoneAPIErrorZ_ok();
10952 return (uint64_t)ret_conv;
10955 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
10956 void* e_ptr = (void*)(((uint64_t)e) & ~1);
10957 CHECK_ACCESS(e_ptr);
10958 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
10959 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
10960 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10961 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
10962 return (uint64_t)ret_conv;
10965 jboolean __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_is_ok(uint32_t o) {
10966 LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)(o & ~1);
10967 jboolean ret_val = CResult_NoneAPIErrorZ_is_ok(o_conv);
10971 void __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
10972 if ((_res & 1) != 0) return;
10973 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10974 CHECK_ACCESS(_res_ptr);
10975 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
10977 CResult_NoneAPIErrorZ_free(_res_conv);
10980 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
10981 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10982 *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
10983 return (uint64_t)ret_conv;
10985 int64_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint32_t arg) {
10986 LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
10987 int64_t ret_val = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
10991 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
10992 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
10993 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10994 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
10995 return (uint64_t)ret_conv;
10998 void __attribute__((visibility("default"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
10999 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
11000 _res_constr.datalen = *((uint32_t*)_res);
11001 if (_res_constr.datalen > 0)
11002 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
11004 _res_constr.data = NULL;
11005 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11006 for (size_t w = 0; w < _res_constr.datalen; w++) {
11007 uint32_t _res_conv_22 = _res_vals[w];
11008 void* _res_conv_22_ptr = (void*)(((uint64_t)_res_conv_22) & ~1);
11009 CHECK_ACCESS(_res_conv_22_ptr);
11010 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
11011 FREE((void*)_res_conv_22);
11012 _res_constr.data[w] = _res_conv_22_conv;
11014 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
11017 void __attribute__((visibility("default"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
11018 LDKCVec_APIErrorZ _res_constr;
11019 _res_constr.datalen = *((uint32_t*)_res);
11020 if (_res_constr.datalen > 0)
11021 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
11023 _res_constr.data = NULL;
11024 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11025 for (size_t k = 0; k < _res_constr.datalen; k++) {
11026 uint32_t _res_conv_10 = _res_vals[k];
11027 void* _res_conv_10_ptr = (void*)(((uint64_t)_res_conv_10) & ~1);
11028 CHECK_ACCESS(_res_conv_10_ptr);
11029 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
11030 FREE((void*)_res_conv_10);
11031 _res_constr.data[k] = _res_conv_10_conv;
11033 CVec_APIErrorZ_free(_res_constr);
11036 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
11037 LDKThirtyTwoBytes o_ref;
11038 CHECK(*((uint32_t*)o) == 32);
11039 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
11040 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
11041 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
11042 return (uint64_t)ret_conv;
11045 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_err(uint32_t e) {
11046 void* e_ptr = (void*)(((uint64_t)e) & ~1);
11047 CHECK_ACCESS(e_ptr);
11048 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
11049 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
11050 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
11051 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
11052 return (uint64_t)ret_conv;
11055 jboolean __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_is_ok(uint32_t o) {
11056 LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)(o & ~1);
11057 jboolean ret_val = CResult__u832APIErrorZ_is_ok(o_conv);
11061 void __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_free(uint32_t _res) {
11062 if ((_res & 1) != 0) return;
11063 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11064 CHECK_ACCESS(_res_ptr);
11065 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
11067 CResult__u832APIErrorZ_free(_res_conv);
11070 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
11071 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
11072 *ret_conv = CResult__u832APIErrorZ_clone(arg);
11073 return (uint64_t)ret_conv;
11075 int64_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_clone_ptr(uint32_t arg) {
11076 LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)(arg & ~1);
11077 int64_t ret_val = CResult__u832APIErrorZ_clone_ptr(arg_conv);
11081 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_clone(uint32_t orig) {
11082 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
11083 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
11084 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
11085 return (uint64_t)ret_conv;
11088 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_ok(int8_tArray o) {
11089 LDKThirtyTwoBytes o_ref;
11090 CHECK(*((uint32_t*)o) == 32);
11091 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
11092 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
11093 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
11094 return (uint64_t)ret_conv;
11097 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_err(uint32_t e) {
11098 void* e_ptr = (void*)(((uint64_t)e) & ~1);
11099 CHECK_ACCESS(e_ptr);
11100 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
11101 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
11102 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
11103 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
11104 return (uint64_t)ret_conv;
11107 jboolean __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_is_ok(uint32_t o) {
11108 LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(o & ~1);
11109 jboolean ret_val = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
11113 void __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_free(uint32_t _res) {
11114 if ((_res & 1) != 0) return;
11115 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11116 CHECK_ACCESS(_res_ptr);
11117 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
11119 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
11122 static inline uint64_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
11123 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
11124 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
11125 return (uint64_t)ret_conv;
11127 int64_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr(uint32_t arg) {
11128 LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
11129 int64_t ret_val = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
11133 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone(uint32_t orig) {
11134 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
11135 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
11136 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
11137 return (uint64_t)ret_conv;
11140 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_ok() {
11141 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11142 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
11143 return (uint64_t)ret_conv;
11146 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
11147 void* e_ptr = (void*)(((uint64_t)e) & ~1);
11148 CHECK_ACCESS(e_ptr);
11149 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
11150 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
11151 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11152 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
11153 return (uint64_t)ret_conv;
11156 jboolean __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint32_t o) {
11157 LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)(o & ~1);
11158 jboolean ret_val = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
11162 void __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
11163 if ((_res & 1) != 0) return;
11164 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11165 CHECK_ACCESS(_res_ptr);
11166 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
11168 CResult_NonePaymentSendFailureZ_free(_res_conv);
11171 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
11172 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11173 *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
11174 return (uint64_t)ret_conv;
11176 int64_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint32_t arg) {
11177 LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
11178 int64_t ret_val = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
11182 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
11183 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
11184 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11185 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
11186 return (uint64_t)ret_conv;
11189 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
11190 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
11191 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
11192 return ((uint64_t)ret_conv);
11194 int64_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint32_t arg) {
11195 LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(arg & ~1);
11196 int64_t ret_val = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
11200 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint32_t orig) {
11201 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
11202 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
11203 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
11204 return ((uint64_t)ret_conv);
11207 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
11208 LDKThirtyTwoBytes a_ref;
11209 CHECK(*((uint32_t*)a) == 32);
11210 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
11211 LDKThirtyTwoBytes b_ref;
11212 CHECK(*((uint32_t*)b) == 32);
11213 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
11214 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
11215 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
11216 return ((uint64_t)ret_conv);
11219 void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint32_t _res) {
11220 if ((_res & 1) != 0) return;
11221 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11222 CHECK_ACCESS(_res_ptr);
11223 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
11225 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
11228 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint32_t o) {
11229 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11230 CHECK_ACCESS(o_ptr);
11231 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
11232 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)o) & ~1));
11233 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
11234 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
11235 return (uint64_t)ret_conv;
11238 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint32_t e) {
11239 void* e_ptr = (void*)(((uint64_t)e) & ~1);
11240 CHECK_ACCESS(e_ptr);
11241 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
11242 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
11243 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
11244 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
11245 return (uint64_t)ret_conv;
11248 jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint32_t o) {
11249 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(o & ~1);
11250 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
11254 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint32_t _res) {
11255 if ((_res & 1) != 0) return;
11256 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11257 CHECK_ACCESS(_res_ptr);
11258 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
11260 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
11263 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
11264 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
11265 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
11266 return (uint64_t)ret_conv;
11268 int64_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint32_t arg) {
11269 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
11270 int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
11274 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint32_t orig) {
11275 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
11276 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
11277 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
11278 return (uint64_t)ret_conv;
11281 void __attribute__((visibility("default"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
11282 LDKCVec_NetAddressZ _res_constr;
11283 _res_constr.datalen = *((uint32_t*)_res);
11284 if (_res_constr.datalen > 0)
11285 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
11287 _res_constr.data = NULL;
11288 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11289 for (size_t m = 0; m < _res_constr.datalen; m++) {
11290 uint32_t _res_conv_12 = _res_vals[m];
11291 void* _res_conv_12_ptr = (void*)(((uint64_t)_res_conv_12) & ~1);
11292 CHECK_ACCESS(_res_conv_12_ptr);
11293 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
11294 FREE((void*)_res_conv_12);
11295 _res_constr.data[m] = _res_conv_12_conv;
11297 CVec_NetAddressZ_free(_res_constr);
11300 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
11301 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
11302 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
11303 return ((uint64_t)ret_conv);
11305 int64_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint32_t arg) {
11306 LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(arg & ~1);
11307 int64_t ret_val = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
11311 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint32_t orig) {
11312 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
11313 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
11314 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
11315 return ((uint64_t)ret_conv);
11318 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
11319 LDKThirtyTwoBytes a_ref;
11320 CHECK(*((uint32_t*)a) == 32);
11321 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
11322 LDKThirtyTwoBytes b_ref;
11323 CHECK(*((uint32_t*)b) == 32);
11324 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
11325 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
11326 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
11327 return ((uint64_t)ret_conv);
11330 void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint32_t _res) {
11331 if ((_res & 1) != 0) return;
11332 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11333 CHECK_ACCESS(_res_ptr);
11334 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
11336 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
11339 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
11340 LDKThirtyTwoBytes o_ref;
11341 CHECK(*((uint32_t*)o) == 32);
11342 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
11343 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
11344 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
11345 return (uint64_t)ret_conv;
11348 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint32_t e) {
11349 void* e_ptr = (void*)(((uint64_t)e) & ~1);
11350 CHECK_ACCESS(e_ptr);
11351 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
11352 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
11353 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
11354 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
11355 return (uint64_t)ret_conv;
11358 jboolean __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_is_ok(uint32_t o) {
11359 LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(o & ~1);
11360 jboolean ret_val = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
11364 void __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint32_t _res) {
11365 if ((_res & 1) != 0) return;
11366 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11367 CHECK_ACCESS(_res_ptr);
11368 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
11370 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
11373 static inline uint64_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
11374 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
11375 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
11376 return (uint64_t)ret_conv;
11378 int64_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_clone_ptr(uint32_t arg) {
11379 LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
11380 int64_t ret_val = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
11384 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint32_t orig) {
11385 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
11386 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
11387 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
11388 return (uint64_t)ret_conv;
11391 void __attribute__((visibility("default"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
11392 LDKCVec_ChannelMonitorZ _res_constr;
11393 _res_constr.datalen = *((uint32_t*)_res);
11394 if (_res_constr.datalen > 0)
11395 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
11397 _res_constr.data = NULL;
11398 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11399 for (size_t q = 0; q < _res_constr.datalen; q++) {
11400 uint32_t _res_conv_16 = _res_vals[q];
11401 LDKChannelMonitor _res_conv_16_conv;
11402 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
11403 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
11404 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
11405 _res_constr.data[q] = _res_conv_16_conv;
11407 CVec_ChannelMonitorZ_free(_res_constr);
11410 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
11411 LDKThirtyTwoBytes a_ref;
11412 CHECK(*((uint32_t*)a) == 32);
11413 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
11414 LDKChannelManager b_conv;
11415 b_conv.inner = (void*)(b & (~1));
11416 b_conv.is_owned = (b & 1) || (b == 0);
11417 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
11418 // Warning: we need a move here but no clone is available for LDKChannelManager
11419 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
11420 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
11421 return ((uint64_t)ret_conv);
11424 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
11425 if ((_res & 1) != 0) return;
11426 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11427 CHECK_ACCESS(_res_ptr);
11428 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
11430 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
11433 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
11434 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11435 CHECK_ACCESS(o_ptr);
11436 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
11437 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
11438 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
11439 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
11440 return (uint64_t)ret_conv;
11443 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
11444 LDKDecodeError e_conv;
11445 e_conv.inner = (void*)(e & (~1));
11446 e_conv.is_owned = (e & 1) || (e == 0);
11447 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11448 e_conv = DecodeError_clone(&e_conv);
11449 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
11450 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
11451 return (uint64_t)ret_conv;
11454 jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint32_t o) {
11455 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(o & ~1);
11456 jboolean ret_val = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
11460 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
11461 if ((_res & 1) != 0) return;
11462 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11463 CHECK_ACCESS(_res_ptr);
11464 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
11466 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
11469 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
11470 LDKChannelConfig o_conv;
11471 o_conv.inner = (void*)(o & (~1));
11472 o_conv.is_owned = (o & 1) || (o == 0);
11473 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11474 o_conv = ChannelConfig_clone(&o_conv);
11475 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
11476 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
11477 return (uint64_t)ret_conv;
11480 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
11481 LDKDecodeError e_conv;
11482 e_conv.inner = (void*)(e & (~1));
11483 e_conv.is_owned = (e & 1) || (e == 0);
11484 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11485 e_conv = DecodeError_clone(&e_conv);
11486 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
11487 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
11488 return (uint64_t)ret_conv;
11491 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint32_t o) {
11492 LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(o & ~1);
11493 jboolean ret_val = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
11497 void __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
11498 if ((_res & 1) != 0) return;
11499 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11500 CHECK_ACCESS(_res_ptr);
11501 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
11503 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
11506 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
11507 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
11508 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
11509 return (uint64_t)ret_conv;
11511 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint32_t arg) {
11512 LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
11513 int64_t ret_val = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
11517 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
11518 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
11519 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
11520 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
11521 return (uint64_t)ret_conv;
11524 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
11525 LDKOutPoint o_conv;
11526 o_conv.inner = (void*)(o & (~1));
11527 o_conv.is_owned = (o & 1) || (o == 0);
11528 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11529 o_conv = OutPoint_clone(&o_conv);
11530 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
11531 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
11532 return (uint64_t)ret_conv;
11535 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
11536 LDKDecodeError e_conv;
11537 e_conv.inner = (void*)(e & (~1));
11538 e_conv.is_owned = (e & 1) || (e == 0);
11539 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11540 e_conv = DecodeError_clone(&e_conv);
11541 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
11542 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
11543 return (uint64_t)ret_conv;
11546 jboolean __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint32_t o) {
11547 LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)(o & ~1);
11548 jboolean ret_val = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
11552 void __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
11553 if ((_res & 1) != 0) return;
11554 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11555 CHECK_ACCESS(_res_ptr);
11556 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
11558 CResult_OutPointDecodeErrorZ_free(_res_conv);
11561 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
11562 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
11563 *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
11564 return (uint64_t)ret_conv;
11566 int64_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint32_t arg) {
11567 LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
11568 int64_t ret_val = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
11572 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
11573 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
11574 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
11575 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
11576 return (uint64_t)ret_conv;
11579 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_some(uint32_t o) {
11580 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11581 CHECK_ACCESS(o_ptr);
11582 LDKType o_conv = *(LDKType*)(o_ptr);
11583 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
11584 *ret_copy = COption_TypeZ_some(o_conv);
11585 uint64_t ret_ref = (uint64_t)ret_copy;
11589 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_none() {
11590 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
11591 *ret_copy = COption_TypeZ_none();
11592 uint64_t ret_ref = (uint64_t)ret_copy;
11596 void __attribute__((visibility("default"))) TS_COption_TypeZ_free(uint32_t _res) {
11597 if ((_res & 1) != 0) return;
11598 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11599 CHECK_ACCESS(_res_ptr);
11600 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
11602 COption_TypeZ_free(_res_conv);
11605 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
11606 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
11607 *ret_copy = COption_TypeZ_clone(arg);
11608 uint64_t ret_ref = (uint64_t)ret_copy;
11611 int64_t __attribute__((visibility("default"))) TS_COption_TypeZ_clone_ptr(uint32_t arg) {
11612 LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)arg;
11613 int64_t ret_val = COption_TypeZ_clone_ptr(arg_conv);
11617 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_clone(uint32_t orig) {
11618 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
11619 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
11620 *ret_copy = COption_TypeZ_clone(orig_conv);
11621 uint64_t ret_ref = (uint64_t)ret_copy;
11625 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint32_t o) {
11626 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11627 CHECK_ACCESS(o_ptr);
11628 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
11629 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uint64_t)o) & ~1));
11630 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
11631 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
11632 return (uint64_t)ret_conv;
11635 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint32_t e) {
11636 LDKDecodeError e_conv;
11637 e_conv.inner = (void*)(e & (~1));
11638 e_conv.is_owned = (e & 1) || (e == 0);
11639 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11640 e_conv = DecodeError_clone(&e_conv);
11641 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
11642 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
11643 return (uint64_t)ret_conv;
11646 jboolean __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint32_t o) {
11647 LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(o & ~1);
11648 jboolean ret_val = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
11652 void __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint32_t _res) {
11653 if ((_res & 1) != 0) return;
11654 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11655 CHECK_ACCESS(_res_ptr);
11656 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
11658 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
11661 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
11662 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
11663 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
11664 return (uint64_t)ret_conv;
11666 int64_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint32_t arg) {
11667 LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
11668 int64_t ret_val = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
11672 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint32_t orig) {
11673 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
11674 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
11675 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
11676 return (uint64_t)ret_conv;
11679 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentErrorZ_ok(int8_tArray o) {
11680 LDKThirtyTwoBytes o_ref;
11681 CHECK(*((uint32_t*)o) == 32);
11682 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
11683 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
11684 *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
11685 return (uint64_t)ret_conv;
11688 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentErrorZ_err(uint32_t e) {
11689 void* e_ptr = (void*)(((uint64_t)e) & ~1);
11690 CHECK_ACCESS(e_ptr);
11691 LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
11692 e_conv = PaymentError_clone((LDKPaymentError*)(((uint64_t)e) & ~1));
11693 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
11694 *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
11695 return (uint64_t)ret_conv;
11698 jboolean __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentErrorZ_is_ok(uint32_t o) {
11699 LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(o & ~1);
11700 jboolean ret_val = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
11704 void __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentErrorZ_free(uint32_t _res) {
11705 if ((_res & 1) != 0) return;
11706 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11707 CHECK_ACCESS(_res_ptr);
11708 LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
11710 CResult_PaymentIdPaymentErrorZ_free(_res_conv);
11713 static inline uint64_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
11714 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
11715 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
11716 return (uint64_t)ret_conv;
11718 int64_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentErrorZ_clone_ptr(uint32_t arg) {
11719 LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
11720 int64_t ret_val = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
11724 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentErrorZ_clone(uint32_t orig) {
11725 LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(orig & ~1);
11726 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
11727 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
11728 return (uint64_t)ret_conv;
11731 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_ok(uint32_t o) {
11732 LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
11733 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
11734 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
11735 return (uint64_t)ret_conv;
11738 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_err() {
11739 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
11740 *ret_conv = CResult_SiPrefixNoneZ_err();
11741 return (uint64_t)ret_conv;
11744 jboolean __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_is_ok(uint32_t o) {
11745 LDKCResult_SiPrefixNoneZ* o_conv = (LDKCResult_SiPrefixNoneZ*)(o & ~1);
11746 jboolean ret_val = CResult_SiPrefixNoneZ_is_ok(o_conv);
11750 void __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_free(uint32_t _res) {
11751 if ((_res & 1) != 0) return;
11752 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11753 CHECK_ACCESS(_res_ptr);
11754 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(_res_ptr);
11756 CResult_SiPrefixNoneZ_free(_res_conv);
11759 static inline uint64_t CResult_SiPrefixNoneZ_clone_ptr(LDKCResult_SiPrefixNoneZ *NONNULL_PTR arg) {
11760 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
11761 *ret_conv = CResult_SiPrefixNoneZ_clone(arg);
11762 return (uint64_t)ret_conv;
11764 int64_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_clone_ptr(uint32_t arg) {
11765 LDKCResult_SiPrefixNoneZ* arg_conv = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
11766 int64_t ret_val = CResult_SiPrefixNoneZ_clone_ptr(arg_conv);
11770 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_clone(uint32_t orig) {
11771 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
11772 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
11773 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
11774 return (uint64_t)ret_conv;
11777 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_ok(uint32_t o) {
11779 o_conv.inner = (void*)(o & (~1));
11780 o_conv.is_owned = (o & 1) || (o == 0);
11781 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11782 o_conv = Invoice_clone(&o_conv);
11783 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
11784 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
11785 return (uint64_t)ret_conv;
11788 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_err() {
11789 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
11790 *ret_conv = CResult_InvoiceNoneZ_err();
11791 return (uint64_t)ret_conv;
11794 jboolean __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_is_ok(uint32_t o) {
11795 LDKCResult_InvoiceNoneZ* o_conv = (LDKCResult_InvoiceNoneZ*)(o & ~1);
11796 jboolean ret_val = CResult_InvoiceNoneZ_is_ok(o_conv);
11800 void __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_free(uint32_t _res) {
11801 if ((_res & 1) != 0) return;
11802 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11803 CHECK_ACCESS(_res_ptr);
11804 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(_res_ptr);
11806 CResult_InvoiceNoneZ_free(_res_conv);
11809 static inline uint64_t CResult_InvoiceNoneZ_clone_ptr(LDKCResult_InvoiceNoneZ *NONNULL_PTR arg) {
11810 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
11811 *ret_conv = CResult_InvoiceNoneZ_clone(arg);
11812 return (uint64_t)ret_conv;
11814 int64_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_clone_ptr(uint32_t arg) {
11815 LDKCResult_InvoiceNoneZ* arg_conv = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
11816 int64_t ret_val = CResult_InvoiceNoneZ_clone_ptr(arg_conv);
11820 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_clone(uint32_t orig) {
11821 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
11822 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
11823 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
11824 return (uint64_t)ret_conv;
11827 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_ok(uint32_t o) {
11828 LDKSignedRawInvoice o_conv;
11829 o_conv.inner = (void*)(o & (~1));
11830 o_conv.is_owned = (o & 1) || (o == 0);
11831 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11832 o_conv = SignedRawInvoice_clone(&o_conv);
11833 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
11834 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
11835 return (uint64_t)ret_conv;
11838 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_err() {
11839 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
11840 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
11841 return (uint64_t)ret_conv;
11844 jboolean __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_is_ok(uint32_t o) {
11845 LDKCResult_SignedRawInvoiceNoneZ* o_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(o & ~1);
11846 jboolean ret_val = CResult_SignedRawInvoiceNoneZ_is_ok(o_conv);
11850 void __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_free(uint32_t _res) {
11851 if ((_res & 1) != 0) return;
11852 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11853 CHECK_ACCESS(_res_ptr);
11854 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(_res_ptr);
11856 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
11859 static inline uint64_t CResult_SignedRawInvoiceNoneZ_clone_ptr(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR arg) {
11860 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
11861 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(arg);
11862 return (uint64_t)ret_conv;
11864 int64_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_clone_ptr(uint32_t arg) {
11865 LDKCResult_SignedRawInvoiceNoneZ* arg_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
11866 int64_t ret_val = CResult_SignedRawInvoiceNoneZ_clone_ptr(arg_conv);
11870 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_clone(uint32_t orig) {
11871 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
11872 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
11873 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
11874 return (uint64_t)ret_conv;
11877 static inline uint64_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
11878 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
11879 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
11880 return ((uint64_t)ret_conv);
11882 int64_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(uint32_t arg) {
11883 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(arg & ~1);
11884 int64_t ret_val = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
11888 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint32_t orig) {
11889 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
11890 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
11891 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
11892 return ((uint64_t)ret_conv);
11895 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint32_t a, int8_tArray b, uint32_t c) {
11896 LDKRawInvoice a_conv;
11897 a_conv.inner = (void*)(a & (~1));
11898 a_conv.is_owned = (a & 1) || (a == 0);
11899 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
11900 a_conv = RawInvoice_clone(&a_conv);
11901 LDKThirtyTwoBytes b_ref;
11902 CHECK(*((uint32_t*)b) == 32);
11903 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
11904 LDKInvoiceSignature c_conv;
11905 c_conv.inner = (void*)(c & (~1));
11906 c_conv.is_owned = (c & 1) || (c == 0);
11907 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
11908 c_conv = InvoiceSignature_clone(&c_conv);
11909 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
11910 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
11911 return ((uint64_t)ret_conv);
11914 void __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint32_t _res) {
11915 if ((_res & 1) != 0) return;
11916 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11917 CHECK_ACCESS(_res_ptr);
11918 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
11920 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
11923 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_ok(uint32_t o) {
11924 LDKPayeePubKey o_conv;
11925 o_conv.inner = (void*)(o & (~1));
11926 o_conv.is_owned = (o & 1) || (o == 0);
11927 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11928 o_conv = PayeePubKey_clone(&o_conv);
11929 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
11930 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
11931 return (uint64_t)ret_conv;
11934 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
11935 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11936 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
11937 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
11938 return (uint64_t)ret_conv;
11941 jboolean __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_is_ok(uint32_t o) {
11942 LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)(o & ~1);
11943 jboolean ret_val = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
11947 void __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_free(uint32_t _res) {
11948 if ((_res & 1) != 0) return;
11949 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11950 CHECK_ACCESS(_res_ptr);
11951 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
11953 CResult_PayeePubKeyErrorZ_free(_res_conv);
11956 static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
11957 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
11958 *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
11959 return (uint64_t)ret_conv;
11961 int64_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_clone_ptr(uint32_t arg) {
11962 LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
11963 int64_t ret_val = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
11967 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_clone(uint32_t orig) {
11968 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
11969 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
11970 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
11971 return (uint64_t)ret_conv;
11974 void __attribute__((visibility("default"))) TS_CVec_PrivateRouteZ_free(uint32_tArray _res) {
11975 LDKCVec_PrivateRouteZ _res_constr;
11976 _res_constr.datalen = *((uint32_t*)_res);
11977 if (_res_constr.datalen > 0)
11978 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
11980 _res_constr.data = NULL;
11981 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11982 for (size_t o = 0; o < _res_constr.datalen; o++) {
11983 uint32_t _res_conv_14 = _res_vals[o];
11984 LDKPrivateRoute _res_conv_14_conv;
11985 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
11986 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
11987 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
11988 _res_constr.data[o] = _res_conv_14_conv;
11990 CVec_PrivateRouteZ_free(_res_constr);
11993 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint32_t o) {
11994 LDKPositiveTimestamp o_conv;
11995 o_conv.inner = (void*)(o & (~1));
11996 o_conv.is_owned = (o & 1) || (o == 0);
11997 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11998 o_conv = PositiveTimestamp_clone(&o_conv);
11999 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
12000 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
12001 return (uint64_t)ret_conv;
12004 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
12005 LDKCreationError e_conv = LDKCreationError_from_js(e);
12006 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
12007 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
12008 return (uint64_t)ret_conv;
12011 jboolean __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint32_t o) {
12012 LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(o & ~1);
12013 jboolean ret_val = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
12017 void __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint32_t _res) {
12018 if ((_res & 1) != 0) return;
12019 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12020 CHECK_ACCESS(_res_ptr);
12021 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
12023 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
12026 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
12027 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
12028 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
12029 return (uint64_t)ret_conv;
12031 int64_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint32_t arg) {
12032 LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
12033 int64_t ret_val = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
12037 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint32_t orig) {
12038 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
12039 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
12040 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
12041 return (uint64_t)ret_conv;
12044 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_ok() {
12045 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
12046 *ret_conv = CResult_NoneSemanticErrorZ_ok();
12047 return (uint64_t)ret_conv;
12050 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
12051 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
12052 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
12053 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
12054 return (uint64_t)ret_conv;
12057 jboolean __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_is_ok(uint32_t o) {
12058 LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)(o & ~1);
12059 jboolean ret_val = CResult_NoneSemanticErrorZ_is_ok(o_conv);
12063 void __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_free(uint32_t _res) {
12064 if ((_res & 1) != 0) return;
12065 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12066 CHECK_ACCESS(_res_ptr);
12067 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
12069 CResult_NoneSemanticErrorZ_free(_res_conv);
12072 static inline uint64_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
12073 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
12074 *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
12075 return (uint64_t)ret_conv;
12077 int64_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_clone_ptr(uint32_t arg) {
12078 LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
12079 int64_t ret_val = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
12083 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_clone(uint32_t orig) {
12084 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
12085 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
12086 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
12087 return (uint64_t)ret_conv;
12090 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint32_t o) {
12092 o_conv.inner = (void*)(o & (~1));
12093 o_conv.is_owned = (o & 1) || (o == 0);
12094 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12095 o_conv = Invoice_clone(&o_conv);
12096 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
12097 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
12098 return (uint64_t)ret_conv;
12101 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
12102 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
12103 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
12104 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
12105 return (uint64_t)ret_conv;
12108 jboolean __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_is_ok(uint32_t o) {
12109 LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)(o & ~1);
12110 jboolean ret_val = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
12114 void __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_free(uint32_t _res) {
12115 if ((_res & 1) != 0) return;
12116 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12117 CHECK_ACCESS(_res_ptr);
12118 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
12120 CResult_InvoiceSemanticErrorZ_free(_res_conv);
12123 static inline uint64_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
12124 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
12125 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
12126 return (uint64_t)ret_conv;
12128 int64_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_clone_ptr(uint32_t arg) {
12129 LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
12130 int64_t ret_val = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
12134 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint32_t orig) {
12135 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
12136 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
12137 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
12138 return (uint64_t)ret_conv;
12141 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_ok(uint32_t o) {
12142 LDKDescription o_conv;
12143 o_conv.inner = (void*)(o & (~1));
12144 o_conv.is_owned = (o & 1) || (o == 0);
12145 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12146 o_conv = Description_clone(&o_conv);
12147 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
12148 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
12149 return (uint64_t)ret_conv;
12152 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
12153 LDKCreationError e_conv = LDKCreationError_from_js(e);
12154 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
12155 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
12156 return (uint64_t)ret_conv;
12159 jboolean __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint32_t o) {
12160 LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)(o & ~1);
12161 jboolean ret_val = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
12165 void __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_free(uint32_t _res) {
12166 if ((_res & 1) != 0) return;
12167 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12168 CHECK_ACCESS(_res_ptr);
12169 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
12171 CResult_DescriptionCreationErrorZ_free(_res_conv);
12174 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
12175 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
12176 *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
12177 return (uint64_t)ret_conv;
12179 int64_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint32_t arg) {
12180 LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
12181 int64_t ret_val = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
12185 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_clone(uint32_t orig) {
12186 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
12187 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
12188 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
12189 return (uint64_t)ret_conv;
12192 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_ok(uint32_t o) {
12193 LDKExpiryTime o_conv;
12194 o_conv.inner = (void*)(o & (~1));
12195 o_conv.is_owned = (o & 1) || (o == 0);
12196 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12197 o_conv = ExpiryTime_clone(&o_conv);
12198 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
12199 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
12200 return (uint64_t)ret_conv;
12203 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_err(uint32_t e) {
12204 LDKCreationError e_conv = LDKCreationError_from_js(e);
12205 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
12206 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
12207 return (uint64_t)ret_conv;
12210 jboolean __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_is_ok(uint32_t o) {
12211 LDKCResult_ExpiryTimeCreationErrorZ* o_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(o & ~1);
12212 jboolean ret_val = CResult_ExpiryTimeCreationErrorZ_is_ok(o_conv);
12216 void __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_free(uint32_t _res) {
12217 if ((_res & 1) != 0) return;
12218 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12219 CHECK_ACCESS(_res_ptr);
12220 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(_res_ptr);
12222 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
12225 static inline uint64_t CResult_ExpiryTimeCreationErrorZ_clone_ptr(LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR arg) {
12226 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
12227 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(arg);
12228 return (uint64_t)ret_conv;
12230 int64_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_clone_ptr(uint32_t arg) {
12231 LDKCResult_ExpiryTimeCreationErrorZ* arg_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
12232 int64_t ret_val = CResult_ExpiryTimeCreationErrorZ_clone_ptr(arg_conv);
12236 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_clone(uint32_t orig) {
12237 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
12238 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
12239 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
12240 return (uint64_t)ret_conv;
12243 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint32_t o) {
12244 LDKPrivateRoute o_conv;
12245 o_conv.inner = (void*)(o & (~1));
12246 o_conv.is_owned = (o & 1) || (o == 0);
12247 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12248 o_conv = PrivateRoute_clone(&o_conv);
12249 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
12250 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
12251 return (uint64_t)ret_conv;
12254 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
12255 LDKCreationError e_conv = LDKCreationError_from_js(e);
12256 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
12257 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
12258 return (uint64_t)ret_conv;
12261 jboolean __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint32_t o) {
12262 LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(o & ~1);
12263 jboolean ret_val = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
12267 void __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint32_t _res) {
12268 if ((_res & 1) != 0) return;
12269 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12270 CHECK_ACCESS(_res_ptr);
12271 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
12273 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
12276 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
12277 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
12278 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
12279 return (uint64_t)ret_conv;
12281 int64_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint32_t arg) {
12282 LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
12283 int64_t ret_val = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
12287 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint32_t orig) {
12288 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
12289 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
12290 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
12291 return (uint64_t)ret_conv;
12294 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_ok(jstring o) {
12295 LDKStr o_conv = str_ref_to_owned_c(o);
12296 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
12297 *ret_conv = CResult_StringErrorZ_ok(o_conv);
12298 return (uint64_t)ret_conv;
12301 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_err(uint32_t e) {
12302 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
12303 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
12304 *ret_conv = CResult_StringErrorZ_err(e_conv);
12305 return (uint64_t)ret_conv;
12308 jboolean __attribute__((visibility("default"))) TS_CResult_StringErrorZ_is_ok(uint32_t o) {
12309 LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)(o & ~1);
12310 jboolean ret_val = CResult_StringErrorZ_is_ok(o_conv);
12314 void __attribute__((visibility("default"))) TS_CResult_StringErrorZ_free(uint32_t _res) {
12315 if ((_res & 1) != 0) return;
12316 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12317 CHECK_ACCESS(_res_ptr);
12318 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
12320 CResult_StringErrorZ_free(_res_conv);
12323 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
12324 LDKChannelMonitorUpdate o_conv;
12325 o_conv.inner = (void*)(o & (~1));
12326 o_conv.is_owned = (o & 1) || (o == 0);
12327 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12328 o_conv = ChannelMonitorUpdate_clone(&o_conv);
12329 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
12330 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
12331 return (uint64_t)ret_conv;
12334 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
12335 LDKDecodeError e_conv;
12336 e_conv.inner = (void*)(e & (~1));
12337 e_conv.is_owned = (e & 1) || (e == 0);
12338 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12339 e_conv = DecodeError_clone(&e_conv);
12340 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
12341 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
12342 return (uint64_t)ret_conv;
12345 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint32_t o) {
12346 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(o & ~1);
12347 jboolean ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
12351 void __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
12352 if ((_res & 1) != 0) return;
12353 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12354 CHECK_ACCESS(_res_ptr);
12355 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
12357 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
12360 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
12361 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
12362 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
12363 return (uint64_t)ret_conv;
12365 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
12366 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
12367 int64_t ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
12371 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
12372 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
12373 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
12374 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
12375 return (uint64_t)ret_conv;
12378 uint32_t __attribute__((visibility("default"))) TS_COption_MonitorEventZ_some(uint32_t o) {
12379 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12380 CHECK_ACCESS(o_ptr);
12381 LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
12382 o_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)o) & ~1));
12383 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
12384 *ret_copy = COption_MonitorEventZ_some(o_conv);
12385 uint64_t ret_ref = (uint64_t)ret_copy;
12389 uint32_t __attribute__((visibility("default"))) TS_COption_MonitorEventZ_none() {
12390 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
12391 *ret_copy = COption_MonitorEventZ_none();
12392 uint64_t ret_ref = (uint64_t)ret_copy;
12396 void __attribute__((visibility("default"))) TS_COption_MonitorEventZ_free(uint32_t _res) {
12397 if ((_res & 1) != 0) return;
12398 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12399 CHECK_ACCESS(_res_ptr);
12400 LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
12402 COption_MonitorEventZ_free(_res_conv);
12405 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
12406 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
12407 *ret_copy = COption_MonitorEventZ_clone(arg);
12408 uint64_t ret_ref = (uint64_t)ret_copy;
12411 int64_t __attribute__((visibility("default"))) TS_COption_MonitorEventZ_clone_ptr(uint32_t arg) {
12412 LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)arg;
12413 int64_t ret_val = COption_MonitorEventZ_clone_ptr(arg_conv);
12417 uint32_t __attribute__((visibility("default"))) TS_COption_MonitorEventZ_clone(uint32_t orig) {
12418 LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)orig;
12419 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
12420 *ret_copy = COption_MonitorEventZ_clone(orig_conv);
12421 uint64_t ret_ref = (uint64_t)ret_copy;
12425 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint32_t o) {
12426 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12427 CHECK_ACCESS(o_ptr);
12428 LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
12429 o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)(((uint64_t)o) & ~1));
12430 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
12431 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
12432 return (uint64_t)ret_conv;
12435 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint32_t e) {
12436 LDKDecodeError e_conv;
12437 e_conv.inner = (void*)(e & (~1));
12438 e_conv.is_owned = (e & 1) || (e == 0);
12439 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12440 e_conv = DecodeError_clone(&e_conv);
12441 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
12442 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
12443 return (uint64_t)ret_conv;
12446 jboolean __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint32_t o) {
12447 LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(o & ~1);
12448 jboolean ret_val = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
12452 void __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint32_t _res) {
12453 if ((_res & 1) != 0) return;
12454 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12455 CHECK_ACCESS(_res_ptr);
12456 LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
12458 CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
12461 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
12462 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
12463 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
12464 return (uint64_t)ret_conv;
12466 int64_t __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint32_t arg) {
12467 LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
12468 int64_t ret_val = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
12472 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint32_t orig) {
12473 LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(orig & ~1);
12474 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
12475 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
12476 return (uint64_t)ret_conv;
12479 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
12480 LDKHTLCUpdate o_conv;
12481 o_conv.inner = (void*)(o & (~1));
12482 o_conv.is_owned = (o & 1) || (o == 0);
12483 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12484 o_conv = HTLCUpdate_clone(&o_conv);
12485 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
12486 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
12487 return (uint64_t)ret_conv;
12490 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
12491 LDKDecodeError e_conv;
12492 e_conv.inner = (void*)(e & (~1));
12493 e_conv.is_owned = (e & 1) || (e == 0);
12494 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12495 e_conv = DecodeError_clone(&e_conv);
12496 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
12497 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
12498 return (uint64_t)ret_conv;
12501 jboolean __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint32_t o) {
12502 LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(o & ~1);
12503 jboolean ret_val = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
12507 void __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
12508 if ((_res & 1) != 0) return;
12509 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12510 CHECK_ACCESS(_res_ptr);
12511 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
12513 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
12516 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
12517 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
12518 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
12519 return (uint64_t)ret_conv;
12521 int64_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
12522 LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
12523 int64_t ret_val = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
12527 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
12528 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
12529 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
12530 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
12531 return (uint64_t)ret_conv;
12534 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_ok() {
12535 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
12536 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
12537 return (uint64_t)ret_conv;
12540 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_err(uint32_t e) {
12541 LDKMonitorUpdateError e_conv;
12542 e_conv.inner = (void*)(e & (~1));
12543 e_conv.is_owned = (e & 1) || (e == 0);
12544 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12545 e_conv = MonitorUpdateError_clone(&e_conv);
12546 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
12547 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
12548 return (uint64_t)ret_conv;
12551 jboolean __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_is_ok(uint32_t o) {
12552 LDKCResult_NoneMonitorUpdateErrorZ* o_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(o & ~1);
12553 jboolean ret_val = CResult_NoneMonitorUpdateErrorZ_is_ok(o_conv);
12557 void __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_free(uint32_t _res) {
12558 if ((_res & 1) != 0) return;
12559 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12560 CHECK_ACCESS(_res_ptr);
12561 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(_res_ptr);
12563 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
12566 static inline uint64_t CResult_NoneMonitorUpdateErrorZ_clone_ptr(LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR arg) {
12567 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
12568 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(arg);
12569 return (uint64_t)ret_conv;
12571 int64_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_clone_ptr(uint32_t arg) {
12572 LDKCResult_NoneMonitorUpdateErrorZ* arg_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
12573 int64_t ret_val = CResult_NoneMonitorUpdateErrorZ_clone_ptr(arg_conv);
12577 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_clone(uint32_t orig) {
12578 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
12579 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
12580 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
12581 return (uint64_t)ret_conv;
12584 static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
12585 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
12586 *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
12587 return ((uint64_t)ret_conv);
12589 int64_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_clone_ptr(uint32_t arg) {
12590 LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)(arg & ~1);
12591 int64_t ret_val = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
12595 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_clone(uint32_t orig) {
12596 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
12597 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
12598 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
12599 return ((uint64_t)ret_conv);
12602 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
12603 LDKOutPoint a_conv;
12604 a_conv.inner = (void*)(a & (~1));
12605 a_conv.is_owned = (a & 1) || (a == 0);
12606 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
12607 a_conv = OutPoint_clone(&a_conv);
12609 b_ref.datalen = *((uint32_t*)b);
12610 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
12611 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
12612 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
12613 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
12614 return ((uint64_t)ret_conv);
12617 void __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_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 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
12623 C2Tuple_OutPointScriptZ_free(_res_conv);
12626 static inline uint64_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
12627 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
12628 *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
12629 return ((uint64_t)ret_conv);
12631 int64_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_clone_ptr(uint32_t arg) {
12632 LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)(arg & ~1);
12633 int64_t ret_val = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
12637 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_clone(uint32_t orig) {
12638 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
12639 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
12640 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
12641 return ((uint64_t)ret_conv);
12644 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
12646 b_ref.datalen = *((uint32_t*)b);
12647 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
12648 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
12649 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
12650 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
12651 return ((uint64_t)ret_conv);
12654 void __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_free(uint32_t _res) {
12655 if ((_res & 1) != 0) return;
12656 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12657 CHECK_ACCESS(_res_ptr);
12658 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
12660 C2Tuple_u32ScriptZ_free(_res_conv);
12663 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint32_tArray _res) {
12664 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
12665 _res_constr.datalen = *((uint32_t*)_res);
12666 if (_res_constr.datalen > 0)
12667 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
12669 _res_constr.data = NULL;
12670 uint32_t* _res_vals = (uint32_t*)(_res + 4);
12671 for (size_t v = 0; v < _res_constr.datalen; v++) {
12672 uint32_t _res_conv_21 = _res_vals[v];
12673 void* _res_conv_21_ptr = (void*)(((uint64_t)_res_conv_21) & ~1);
12674 CHECK_ACCESS(_res_conv_21_ptr);
12675 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
12676 FREE((void*)_res_conv_21);
12677 _res_constr.data[v] = _res_conv_21_conv;
12679 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
12682 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
12683 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
12684 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
12685 return ((uint64_t)ret_conv);
12687 int64_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(uint32_t arg) {
12688 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(arg & ~1);
12689 int64_t ret_val = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
12693 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint32_t orig) {
12694 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
12695 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
12696 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
12697 return ((uint64_t)ret_conv);
12700 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
12701 LDKThirtyTwoBytes a_ref;
12702 CHECK(*((uint32_t*)a) == 32);
12703 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
12704 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
12705 b_constr.datalen = *((uint32_t*)b);
12706 if (b_constr.datalen > 0)
12707 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
12709 b_constr.data = NULL;
12710 uint32_t* b_vals = (uint32_t*)(b + 4);
12711 for (size_t v = 0; v < b_constr.datalen; v++) {
12712 uint32_t b_conv_21 = b_vals[v];
12713 void* b_conv_21_ptr = (void*)(((uint64_t)b_conv_21) & ~1);
12714 CHECK_ACCESS(b_conv_21_ptr);
12715 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
12716 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_21) & ~1));
12717 b_constr.data[v] = b_conv_21_conv;
12719 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
12720 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
12721 return ((uint64_t)ret_conv);
12724 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint32_t _res) {
12725 if ((_res & 1) != 0) return;
12726 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12727 CHECK_ACCESS(_res_ptr);
12728 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
12730 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
12733 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint32_tArray _res) {
12734 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
12735 _res_constr.datalen = *((uint32_t*)_res);
12736 if (_res_constr.datalen > 0)
12737 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
12739 _res_constr.data = NULL;
12740 uint32_t* _res_vals = (uint32_t*)(_res + 4);
12741 for (size_t o = 0; o < _res_constr.datalen; o++) {
12742 uint32_t _res_conv_40 = _res_vals[o];
12743 void* _res_conv_40_ptr = (void*)(((uint64_t)_res_conv_40) & ~1);
12744 CHECK_ACCESS(_res_conv_40_ptr);
12745 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
12746 FREE((void*)_res_conv_40);
12747 _res_constr.data[o] = _res_conv_40_conv;
12749 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
12752 void __attribute__((visibility("default"))) TS_CVec_EventZ_free(uint32_tArray _res) {
12753 LDKCVec_EventZ _res_constr;
12754 _res_constr.datalen = *((uint32_t*)_res);
12755 if (_res_constr.datalen > 0)
12756 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
12758 _res_constr.data = NULL;
12759 uint32_t* _res_vals = (uint32_t*)(_res + 4);
12760 for (size_t h = 0; h < _res_constr.datalen; h++) {
12761 uint32_t _res_conv_7 = _res_vals[h];
12762 void* _res_conv_7_ptr = (void*)(((uint64_t)_res_conv_7) & ~1);
12763 CHECK_ACCESS(_res_conv_7_ptr);
12764 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
12765 FREE((void*)_res_conv_7);
12766 _res_constr.data[h] = _res_conv_7_conv;
12768 CVec_EventZ_free(_res_constr);
12771 void __attribute__((visibility("default"))) TS_CVec_TransactionZ_free(ptrArray _res) {
12772 LDKCVec_TransactionZ _res_constr;
12773 _res_constr.datalen = *((uint32_t*)_res);
12774 if (_res_constr.datalen > 0)
12775 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
12777 _res_constr.data = NULL;
12778 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
12779 for (size_t m = 0; m < _res_constr.datalen; m++) {
12780 int8_tArray _res_conv_12 = _res_vals[m];
12781 LDKTransaction _res_conv_12_ref;
12782 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
12783 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
12784 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
12785 _res_conv_12_ref.data_is_owned = true;
12786 _res_constr.data[m] = _res_conv_12_ref;
12788 CVec_TransactionZ_free(_res_constr);
12791 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
12792 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
12793 *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
12794 return ((uint64_t)ret_conv);
12796 int64_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint32_t arg) {
12797 LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)(arg & ~1);
12798 int64_t ret_val = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
12802 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
12803 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
12804 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
12805 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
12806 return ((uint64_t)ret_conv);
12809 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
12810 void* b_ptr = (void*)(((uint64_t)b) & ~1);
12811 CHECK_ACCESS(b_ptr);
12812 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
12813 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
12814 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
12815 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
12816 return ((uint64_t)ret_conv);
12819 void __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
12820 if ((_res & 1) != 0) return;
12821 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12822 CHECK_ACCESS(_res_ptr);
12823 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
12825 C2Tuple_u32TxOutZ_free(_res_conv);
12828 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
12829 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
12830 _res_constr.datalen = *((uint32_t*)_res);
12831 if (_res_constr.datalen > 0)
12832 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
12834 _res_constr.data = NULL;
12835 uint32_t* _res_vals = (uint32_t*)(_res + 4);
12836 for (size_t u = 0; u < _res_constr.datalen; u++) {
12837 uint32_t _res_conv_20 = _res_vals[u];
12838 void* _res_conv_20_ptr = (void*)(((uint64_t)_res_conv_20) & ~1);
12839 CHECK_ACCESS(_res_conv_20_ptr);
12840 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
12841 FREE((void*)_res_conv_20);
12842 _res_constr.data[u] = _res_conv_20_conv;
12844 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
12847 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
12848 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
12849 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
12850 return ((uint64_t)ret_conv);
12852 int64_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint32_t arg) {
12853 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arg & ~1);
12854 int64_t ret_val = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
12858 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint32_t orig) {
12859 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
12860 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
12861 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
12862 return ((uint64_t)ret_conv);
12865 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
12866 LDKThirtyTwoBytes a_ref;
12867 CHECK(*((uint32_t*)a) == 32);
12868 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
12869 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
12870 b_constr.datalen = *((uint32_t*)b);
12871 if (b_constr.datalen > 0)
12872 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
12874 b_constr.data = NULL;
12875 uint32_t* b_vals = (uint32_t*)(b + 4);
12876 for (size_t u = 0; u < b_constr.datalen; u++) {
12877 uint32_t b_conv_20 = b_vals[u];
12878 void* b_conv_20_ptr = (void*)(((uint64_t)b_conv_20) & ~1);
12879 CHECK_ACCESS(b_conv_20_ptr);
12880 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
12881 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1));
12882 b_constr.data[u] = b_conv_20_conv;
12884 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
12885 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
12886 return ((uint64_t)ret_conv);
12889 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
12890 if ((_res & 1) != 0) return;
12891 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12892 CHECK_ACCESS(_res_ptr);
12893 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
12895 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
12898 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
12899 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
12900 _res_constr.datalen = *((uint32_t*)_res);
12901 if (_res_constr.datalen > 0)
12902 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
12904 _res_constr.data = NULL;
12905 uint32_t* _res_vals = (uint32_t*)(_res + 4);
12906 for (size_t n = 0; n < _res_constr.datalen; n++) {
12907 uint32_t _res_conv_39 = _res_vals[n];
12908 void* _res_conv_39_ptr = (void*)(((uint64_t)_res_conv_39) & ~1);
12909 CHECK_ACCESS(_res_conv_39_ptr);
12910 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
12911 FREE((void*)_res_conv_39);
12912 _res_constr.data[n] = _res_conv_39_conv;
12914 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
12917 void __attribute__((visibility("default"))) TS_CVec_BalanceZ_free(uint32_tArray _res) {
12918 LDKCVec_BalanceZ _res_constr;
12919 _res_constr.datalen = *((uint32_t*)_res);
12920 if (_res_constr.datalen > 0)
12921 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
12923 _res_constr.data = NULL;
12924 uint32_t* _res_vals = (uint32_t*)(_res + 4);
12925 for (size_t j = 0; j < _res_constr.datalen; j++) {
12926 uint32_t _res_conv_9 = _res_vals[j];
12927 void* _res_conv_9_ptr = (void*)(((uint64_t)_res_conv_9) & ~1);
12928 CHECK_ACCESS(_res_conv_9_ptr);
12929 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
12930 FREE((void*)_res_conv_9);
12931 _res_constr.data[j] = _res_conv_9_conv;
12933 CVec_BalanceZ_free(_res_constr);
12936 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
12937 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12938 CHECK_ACCESS(o_ptr);
12939 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
12940 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1));
12941 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
12942 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
12943 return (uint64_t)ret_conv;
12946 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
12947 LDKDecodeError e_conv;
12948 e_conv.inner = (void*)(e & (~1));
12949 e_conv.is_owned = (e & 1) || (e == 0);
12950 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12951 e_conv = DecodeError_clone(&e_conv);
12952 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
12953 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
12954 return (uint64_t)ret_conv;
12957 jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint32_t o) {
12958 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(o & ~1);
12959 jboolean ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
12963 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
12964 if ((_res & 1) != 0) return;
12965 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12966 CHECK_ACCESS(_res_ptr);
12967 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
12969 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
12972 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
12973 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
12974 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
12975 return (uint64_t)ret_conv;
12977 int64_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint32_t arg) {
12978 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
12979 int64_t ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
12983 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint32_t orig) {
12984 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
12985 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
12986 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
12987 return (uint64_t)ret_conv;
12990 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_ok() {
12991 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12992 *ret_conv = CResult_NoneLightningErrorZ_ok();
12993 return (uint64_t)ret_conv;
12996 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
12997 LDKLightningError e_conv;
12998 e_conv.inner = (void*)(e & (~1));
12999 e_conv.is_owned = (e & 1) || (e == 0);
13000 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13001 e_conv = LightningError_clone(&e_conv);
13002 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13003 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
13004 return (uint64_t)ret_conv;
13007 jboolean __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_is_ok(uint32_t o) {
13008 LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)(o & ~1);
13009 jboolean ret_val = CResult_NoneLightningErrorZ_is_ok(o_conv);
13013 void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
13014 if ((_res & 1) != 0) return;
13015 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13016 CHECK_ACCESS(_res_ptr);
13017 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
13019 CResult_NoneLightningErrorZ_free(_res_conv);
13022 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
13023 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13024 *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
13025 return (uint64_t)ret_conv;
13027 int64_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint32_t arg) {
13028 LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
13029 int64_t ret_val = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
13033 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
13034 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
13035 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13036 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
13037 return (uint64_t)ret_conv;
13040 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
13041 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
13042 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
13043 return ((uint64_t)ret_conv);
13045 int64_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint32_t arg) {
13046 LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)(arg & ~1);
13047 int64_t ret_val = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
13051 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint32_t orig) {
13052 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
13053 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
13054 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
13055 return ((uint64_t)ret_conv);
13058 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
13059 LDKPublicKey a_ref;
13060 CHECK(*((uint32_t*)a) == 33);
13061 memcpy(a_ref.compressed_form, (uint8_t*)(a + 4), 33);
13062 void* b_ptr = (void*)(((uint64_t)b) & ~1);
13063 CHECK_ACCESS(b_ptr);
13064 LDKType b_conv = *(LDKType*)(b_ptr);
13065 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
13066 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
13067 return ((uint64_t)ret_conv);
13070 void __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_free(uint32_t _res) {
13071 if ((_res & 1) != 0) return;
13072 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13073 CHECK_ACCESS(_res_ptr);
13074 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
13076 C2Tuple_PublicKeyTypeZ_free(_res_conv);
13079 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint32_tArray _res) {
13080 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
13081 _res_constr.datalen = *((uint32_t*)_res);
13082 if (_res_constr.datalen > 0)
13083 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
13085 _res_constr.data = NULL;
13086 uint32_t* _res_vals = (uint32_t*)(_res + 4);
13087 for (size_t z = 0; z < _res_constr.datalen; z++) {
13088 uint32_t _res_conv_25 = _res_vals[z];
13089 void* _res_conv_25_ptr = (void*)(((uint64_t)_res_conv_25) & ~1);
13090 CHECK_ACCESS(_res_conv_25_ptr);
13091 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
13092 FREE((void*)_res_conv_25);
13093 _res_constr.data[z] = _res_conv_25_conv;
13095 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
13098 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
13099 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13100 *ret_conv = CResult_boolLightningErrorZ_ok(o);
13101 return (uint64_t)ret_conv;
13104 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
13105 LDKLightningError e_conv;
13106 e_conv.inner = (void*)(e & (~1));
13107 e_conv.is_owned = (e & 1) || (e == 0);
13108 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13109 e_conv = LightningError_clone(&e_conv);
13110 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13111 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
13112 return (uint64_t)ret_conv;
13115 jboolean __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_is_ok(uint32_t o) {
13116 LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)(o & ~1);
13117 jboolean ret_val = CResult_boolLightningErrorZ_is_ok(o_conv);
13121 void __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_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 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
13127 CResult_boolLightningErrorZ_free(_res_conv);
13130 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
13131 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13132 *ret_conv = CResult_boolLightningErrorZ_clone(arg);
13133 return (uint64_t)ret_conv;
13135 int64_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint32_t arg) {
13136 LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
13137 int64_t ret_val = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
13141 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
13142 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
13143 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13144 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
13145 return (uint64_t)ret_conv;
13148 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
13149 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13150 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
13151 return ((uint64_t)ret_conv);
13153 int64_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint32_t arg) {
13154 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arg & ~1);
13155 int64_t ret_val = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
13159 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
13160 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
13161 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13162 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
13163 return ((uint64_t)ret_conv);
13166 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
13167 LDKChannelAnnouncement a_conv;
13168 a_conv.inner = (void*)(a & (~1));
13169 a_conv.is_owned = (a & 1) || (a == 0);
13170 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
13171 a_conv = ChannelAnnouncement_clone(&a_conv);
13172 LDKChannelUpdate b_conv;
13173 b_conv.inner = (void*)(b & (~1));
13174 b_conv.is_owned = (b & 1) || (b == 0);
13175 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
13176 b_conv = ChannelUpdate_clone(&b_conv);
13177 LDKChannelUpdate c_conv;
13178 c_conv.inner = (void*)(c & (~1));
13179 c_conv.is_owned = (c & 1) || (c == 0);
13180 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
13181 c_conv = ChannelUpdate_clone(&c_conv);
13182 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13183 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
13184 return ((uint64_t)ret_conv);
13187 void __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
13188 if ((_res & 1) != 0) return;
13189 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13190 CHECK_ACCESS(_res_ptr);
13191 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
13193 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
13196 void __attribute__((visibility("default"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
13197 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
13198 _res_constr.datalen = *((uint32_t*)_res);
13199 if (_res_constr.datalen > 0)
13200 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
13202 _res_constr.data = NULL;
13203 uint32_t* _res_vals = (uint32_t*)(_res + 4);
13204 for (size_t h = 0; h < _res_constr.datalen; h++) {
13205 uint32_t _res_conv_59 = _res_vals[h];
13206 void* _res_conv_59_ptr = (void*)(((uint64_t)_res_conv_59) & ~1);
13207 CHECK_ACCESS(_res_conv_59_ptr);
13208 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
13209 FREE((void*)_res_conv_59);
13210 _res_constr.data[h] = _res_conv_59_conv;
13212 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
13215 void __attribute__((visibility("default"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
13216 LDKCVec_NodeAnnouncementZ _res_constr;
13217 _res_constr.datalen = *((uint32_t*)_res);
13218 if (_res_constr.datalen > 0)
13219 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
13221 _res_constr.data = NULL;
13222 uint32_t* _res_vals = (uint32_t*)(_res + 4);
13223 for (size_t s = 0; s < _res_constr.datalen; s++) {
13224 uint32_t _res_conv_18 = _res_vals[s];
13225 LDKNodeAnnouncement _res_conv_18_conv;
13226 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
13227 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
13228 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
13229 _res_constr.data[s] = _res_conv_18_conv;
13231 CVec_NodeAnnouncementZ_free(_res_constr);
13234 void __attribute__((visibility("default"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
13235 LDKCVec_PublicKeyZ _res_constr;
13236 _res_constr.datalen = *((uint32_t*)_res);
13237 if (_res_constr.datalen > 0)
13238 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
13240 _res_constr.data = NULL;
13241 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
13242 for (size_t m = 0; m < _res_constr.datalen; m++) {
13243 int8_tArray _res_conv_12 = _res_vals[m];
13244 LDKPublicKey _res_conv_12_ref;
13245 CHECK(*((uint32_t*)_res_conv_12) == 33);
13246 memcpy(_res_conv_12_ref.compressed_form, (uint8_t*)(_res_conv_12 + 4), 33);
13247 _res_constr.data[m] = _res_conv_12_ref;
13249 CVec_PublicKeyZ_free(_res_constr);
13252 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
13254 o_ref.datalen = *((uint32_t*)o);
13255 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
13256 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
13257 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
13258 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
13259 return (uint64_t)ret_conv;
13262 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
13263 LDKPeerHandleError e_conv;
13264 e_conv.inner = (void*)(e & (~1));
13265 e_conv.is_owned = (e & 1) || (e == 0);
13266 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13267 e_conv = PeerHandleError_clone(&e_conv);
13268 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
13269 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
13270 return (uint64_t)ret_conv;
13273 jboolean __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint32_t o) {
13274 LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(o & ~1);
13275 jboolean ret_val = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
13279 void __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
13280 if ((_res & 1) != 0) return;
13281 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13282 CHECK_ACCESS(_res_ptr);
13283 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
13285 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
13288 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
13289 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
13290 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
13291 return (uint64_t)ret_conv;
13293 int64_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint32_t arg) {
13294 LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
13295 int64_t ret_val = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
13299 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
13300 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
13301 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
13302 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
13303 return (uint64_t)ret_conv;
13306 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_ok() {
13307 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
13308 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
13309 return (uint64_t)ret_conv;
13312 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
13313 LDKPeerHandleError e_conv;
13314 e_conv.inner = (void*)(e & (~1));
13315 e_conv.is_owned = (e & 1) || (e == 0);
13316 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13317 e_conv = PeerHandleError_clone(&e_conv);
13318 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
13319 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
13320 return (uint64_t)ret_conv;
13323 jboolean __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint32_t o) {
13324 LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)(o & ~1);
13325 jboolean ret_val = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
13329 void __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
13330 if ((_res & 1) != 0) return;
13331 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13332 CHECK_ACCESS(_res_ptr);
13333 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
13335 CResult_NonePeerHandleErrorZ_free(_res_conv);
13338 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
13339 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
13340 *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
13341 return (uint64_t)ret_conv;
13343 int64_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint32_t arg) {
13344 LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
13345 int64_t ret_val = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
13349 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
13350 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
13351 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
13352 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
13353 return (uint64_t)ret_conv;
13356 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
13357 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
13358 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
13359 return (uint64_t)ret_conv;
13362 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
13363 LDKPeerHandleError e_conv;
13364 e_conv.inner = (void*)(e & (~1));
13365 e_conv.is_owned = (e & 1) || (e == 0);
13366 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13367 e_conv = PeerHandleError_clone(&e_conv);
13368 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
13369 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
13370 return (uint64_t)ret_conv;
13373 jboolean __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint32_t o) {
13374 LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)(o & ~1);
13375 jboolean ret_val = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
13379 void __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
13380 if ((_res & 1) != 0) return;
13381 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13382 CHECK_ACCESS(_res_ptr);
13383 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
13385 CResult_boolPeerHandleErrorZ_free(_res_conv);
13388 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
13389 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
13390 *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
13391 return (uint64_t)ret_conv;
13393 int64_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint32_t arg) {
13394 LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
13395 int64_t ret_val = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
13399 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
13400 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
13401 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
13402 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
13403 return (uint64_t)ret_conv;
13406 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint32_t o) {
13408 o_conv.inner = (void*)(o & (~1));
13409 o_conv.is_owned = (o & 1) || (o == 0);
13410 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13411 o_conv = NodeId_clone(&o_conv);
13412 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13413 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
13414 return (uint64_t)ret_conv;
13417 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_err(uint32_t e) {
13418 LDKDecodeError e_conv;
13419 e_conv.inner = (void*)(e & (~1));
13420 e_conv.is_owned = (e & 1) || (e == 0);
13421 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13422 e_conv = DecodeError_clone(&e_conv);
13423 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13424 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
13425 return (uint64_t)ret_conv;
13428 jboolean __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint32_t o) {
13429 LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)(o & ~1);
13430 jboolean ret_val = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
13434 void __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_free(uint32_t _res) {
13435 if ((_res & 1) != 0) return;
13436 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13437 CHECK_ACCESS(_res_ptr);
13438 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
13440 CResult_NodeIdDecodeErrorZ_free(_res_conv);
13443 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
13444 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13445 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
13446 return (uint64_t)ret_conv;
13448 int64_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint32_t arg) {
13449 LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
13450 int64_t ret_val = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
13454 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint32_t orig) {
13455 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
13456 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13457 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
13458 return (uint64_t)ret_conv;
13461 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint32_t o) {
13462 void* o_ptr = (void*)(((uint64_t)o) & ~1);
13463 CHECK_ACCESS(o_ptr);
13464 LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
13465 o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)o) & ~1));
13466 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
13467 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
13468 return (uint64_t)ret_conv;
13471 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint32_t e) {
13472 LDKDecodeError e_conv;
13473 e_conv.inner = (void*)(e & (~1));
13474 e_conv.is_owned = (e & 1) || (e == 0);
13475 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13476 e_conv = DecodeError_clone(&e_conv);
13477 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
13478 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
13479 return (uint64_t)ret_conv;
13482 jboolean __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint32_t o) {
13483 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(o & ~1);
13484 jboolean ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
13488 void __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint32_t _res) {
13489 if ((_res & 1) != 0) return;
13490 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13491 CHECK_ACCESS(_res_ptr);
13492 LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
13494 CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
13497 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
13498 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
13499 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
13500 return (uint64_t)ret_conv;
13502 int64_t __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint32_t arg) {
13503 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
13504 int64_t ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
13508 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint32_t orig) {
13509 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(orig & ~1);
13510 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
13511 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
13512 return (uint64_t)ret_conv;
13515 uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_some(uint32_t o) {
13516 void* o_ptr = (void*)(((uint64_t)o) & ~1);
13517 CHECK_ACCESS(o_ptr);
13518 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
13519 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
13520 *ret_copy = COption_AccessZ_some(o_conv);
13521 uint64_t ret_ref = (uint64_t)ret_copy;
13525 uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_none() {
13526 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
13527 *ret_copy = COption_AccessZ_none();
13528 uint64_t ret_ref = (uint64_t)ret_copy;
13532 void __attribute__((visibility("default"))) TS_COption_AccessZ_free(uint32_t _res) {
13533 if ((_res & 1) != 0) return;
13534 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13535 CHECK_ACCESS(_res_ptr);
13536 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
13538 COption_AccessZ_free(_res_conv);
13541 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok(uint32_t o) {
13542 LDKDirectionalChannelInfo o_conv;
13543 o_conv.inner = (void*)(o & (~1));
13544 o_conv.is_owned = (o & 1) || (o == 0);
13545 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13546 o_conv = DirectionalChannelInfo_clone(&o_conv);
13547 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
13548 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
13549 return (uint64_t)ret_conv;
13552 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_err(uint32_t e) {
13553 LDKDecodeError e_conv;
13554 e_conv.inner = (void*)(e & (~1));
13555 e_conv.is_owned = (e & 1) || (e == 0);
13556 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13557 e_conv = DecodeError_clone(&e_conv);
13558 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
13559 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
13560 return (uint64_t)ret_conv;
13563 jboolean __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(uint32_t o) {
13564 LDKCResult_DirectionalChannelInfoDecodeErrorZ* o_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(o & ~1);
13565 jboolean ret_val = CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(o_conv);
13569 void __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_free(uint32_t _res) {
13570 if ((_res & 1) != 0) return;
13571 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13572 CHECK_ACCESS(_res_ptr);
13573 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(_res_ptr);
13575 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
13578 static inline uint64_t CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
13579 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
13580 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(arg);
13581 return (uint64_t)ret_conv;
13583 int64_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
13584 LDKCResult_DirectionalChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
13585 int64_t ret_val = CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
13589 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone(uint32_t orig) {
13590 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
13591 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
13592 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
13593 return (uint64_t)ret_conv;
13596 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
13597 LDKChannelInfo o_conv;
13598 o_conv.inner = (void*)(o & (~1));
13599 o_conv.is_owned = (o & 1) || (o == 0);
13600 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13601 o_conv = ChannelInfo_clone(&o_conv);
13602 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13603 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
13604 return (uint64_t)ret_conv;
13607 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
13608 LDKDecodeError e_conv;
13609 e_conv.inner = (void*)(e & (~1));
13610 e_conv.is_owned = (e & 1) || (e == 0);
13611 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13612 e_conv = DecodeError_clone(&e_conv);
13613 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13614 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
13615 return (uint64_t)ret_conv;
13618 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint32_t o) {
13619 LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(o & ~1);
13620 jboolean ret_val = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
13624 void __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
13625 if ((_res & 1) != 0) return;
13626 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13627 CHECK_ACCESS(_res_ptr);
13628 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
13630 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
13633 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
13634 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13635 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
13636 return (uint64_t)ret_conv;
13638 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
13639 LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
13640 int64_t ret_val = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
13644 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
13645 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
13646 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13647 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
13648 return (uint64_t)ret_conv;
13651 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
13652 LDKRoutingFees o_conv;
13653 o_conv.inner = (void*)(o & (~1));
13654 o_conv.is_owned = (o & 1) || (o == 0);
13655 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13656 o_conv = RoutingFees_clone(&o_conv);
13657 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13658 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
13659 return (uint64_t)ret_conv;
13662 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
13663 LDKDecodeError e_conv;
13664 e_conv.inner = (void*)(e & (~1));
13665 e_conv.is_owned = (e & 1) || (e == 0);
13666 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13667 e_conv = DecodeError_clone(&e_conv);
13668 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13669 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
13670 return (uint64_t)ret_conv;
13673 jboolean __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint32_t o) {
13674 LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(o & ~1);
13675 jboolean ret_val = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
13679 void __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
13680 if ((_res & 1) != 0) return;
13681 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13682 CHECK_ACCESS(_res_ptr);
13683 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
13685 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
13688 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
13689 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13690 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
13691 return (uint64_t)ret_conv;
13693 int64_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint32_t arg) {
13694 LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
13695 int64_t ret_val = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
13699 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
13700 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
13701 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13702 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
13703 return (uint64_t)ret_conv;
13706 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
13707 LDKNodeAnnouncementInfo o_conv;
13708 o_conv.inner = (void*)(o & (~1));
13709 o_conv.is_owned = (o & 1) || (o == 0);
13710 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13711 o_conv = NodeAnnouncementInfo_clone(&o_conv);
13712 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13713 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
13714 return (uint64_t)ret_conv;
13717 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
13718 LDKDecodeError e_conv;
13719 e_conv.inner = (void*)(e & (~1));
13720 e_conv.is_owned = (e & 1) || (e == 0);
13721 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13722 e_conv = DecodeError_clone(&e_conv);
13723 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13724 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
13725 return (uint64_t)ret_conv;
13728 jboolean __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint32_t o) {
13729 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(o & ~1);
13730 jboolean ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
13734 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
13735 if ((_res & 1) != 0) return;
13736 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13737 CHECK_ACCESS(_res_ptr);
13738 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
13740 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
13743 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
13744 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13745 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
13746 return (uint64_t)ret_conv;
13748 int64_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
13749 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
13750 int64_t ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
13754 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
13755 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
13756 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13757 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
13758 return (uint64_t)ret_conv;
13761 void __attribute__((visibility("default"))) TS_CVec_u64Z_free(int64_tArray _res) {
13762 LDKCVec_u64Z _res_constr;
13763 _res_constr.datalen = *((uint32_t*)_res);
13764 if (_res_constr.datalen > 0)
13765 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
13767 _res_constr.data = NULL;
13768 int64_t* _res_vals = (int64_t*)(_res + 4);
13769 for (size_t i = 0; i < _res_constr.datalen; i++) {
13770 int64_t _res_conv_8 = _res_vals[i];
13771 _res_constr.data[i] = _res_conv_8;
13773 CVec_u64Z_free(_res_constr);
13776 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
13777 LDKNodeInfo o_conv;
13778 o_conv.inner = (void*)(o & (~1));
13779 o_conv.is_owned = (o & 1) || (o == 0);
13780 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13781 o_conv = NodeInfo_clone(&o_conv);
13782 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13783 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
13784 return (uint64_t)ret_conv;
13787 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
13788 LDKDecodeError e_conv;
13789 e_conv.inner = (void*)(e & (~1));
13790 e_conv.is_owned = (e & 1) || (e == 0);
13791 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13792 e_conv = DecodeError_clone(&e_conv);
13793 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13794 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
13795 return (uint64_t)ret_conv;
13798 jboolean __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint32_t o) {
13799 LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(o & ~1);
13800 jboolean ret_val = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
13804 void __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
13805 if ((_res & 1) != 0) return;
13806 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13807 CHECK_ACCESS(_res_ptr);
13808 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
13810 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
13813 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
13814 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13815 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
13816 return (uint64_t)ret_conv;
13818 int64_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
13819 LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
13820 int64_t ret_val = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
13824 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
13825 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
13826 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13827 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
13828 return (uint64_t)ret_conv;
13831 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
13832 LDKNetworkGraph o_conv;
13833 o_conv.inner = (void*)(o & (~1));
13834 o_conv.is_owned = (o & 1) || (o == 0);
13835 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13836 o_conv = NetworkGraph_clone(&o_conv);
13837 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
13838 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
13839 return (uint64_t)ret_conv;
13842 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
13843 LDKDecodeError e_conv;
13844 e_conv.inner = (void*)(e & (~1));
13845 e_conv.is_owned = (e & 1) || (e == 0);
13846 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13847 e_conv = DecodeError_clone(&e_conv);
13848 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
13849 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
13850 return (uint64_t)ret_conv;
13853 jboolean __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint32_t o) {
13854 LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(o & ~1);
13855 jboolean ret_val = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
13859 void __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
13860 if ((_res & 1) != 0) return;
13861 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13862 CHECK_ACCESS(_res_ptr);
13863 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
13865 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
13868 static inline uint64_t CResult_NetworkGraphDecodeErrorZ_clone_ptr(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR arg) {
13869 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
13870 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(arg);
13871 return (uint64_t)ret_conv;
13873 int64_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_clone_ptr(uint32_t arg) {
13874 LDKCResult_NetworkGraphDecodeErrorZ* arg_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
13875 int64_t ret_val = CResult_NetworkGraphDecodeErrorZ_clone_ptr(arg_conv);
13879 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_clone(uint32_t orig) {
13880 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
13881 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
13882 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
13883 return (uint64_t)ret_conv;
13886 uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_some(uint32_tArray o) {
13887 LDKCVec_NetAddressZ o_constr;
13888 o_constr.datalen = *((uint32_t*)o);
13889 if (o_constr.datalen > 0)
13890 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
13892 o_constr.data = NULL;
13893 uint32_t* o_vals = (uint32_t*)(o + 4);
13894 for (size_t m = 0; m < o_constr.datalen; m++) {
13895 uint32_t o_conv_12 = o_vals[m];
13896 void* o_conv_12_ptr = (void*)(((uint64_t)o_conv_12) & ~1);
13897 CHECK_ACCESS(o_conv_12_ptr);
13898 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
13899 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o_conv_12) & ~1));
13900 o_constr.data[m] = o_conv_12_conv;
13902 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
13903 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
13904 uint64_t ret_ref = (uint64_t)ret_copy;
13908 uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_none() {
13909 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
13910 *ret_copy = COption_CVec_NetAddressZZ_none();
13911 uint64_t ret_ref = (uint64_t)ret_copy;
13915 void __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_free(uint32_t _res) {
13916 if ((_res & 1) != 0) return;
13917 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13918 CHECK_ACCESS(_res_ptr);
13919 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
13921 COption_CVec_NetAddressZZ_free(_res_conv);
13924 static inline uint64_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
13925 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
13926 *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
13927 uint64_t ret_ref = (uint64_t)ret_copy;
13930 int64_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_clone_ptr(uint32_t arg) {
13931 LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)arg;
13932 int64_t ret_val = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
13936 uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_clone(uint32_t orig) {
13937 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
13938 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
13939 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
13940 uint64_t ret_ref = (uint64_t)ret_copy;
13944 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint32_t o) {
13945 void* o_ptr = (void*)(((uint64_t)o) & ~1);
13946 CHECK_ACCESS(o_ptr);
13947 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
13948 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
13949 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
13950 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
13951 return (uint64_t)ret_conv;
13954 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_err(uint32_t e) {
13955 LDKDecodeError e_conv;
13956 e_conv.inner = (void*)(e & (~1));
13957 e_conv.is_owned = (e & 1) || (e == 0);
13958 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13959 e_conv = DecodeError_clone(&e_conv);
13960 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
13961 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
13962 return (uint64_t)ret_conv;
13965 jboolean __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint32_t o) {
13966 LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)(o & ~1);
13967 jboolean ret_val = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
13971 void __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_free(uint32_t _res) {
13972 if ((_res & 1) != 0) return;
13973 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13974 CHECK_ACCESS(_res_ptr);
13975 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
13977 CResult_NetAddressDecodeErrorZ_free(_res_conv);
13980 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
13981 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
13982 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
13983 return (uint64_t)ret_conv;
13985 int64_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint32_t arg) {
13986 LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
13987 int64_t ret_val = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
13991 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint32_t orig) {
13992 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
13993 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
13994 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
13995 return (uint64_t)ret_conv;
13998 void __attribute__((visibility("default"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
13999 LDKCVec_UpdateAddHTLCZ _res_constr;
14000 _res_constr.datalen = *((uint32_t*)_res);
14001 if (_res_constr.datalen > 0)
14002 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
14004 _res_constr.data = NULL;
14005 uint32_t* _res_vals = (uint32_t*)(_res + 4);
14006 for (size_t p = 0; p < _res_constr.datalen; p++) {
14007 uint32_t _res_conv_15 = _res_vals[p];
14008 LDKUpdateAddHTLC _res_conv_15_conv;
14009 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
14010 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
14011 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
14012 _res_constr.data[p] = _res_conv_15_conv;
14014 CVec_UpdateAddHTLCZ_free(_res_constr);
14017 void __attribute__((visibility("default"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
14018 LDKCVec_UpdateFulfillHTLCZ _res_constr;
14019 _res_constr.datalen = *((uint32_t*)_res);
14020 if (_res_constr.datalen > 0)
14021 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
14023 _res_constr.data = NULL;
14024 uint32_t* _res_vals = (uint32_t*)(_res + 4);
14025 for (size_t t = 0; t < _res_constr.datalen; t++) {
14026 uint32_t _res_conv_19 = _res_vals[t];
14027 LDKUpdateFulfillHTLC _res_conv_19_conv;
14028 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
14029 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
14030 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
14031 _res_constr.data[t] = _res_conv_19_conv;
14033 CVec_UpdateFulfillHTLCZ_free(_res_constr);
14036 void __attribute__((visibility("default"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
14037 LDKCVec_UpdateFailHTLCZ _res_constr;
14038 _res_constr.datalen = *((uint32_t*)_res);
14039 if (_res_constr.datalen > 0)
14040 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
14042 _res_constr.data = NULL;
14043 uint32_t* _res_vals = (uint32_t*)(_res + 4);
14044 for (size_t q = 0; q < _res_constr.datalen; q++) {
14045 uint32_t _res_conv_16 = _res_vals[q];
14046 LDKUpdateFailHTLC _res_conv_16_conv;
14047 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
14048 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
14049 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
14050 _res_constr.data[q] = _res_conv_16_conv;
14052 CVec_UpdateFailHTLCZ_free(_res_constr);
14055 void __attribute__((visibility("default"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
14056 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
14057 _res_constr.datalen = *((uint32_t*)_res);
14058 if (_res_constr.datalen > 0)
14059 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
14061 _res_constr.data = NULL;
14062 uint32_t* _res_vals = (uint32_t*)(_res + 4);
14063 for (size_t z = 0; z < _res_constr.datalen; z++) {
14064 uint32_t _res_conv_25 = _res_vals[z];
14065 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
14066 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
14067 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
14068 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
14069 _res_constr.data[z] = _res_conv_25_conv;
14071 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
14074 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
14075 LDKAcceptChannel o_conv;
14076 o_conv.inner = (void*)(o & (~1));
14077 o_conv.is_owned = (o & 1) || (o == 0);
14078 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14079 o_conv = AcceptChannel_clone(&o_conv);
14080 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
14081 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
14082 return (uint64_t)ret_conv;
14085 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
14086 LDKDecodeError e_conv;
14087 e_conv.inner = (void*)(e & (~1));
14088 e_conv.is_owned = (e & 1) || (e == 0);
14089 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14090 e_conv = DecodeError_clone(&e_conv);
14091 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
14092 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
14093 return (uint64_t)ret_conv;
14096 jboolean __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint32_t o) {
14097 LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(o & ~1);
14098 jboolean ret_val = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
14102 void __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
14103 if ((_res & 1) != 0) return;
14104 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14105 CHECK_ACCESS(_res_ptr);
14106 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
14108 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
14111 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
14112 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
14113 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
14114 return (uint64_t)ret_conv;
14116 int64_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint32_t arg) {
14117 LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
14118 int64_t ret_val = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
14122 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
14123 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
14124 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
14125 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
14126 return (uint64_t)ret_conv;
14129 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
14130 LDKAnnouncementSignatures o_conv;
14131 o_conv.inner = (void*)(o & (~1));
14132 o_conv.is_owned = (o & 1) || (o == 0);
14133 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14134 o_conv = AnnouncementSignatures_clone(&o_conv);
14135 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
14136 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
14137 return (uint64_t)ret_conv;
14140 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
14141 LDKDecodeError e_conv;
14142 e_conv.inner = (void*)(e & (~1));
14143 e_conv.is_owned = (e & 1) || (e == 0);
14144 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14145 e_conv = DecodeError_clone(&e_conv);
14146 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
14147 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
14148 return (uint64_t)ret_conv;
14151 jboolean __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint32_t o) {
14152 LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(o & ~1);
14153 jboolean ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
14157 void __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
14158 if ((_res & 1) != 0) return;
14159 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14160 CHECK_ACCESS(_res_ptr);
14161 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
14163 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
14166 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
14167 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
14168 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
14169 return (uint64_t)ret_conv;
14171 int64_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
14172 LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
14173 int64_t ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
14177 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
14178 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
14179 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
14180 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
14181 return (uint64_t)ret_conv;
14184 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
14185 LDKChannelReestablish o_conv;
14186 o_conv.inner = (void*)(o & (~1));
14187 o_conv.is_owned = (o & 1) || (o == 0);
14188 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14189 o_conv = ChannelReestablish_clone(&o_conv);
14190 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
14191 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
14192 return (uint64_t)ret_conv;
14195 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
14196 LDKDecodeError e_conv;
14197 e_conv.inner = (void*)(e & (~1));
14198 e_conv.is_owned = (e & 1) || (e == 0);
14199 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14200 e_conv = DecodeError_clone(&e_conv);
14201 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
14202 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
14203 return (uint64_t)ret_conv;
14206 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint32_t o) {
14207 LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(o & ~1);
14208 jboolean ret_val = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
14212 void __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
14213 if ((_res & 1) != 0) return;
14214 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14215 CHECK_ACCESS(_res_ptr);
14216 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
14218 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
14221 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
14222 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
14223 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
14224 return (uint64_t)ret_conv;
14226 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint32_t arg) {
14227 LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
14228 int64_t ret_val = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
14232 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
14233 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
14234 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
14235 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
14236 return (uint64_t)ret_conv;
14239 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
14240 LDKClosingSigned o_conv;
14241 o_conv.inner = (void*)(o & (~1));
14242 o_conv.is_owned = (o & 1) || (o == 0);
14243 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14244 o_conv = ClosingSigned_clone(&o_conv);
14245 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
14246 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
14247 return (uint64_t)ret_conv;
14250 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
14251 LDKDecodeError e_conv;
14252 e_conv.inner = (void*)(e & (~1));
14253 e_conv.is_owned = (e & 1) || (e == 0);
14254 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14255 e_conv = DecodeError_clone(&e_conv);
14256 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
14257 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
14258 return (uint64_t)ret_conv;
14261 jboolean __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint32_t o) {
14262 LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(o & ~1);
14263 jboolean ret_val = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
14267 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
14268 if ((_res & 1) != 0) return;
14269 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14270 CHECK_ACCESS(_res_ptr);
14271 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
14273 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
14276 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
14277 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
14278 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
14279 return (uint64_t)ret_conv;
14281 int64_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
14282 LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
14283 int64_t ret_val = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
14287 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
14288 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
14289 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
14290 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
14291 return (uint64_t)ret_conv;
14294 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint32_t o) {
14295 LDKClosingSignedFeeRange o_conv;
14296 o_conv.inner = (void*)(o & (~1));
14297 o_conv.is_owned = (o & 1) || (o == 0);
14298 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14299 o_conv = ClosingSignedFeeRange_clone(&o_conv);
14300 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
14301 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
14302 return (uint64_t)ret_conv;
14305 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint32_t e) {
14306 LDKDecodeError e_conv;
14307 e_conv.inner = (void*)(e & (~1));
14308 e_conv.is_owned = (e & 1) || (e == 0);
14309 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14310 e_conv = DecodeError_clone(&e_conv);
14311 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
14312 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
14313 return (uint64_t)ret_conv;
14316 jboolean __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint32_t o) {
14317 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(o & ~1);
14318 jboolean ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
14322 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint32_t _res) {
14323 if ((_res & 1) != 0) return;
14324 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14325 CHECK_ACCESS(_res_ptr);
14326 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
14328 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
14331 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
14332 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
14333 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
14334 return (uint64_t)ret_conv;
14336 int64_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
14337 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
14338 int64_t ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
14342 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint32_t orig) {
14343 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
14344 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
14345 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
14346 return (uint64_t)ret_conv;
14349 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
14350 LDKCommitmentSigned o_conv;
14351 o_conv.inner = (void*)(o & (~1));
14352 o_conv.is_owned = (o & 1) || (o == 0);
14353 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14354 o_conv = CommitmentSigned_clone(&o_conv);
14355 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
14356 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
14357 return (uint64_t)ret_conv;
14360 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
14361 LDKDecodeError e_conv;
14362 e_conv.inner = (void*)(e & (~1));
14363 e_conv.is_owned = (e & 1) || (e == 0);
14364 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14365 e_conv = DecodeError_clone(&e_conv);
14366 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
14367 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
14368 return (uint64_t)ret_conv;
14371 jboolean __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint32_t o) {
14372 LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(o & ~1);
14373 jboolean ret_val = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
14377 void __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
14378 if ((_res & 1) != 0) return;
14379 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14380 CHECK_ACCESS(_res_ptr);
14381 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
14383 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
14386 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
14387 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
14388 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
14389 return (uint64_t)ret_conv;
14391 int64_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
14392 LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
14393 int64_t ret_val = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
14397 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
14398 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
14399 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
14400 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
14401 return (uint64_t)ret_conv;
14404 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
14405 LDKFundingCreated o_conv;
14406 o_conv.inner = (void*)(o & (~1));
14407 o_conv.is_owned = (o & 1) || (o == 0);
14408 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14409 o_conv = FundingCreated_clone(&o_conv);
14410 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
14411 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
14412 return (uint64_t)ret_conv;
14415 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
14416 LDKDecodeError e_conv;
14417 e_conv.inner = (void*)(e & (~1));
14418 e_conv.is_owned = (e & 1) || (e == 0);
14419 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14420 e_conv = DecodeError_clone(&e_conv);
14421 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
14422 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
14423 return (uint64_t)ret_conv;
14426 jboolean __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint32_t o) {
14427 LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(o & ~1);
14428 jboolean ret_val = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
14432 void __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
14433 if ((_res & 1) != 0) return;
14434 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14435 CHECK_ACCESS(_res_ptr);
14436 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
14438 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
14441 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
14442 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
14443 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
14444 return (uint64_t)ret_conv;
14446 int64_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint32_t arg) {
14447 LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
14448 int64_t ret_val = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
14452 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
14453 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
14454 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
14455 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
14456 return (uint64_t)ret_conv;
14459 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
14460 LDKFundingSigned o_conv;
14461 o_conv.inner = (void*)(o & (~1));
14462 o_conv.is_owned = (o & 1) || (o == 0);
14463 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14464 o_conv = FundingSigned_clone(&o_conv);
14465 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
14466 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
14467 return (uint64_t)ret_conv;
14470 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
14471 LDKDecodeError e_conv;
14472 e_conv.inner = (void*)(e & (~1));
14473 e_conv.is_owned = (e & 1) || (e == 0);
14474 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14475 e_conv = DecodeError_clone(&e_conv);
14476 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
14477 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
14478 return (uint64_t)ret_conv;
14481 jboolean __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint32_t o) {
14482 LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(o & ~1);
14483 jboolean ret_val = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
14487 void __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
14488 if ((_res & 1) != 0) return;
14489 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14490 CHECK_ACCESS(_res_ptr);
14491 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
14493 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
14496 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
14497 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
14498 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
14499 return (uint64_t)ret_conv;
14501 int64_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
14502 LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
14503 int64_t ret_val = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
14507 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
14508 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
14509 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
14510 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
14511 return (uint64_t)ret_conv;
14514 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_ok(uint32_t o) {
14515 LDKFundingLocked o_conv;
14516 o_conv.inner = (void*)(o & (~1));
14517 o_conv.is_owned = (o & 1) || (o == 0);
14518 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14519 o_conv = FundingLocked_clone(&o_conv);
14520 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
14521 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
14522 return (uint64_t)ret_conv;
14525 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_err(uint32_t e) {
14526 LDKDecodeError e_conv;
14527 e_conv.inner = (void*)(e & (~1));
14528 e_conv.is_owned = (e & 1) || (e == 0);
14529 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14530 e_conv = DecodeError_clone(&e_conv);
14531 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
14532 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
14533 return (uint64_t)ret_conv;
14536 jboolean __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_is_ok(uint32_t o) {
14537 LDKCResult_FundingLockedDecodeErrorZ* o_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(o & ~1);
14538 jboolean ret_val = CResult_FundingLockedDecodeErrorZ_is_ok(o_conv);
14542 void __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_free(uint32_t _res) {
14543 if ((_res & 1) != 0) return;
14544 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14545 CHECK_ACCESS(_res_ptr);
14546 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(_res_ptr);
14548 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
14551 static inline uint64_t CResult_FundingLockedDecodeErrorZ_clone_ptr(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR arg) {
14552 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
14553 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(arg);
14554 return (uint64_t)ret_conv;
14556 int64_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_clone_ptr(uint32_t arg) {
14557 LDKCResult_FundingLockedDecodeErrorZ* arg_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
14558 int64_t ret_val = CResult_FundingLockedDecodeErrorZ_clone_ptr(arg_conv);
14562 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_clone(uint32_t orig) {
14563 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
14564 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
14565 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
14566 return (uint64_t)ret_conv;
14569 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
14571 o_conv.inner = (void*)(o & (~1));
14572 o_conv.is_owned = (o & 1) || (o == 0);
14573 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14574 o_conv = Init_clone(&o_conv);
14575 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
14576 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
14577 return (uint64_t)ret_conv;
14580 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
14581 LDKDecodeError e_conv;
14582 e_conv.inner = (void*)(e & (~1));
14583 e_conv.is_owned = (e & 1) || (e == 0);
14584 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14585 e_conv = DecodeError_clone(&e_conv);
14586 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
14587 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
14588 return (uint64_t)ret_conv;
14591 jboolean __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_is_ok(uint32_t o) {
14592 LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)(o & ~1);
14593 jboolean ret_val = CResult_InitDecodeErrorZ_is_ok(o_conv);
14597 void __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
14598 if ((_res & 1) != 0) return;
14599 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14600 CHECK_ACCESS(_res_ptr);
14601 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
14603 CResult_InitDecodeErrorZ_free(_res_conv);
14606 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
14607 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
14608 *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
14609 return (uint64_t)ret_conv;
14611 int64_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint32_t arg) {
14612 LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
14613 int64_t ret_val = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
14617 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
14618 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
14619 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
14620 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
14621 return (uint64_t)ret_conv;
14624 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
14625 LDKOpenChannel o_conv;
14626 o_conv.inner = (void*)(o & (~1));
14627 o_conv.is_owned = (o & 1) || (o == 0);
14628 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14629 o_conv = OpenChannel_clone(&o_conv);
14630 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
14631 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
14632 return (uint64_t)ret_conv;
14635 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
14636 LDKDecodeError e_conv;
14637 e_conv.inner = (void*)(e & (~1));
14638 e_conv.is_owned = (e & 1) || (e == 0);
14639 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14640 e_conv = DecodeError_clone(&e_conv);
14641 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
14642 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
14643 return (uint64_t)ret_conv;
14646 jboolean __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint32_t o) {
14647 LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(o & ~1);
14648 jboolean ret_val = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
14652 void __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
14653 if ((_res & 1) != 0) return;
14654 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14655 CHECK_ACCESS(_res_ptr);
14656 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
14658 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
14661 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
14662 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
14663 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
14664 return (uint64_t)ret_conv;
14666 int64_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint32_t arg) {
14667 LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
14668 int64_t ret_val = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
14672 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
14673 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
14674 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
14675 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
14676 return (uint64_t)ret_conv;
14679 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
14680 LDKRevokeAndACK o_conv;
14681 o_conv.inner = (void*)(o & (~1));
14682 o_conv.is_owned = (o & 1) || (o == 0);
14683 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14684 o_conv = RevokeAndACK_clone(&o_conv);
14685 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
14686 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
14687 return (uint64_t)ret_conv;
14690 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
14691 LDKDecodeError e_conv;
14692 e_conv.inner = (void*)(e & (~1));
14693 e_conv.is_owned = (e & 1) || (e == 0);
14694 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14695 e_conv = DecodeError_clone(&e_conv);
14696 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
14697 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
14698 return (uint64_t)ret_conv;
14701 jboolean __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint32_t o) {
14702 LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(o & ~1);
14703 jboolean ret_val = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
14707 void __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
14708 if ((_res & 1) != 0) return;
14709 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14710 CHECK_ACCESS(_res_ptr);
14711 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
14713 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
14716 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
14717 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
14718 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
14719 return (uint64_t)ret_conv;
14721 int64_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint32_t arg) {
14722 LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
14723 int64_t ret_val = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
14727 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
14728 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
14729 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
14730 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
14731 return (uint64_t)ret_conv;
14734 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
14735 LDKShutdown o_conv;
14736 o_conv.inner = (void*)(o & (~1));
14737 o_conv.is_owned = (o & 1) || (o == 0);
14738 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14739 o_conv = Shutdown_clone(&o_conv);
14740 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
14741 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
14742 return (uint64_t)ret_conv;
14745 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
14746 LDKDecodeError e_conv;
14747 e_conv.inner = (void*)(e & (~1));
14748 e_conv.is_owned = (e & 1) || (e == 0);
14749 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14750 e_conv = DecodeError_clone(&e_conv);
14751 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
14752 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
14753 return (uint64_t)ret_conv;
14756 jboolean __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint32_t o) {
14757 LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)(o & ~1);
14758 jboolean ret_val = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
14762 void __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
14763 if ((_res & 1) != 0) return;
14764 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14765 CHECK_ACCESS(_res_ptr);
14766 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
14768 CResult_ShutdownDecodeErrorZ_free(_res_conv);
14771 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
14772 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
14773 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
14774 return (uint64_t)ret_conv;
14776 int64_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint32_t arg) {
14777 LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
14778 int64_t ret_val = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
14782 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
14783 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
14784 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
14785 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
14786 return (uint64_t)ret_conv;
14789 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
14790 LDKUpdateFailHTLC o_conv;
14791 o_conv.inner = (void*)(o & (~1));
14792 o_conv.is_owned = (o & 1) || (o == 0);
14793 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14794 o_conv = UpdateFailHTLC_clone(&o_conv);
14795 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
14796 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
14797 return (uint64_t)ret_conv;
14800 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
14801 LDKDecodeError e_conv;
14802 e_conv.inner = (void*)(e & (~1));
14803 e_conv.is_owned = (e & 1) || (e == 0);
14804 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14805 e_conv = DecodeError_clone(&e_conv);
14806 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
14807 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
14808 return (uint64_t)ret_conv;
14811 jboolean __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint32_t o) {
14812 LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(o & ~1);
14813 jboolean ret_val = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
14817 void __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
14818 if ((_res & 1) != 0) return;
14819 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14820 CHECK_ACCESS(_res_ptr);
14821 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
14823 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
14826 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
14827 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
14828 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
14829 return (uint64_t)ret_conv;
14831 int64_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
14832 LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
14833 int64_t ret_val = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
14837 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
14838 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
14839 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
14840 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
14841 return (uint64_t)ret_conv;
14844 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
14845 LDKUpdateFailMalformedHTLC o_conv;
14846 o_conv.inner = (void*)(o & (~1));
14847 o_conv.is_owned = (o & 1) || (o == 0);
14848 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14849 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
14850 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
14851 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
14852 return (uint64_t)ret_conv;
14855 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
14856 LDKDecodeError e_conv;
14857 e_conv.inner = (void*)(e & (~1));
14858 e_conv.is_owned = (e & 1) || (e == 0);
14859 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14860 e_conv = DecodeError_clone(&e_conv);
14861 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
14862 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
14863 return (uint64_t)ret_conv;
14866 jboolean __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint32_t o) {
14867 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(o & ~1);
14868 jboolean ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
14872 void __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
14873 if ((_res & 1) != 0) return;
14874 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14875 CHECK_ACCESS(_res_ptr);
14876 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
14878 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
14881 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
14882 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
14883 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
14884 return (uint64_t)ret_conv;
14886 int64_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
14887 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
14888 int64_t ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
14892 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
14893 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
14894 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
14895 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
14896 return (uint64_t)ret_conv;
14899 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
14900 LDKUpdateFee o_conv;
14901 o_conv.inner = (void*)(o & (~1));
14902 o_conv.is_owned = (o & 1) || (o == 0);
14903 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14904 o_conv = UpdateFee_clone(&o_conv);
14905 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
14906 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
14907 return (uint64_t)ret_conv;
14910 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
14911 LDKDecodeError e_conv;
14912 e_conv.inner = (void*)(e & (~1));
14913 e_conv.is_owned = (e & 1) || (e == 0);
14914 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14915 e_conv = DecodeError_clone(&e_conv);
14916 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
14917 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
14918 return (uint64_t)ret_conv;
14921 jboolean __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint32_t o) {
14922 LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(o & ~1);
14923 jboolean ret_val = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
14927 void __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
14928 if ((_res & 1) != 0) return;
14929 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14930 CHECK_ACCESS(_res_ptr);
14931 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
14933 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
14936 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
14937 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
14938 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
14939 return (uint64_t)ret_conv;
14941 int64_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint32_t arg) {
14942 LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
14943 int64_t ret_val = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
14947 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
14948 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
14949 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
14950 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
14951 return (uint64_t)ret_conv;
14954 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
14955 LDKUpdateFulfillHTLC o_conv;
14956 o_conv.inner = (void*)(o & (~1));
14957 o_conv.is_owned = (o & 1) || (o == 0);
14958 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14959 o_conv = UpdateFulfillHTLC_clone(&o_conv);
14960 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
14961 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
14962 return (uint64_t)ret_conv;
14965 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
14966 LDKDecodeError e_conv;
14967 e_conv.inner = (void*)(e & (~1));
14968 e_conv.is_owned = (e & 1) || (e == 0);
14969 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14970 e_conv = DecodeError_clone(&e_conv);
14971 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
14972 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
14973 return (uint64_t)ret_conv;
14976 jboolean __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint32_t o) {
14977 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(o & ~1);
14978 jboolean ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
14982 void __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
14983 if ((_res & 1) != 0) return;
14984 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14985 CHECK_ACCESS(_res_ptr);
14986 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
14988 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
14991 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
14992 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
14993 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
14994 return (uint64_t)ret_conv;
14996 int64_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
14997 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
14998 int64_t ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
15002 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
15003 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
15004 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
15005 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
15006 return (uint64_t)ret_conv;
15009 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
15010 LDKUpdateAddHTLC o_conv;
15011 o_conv.inner = (void*)(o & (~1));
15012 o_conv.is_owned = (o & 1) || (o == 0);
15013 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15014 o_conv = UpdateAddHTLC_clone(&o_conv);
15015 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
15016 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
15017 return (uint64_t)ret_conv;
15020 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
15021 LDKDecodeError e_conv;
15022 e_conv.inner = (void*)(e & (~1));
15023 e_conv.is_owned = (e & 1) || (e == 0);
15024 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15025 e_conv = DecodeError_clone(&e_conv);
15026 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
15027 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
15028 return (uint64_t)ret_conv;
15031 jboolean __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint32_t o) {
15032 LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(o & ~1);
15033 jboolean ret_val = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
15037 void __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
15038 if ((_res & 1) != 0) return;
15039 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15040 CHECK_ACCESS(_res_ptr);
15041 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
15043 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
15046 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
15047 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
15048 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
15049 return (uint64_t)ret_conv;
15051 int64_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
15052 LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
15053 int64_t ret_val = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
15057 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
15058 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
15059 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
15060 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
15061 return (uint64_t)ret_conv;
15064 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
15066 o_conv.inner = (void*)(o & (~1));
15067 o_conv.is_owned = (o & 1) || (o == 0);
15068 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15069 o_conv = Ping_clone(&o_conv);
15070 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
15071 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
15072 return (uint64_t)ret_conv;
15075 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
15076 LDKDecodeError e_conv;
15077 e_conv.inner = (void*)(e & (~1));
15078 e_conv.is_owned = (e & 1) || (e == 0);
15079 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15080 e_conv = DecodeError_clone(&e_conv);
15081 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
15082 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
15083 return (uint64_t)ret_conv;
15086 jboolean __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_is_ok(uint32_t o) {
15087 LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)(o & ~1);
15088 jboolean ret_val = CResult_PingDecodeErrorZ_is_ok(o_conv);
15092 void __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
15093 if ((_res & 1) != 0) return;
15094 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15095 CHECK_ACCESS(_res_ptr);
15096 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
15098 CResult_PingDecodeErrorZ_free(_res_conv);
15101 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
15102 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
15103 *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
15104 return (uint64_t)ret_conv;
15106 int64_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint32_t arg) {
15107 LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
15108 int64_t ret_val = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
15112 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
15113 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
15114 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
15115 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
15116 return (uint64_t)ret_conv;
15119 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
15121 o_conv.inner = (void*)(o & (~1));
15122 o_conv.is_owned = (o & 1) || (o == 0);
15123 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15124 o_conv = Pong_clone(&o_conv);
15125 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
15126 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
15127 return (uint64_t)ret_conv;
15130 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
15131 LDKDecodeError e_conv;
15132 e_conv.inner = (void*)(e & (~1));
15133 e_conv.is_owned = (e & 1) || (e == 0);
15134 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15135 e_conv = DecodeError_clone(&e_conv);
15136 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
15137 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
15138 return (uint64_t)ret_conv;
15141 jboolean __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_is_ok(uint32_t o) {
15142 LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)(o & ~1);
15143 jboolean ret_val = CResult_PongDecodeErrorZ_is_ok(o_conv);
15147 void __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
15148 if ((_res & 1) != 0) return;
15149 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15150 CHECK_ACCESS(_res_ptr);
15151 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
15153 CResult_PongDecodeErrorZ_free(_res_conv);
15156 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
15157 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
15158 *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
15159 return (uint64_t)ret_conv;
15161 int64_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint32_t arg) {
15162 LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
15163 int64_t ret_val = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
15167 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
15168 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
15169 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
15170 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
15171 return (uint64_t)ret_conv;
15174 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
15175 LDKUnsignedChannelAnnouncement o_conv;
15176 o_conv.inner = (void*)(o & (~1));
15177 o_conv.is_owned = (o & 1) || (o == 0);
15178 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15179 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
15180 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
15181 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
15182 return (uint64_t)ret_conv;
15185 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
15186 LDKDecodeError e_conv;
15187 e_conv.inner = (void*)(e & (~1));
15188 e_conv.is_owned = (e & 1) || (e == 0);
15189 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15190 e_conv = DecodeError_clone(&e_conv);
15191 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
15192 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
15193 return (uint64_t)ret_conv;
15196 jboolean __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
15197 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(o & ~1);
15198 jboolean ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
15202 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
15203 if ((_res & 1) != 0) return;
15204 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15205 CHECK_ACCESS(_res_ptr);
15206 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
15208 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
15211 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
15212 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
15213 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
15214 return (uint64_t)ret_conv;
15216 int64_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
15217 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
15218 int64_t ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
15222 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
15223 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
15224 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
15225 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
15226 return (uint64_t)ret_conv;
15229 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
15230 LDKChannelAnnouncement o_conv;
15231 o_conv.inner = (void*)(o & (~1));
15232 o_conv.is_owned = (o & 1) || (o == 0);
15233 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15234 o_conv = ChannelAnnouncement_clone(&o_conv);
15235 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
15236 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
15237 return (uint64_t)ret_conv;
15240 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
15241 LDKDecodeError e_conv;
15242 e_conv.inner = (void*)(e & (~1));
15243 e_conv.is_owned = (e & 1) || (e == 0);
15244 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15245 e_conv = DecodeError_clone(&e_conv);
15246 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
15247 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
15248 return (uint64_t)ret_conv;
15251 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
15252 LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(o & ~1);
15253 jboolean ret_val = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
15257 void __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
15258 if ((_res & 1) != 0) return;
15259 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15260 CHECK_ACCESS(_res_ptr);
15261 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
15263 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
15266 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
15267 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
15268 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
15269 return (uint64_t)ret_conv;
15271 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
15272 LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
15273 int64_t ret_val = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
15277 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
15278 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
15279 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
15280 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
15281 return (uint64_t)ret_conv;
15284 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
15285 LDKUnsignedChannelUpdate o_conv;
15286 o_conv.inner = (void*)(o & (~1));
15287 o_conv.is_owned = (o & 1) || (o == 0);
15288 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15289 o_conv = UnsignedChannelUpdate_clone(&o_conv);
15290 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
15291 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
15292 return (uint64_t)ret_conv;
15295 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
15296 LDKDecodeError e_conv;
15297 e_conv.inner = (void*)(e & (~1));
15298 e_conv.is_owned = (e & 1) || (e == 0);
15299 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15300 e_conv = DecodeError_clone(&e_conv);
15301 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
15302 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
15303 return (uint64_t)ret_conv;
15306 jboolean __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint32_t o) {
15307 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(o & ~1);
15308 jboolean ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
15312 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
15313 if ((_res & 1) != 0) return;
15314 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15315 CHECK_ACCESS(_res_ptr);
15316 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
15318 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
15321 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
15322 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
15323 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
15324 return (uint64_t)ret_conv;
15326 int64_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
15327 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
15328 int64_t ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
15332 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
15333 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
15334 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
15335 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
15336 return (uint64_t)ret_conv;
15339 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
15340 LDKChannelUpdate o_conv;
15341 o_conv.inner = (void*)(o & (~1));
15342 o_conv.is_owned = (o & 1) || (o == 0);
15343 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15344 o_conv = ChannelUpdate_clone(&o_conv);
15345 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
15346 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
15347 return (uint64_t)ret_conv;
15350 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
15351 LDKDecodeError e_conv;
15352 e_conv.inner = (void*)(e & (~1));
15353 e_conv.is_owned = (e & 1) || (e == 0);
15354 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15355 e_conv = DecodeError_clone(&e_conv);
15356 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
15357 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
15358 return (uint64_t)ret_conv;
15361 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint32_t o) {
15362 LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(o & ~1);
15363 jboolean ret_val = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
15367 void __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
15368 if ((_res & 1) != 0) return;
15369 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15370 CHECK_ACCESS(_res_ptr);
15371 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
15373 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
15376 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
15377 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
15378 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
15379 return (uint64_t)ret_conv;
15381 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
15382 LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
15383 int64_t ret_val = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
15387 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
15388 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
15389 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
15390 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
15391 return (uint64_t)ret_conv;
15394 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
15395 LDKErrorMessage o_conv;
15396 o_conv.inner = (void*)(o & (~1));
15397 o_conv.is_owned = (o & 1) || (o == 0);
15398 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15399 o_conv = ErrorMessage_clone(&o_conv);
15400 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
15401 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
15402 return (uint64_t)ret_conv;
15405 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
15406 LDKDecodeError e_conv;
15407 e_conv.inner = (void*)(e & (~1));
15408 e_conv.is_owned = (e & 1) || (e == 0);
15409 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15410 e_conv = DecodeError_clone(&e_conv);
15411 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
15412 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
15413 return (uint64_t)ret_conv;
15416 jboolean __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint32_t o) {
15417 LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(o & ~1);
15418 jboolean ret_val = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
15422 void __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
15423 if ((_res & 1) != 0) return;
15424 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15425 CHECK_ACCESS(_res_ptr);
15426 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
15428 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
15431 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
15432 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
15433 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
15434 return (uint64_t)ret_conv;
15436 int64_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint32_t arg) {
15437 LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
15438 int64_t ret_val = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
15442 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
15443 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
15444 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
15445 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
15446 return (uint64_t)ret_conv;
15449 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
15450 LDKUnsignedNodeAnnouncement o_conv;
15451 o_conv.inner = (void*)(o & (~1));
15452 o_conv.is_owned = (o & 1) || (o == 0);
15453 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15454 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
15455 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
15456 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
15457 return (uint64_t)ret_conv;
15460 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
15461 LDKDecodeError e_conv;
15462 e_conv.inner = (void*)(e & (~1));
15463 e_conv.is_owned = (e & 1) || (e == 0);
15464 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15465 e_conv = DecodeError_clone(&e_conv);
15466 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
15467 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
15468 return (uint64_t)ret_conv;
15471 jboolean __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
15472 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(o & ~1);
15473 jboolean ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
15477 void __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
15478 if ((_res & 1) != 0) return;
15479 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15480 CHECK_ACCESS(_res_ptr);
15481 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
15483 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
15486 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
15487 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
15488 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
15489 return (uint64_t)ret_conv;
15491 int64_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
15492 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
15493 int64_t ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
15497 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
15498 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
15499 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
15500 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
15501 return (uint64_t)ret_conv;
15504 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
15505 LDKNodeAnnouncement o_conv;
15506 o_conv.inner = (void*)(o & (~1));
15507 o_conv.is_owned = (o & 1) || (o == 0);
15508 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15509 o_conv = NodeAnnouncement_clone(&o_conv);
15510 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
15511 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
15512 return (uint64_t)ret_conv;
15515 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
15516 LDKDecodeError e_conv;
15517 e_conv.inner = (void*)(e & (~1));
15518 e_conv.is_owned = (e & 1) || (e == 0);
15519 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15520 e_conv = DecodeError_clone(&e_conv);
15521 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
15522 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
15523 return (uint64_t)ret_conv;
15526 jboolean __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
15527 LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(o & ~1);
15528 jboolean ret_val = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
15532 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
15533 if ((_res & 1) != 0) return;
15534 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15535 CHECK_ACCESS(_res_ptr);
15536 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
15538 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
15541 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
15542 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
15543 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
15544 return (uint64_t)ret_conv;
15546 int64_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
15547 LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
15548 int64_t ret_val = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
15552 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
15553 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
15554 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
15555 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
15556 return (uint64_t)ret_conv;
15559 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
15560 LDKQueryShortChannelIds o_conv;
15561 o_conv.inner = (void*)(o & (~1));
15562 o_conv.is_owned = (o & 1) || (o == 0);
15563 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15564 o_conv = QueryShortChannelIds_clone(&o_conv);
15565 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
15566 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
15567 return (uint64_t)ret_conv;
15570 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
15571 LDKDecodeError e_conv;
15572 e_conv.inner = (void*)(e & (~1));
15573 e_conv.is_owned = (e & 1) || (e == 0);
15574 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15575 e_conv = DecodeError_clone(&e_conv);
15576 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
15577 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
15578 return (uint64_t)ret_conv;
15581 jboolean __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint32_t o) {
15582 LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(o & ~1);
15583 jboolean ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
15587 void __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
15588 if ((_res & 1) != 0) return;
15589 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15590 CHECK_ACCESS(_res_ptr);
15591 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
15593 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
15596 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
15597 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
15598 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
15599 return (uint64_t)ret_conv;
15601 int64_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint32_t arg) {
15602 LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
15603 int64_t ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
15607 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
15608 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
15609 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
15610 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
15611 return (uint64_t)ret_conv;
15614 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
15615 LDKReplyShortChannelIdsEnd o_conv;
15616 o_conv.inner = (void*)(o & (~1));
15617 o_conv.is_owned = (o & 1) || (o == 0);
15618 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15619 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
15620 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
15621 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
15622 return (uint64_t)ret_conv;
15625 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
15626 LDKDecodeError e_conv;
15627 e_conv.inner = (void*)(e & (~1));
15628 e_conv.is_owned = (e & 1) || (e == 0);
15629 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15630 e_conv = DecodeError_clone(&e_conv);
15631 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
15632 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
15633 return (uint64_t)ret_conv;
15636 jboolean __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint32_t o) {
15637 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(o & ~1);
15638 jboolean ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
15642 void __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
15643 if ((_res & 1) != 0) return;
15644 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15645 CHECK_ACCESS(_res_ptr);
15646 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
15648 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
15651 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
15652 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
15653 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
15654 return (uint64_t)ret_conv;
15656 int64_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint32_t arg) {
15657 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
15658 int64_t ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
15662 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
15663 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
15664 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
15665 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
15666 return (uint64_t)ret_conv;
15669 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
15670 LDKQueryChannelRange o_conv;
15671 o_conv.inner = (void*)(o & (~1));
15672 o_conv.is_owned = (o & 1) || (o == 0);
15673 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15674 o_conv = QueryChannelRange_clone(&o_conv);
15675 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
15676 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
15677 return (uint64_t)ret_conv;
15680 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
15681 LDKDecodeError e_conv;
15682 e_conv.inner = (void*)(e & (~1));
15683 e_conv.is_owned = (e & 1) || (e == 0);
15684 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15685 e_conv = DecodeError_clone(&e_conv);
15686 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
15687 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
15688 return (uint64_t)ret_conv;
15691 jboolean __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint32_t o) {
15692 LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(o & ~1);
15693 jboolean ret_val = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
15697 void __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
15698 if ((_res & 1) != 0) return;
15699 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15700 CHECK_ACCESS(_res_ptr);
15701 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
15703 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
15706 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
15707 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
15708 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
15709 return (uint64_t)ret_conv;
15711 int64_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
15712 LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
15713 int64_t ret_val = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
15717 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
15718 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
15719 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
15720 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
15721 return (uint64_t)ret_conv;
15724 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
15725 LDKReplyChannelRange o_conv;
15726 o_conv.inner = (void*)(o & (~1));
15727 o_conv.is_owned = (o & 1) || (o == 0);
15728 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15729 o_conv = ReplyChannelRange_clone(&o_conv);
15730 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
15731 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
15732 return (uint64_t)ret_conv;
15735 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
15736 LDKDecodeError e_conv;
15737 e_conv.inner = (void*)(e & (~1));
15738 e_conv.is_owned = (e & 1) || (e == 0);
15739 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15740 e_conv = DecodeError_clone(&e_conv);
15741 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
15742 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
15743 return (uint64_t)ret_conv;
15746 jboolean __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint32_t o) {
15747 LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(o & ~1);
15748 jboolean ret_val = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
15752 void __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
15753 if ((_res & 1) != 0) return;
15754 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15755 CHECK_ACCESS(_res_ptr);
15756 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
15758 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
15761 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
15762 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
15763 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
15764 return (uint64_t)ret_conv;
15766 int64_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
15767 LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
15768 int64_t ret_val = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
15772 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
15773 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
15774 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
15775 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
15776 return (uint64_t)ret_conv;
15779 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
15780 LDKGossipTimestampFilter o_conv;
15781 o_conv.inner = (void*)(o & (~1));
15782 o_conv.is_owned = (o & 1) || (o == 0);
15783 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15784 o_conv = GossipTimestampFilter_clone(&o_conv);
15785 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
15786 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
15787 return (uint64_t)ret_conv;
15790 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
15791 LDKDecodeError e_conv;
15792 e_conv.inner = (void*)(e & (~1));
15793 e_conv.is_owned = (e & 1) || (e == 0);
15794 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15795 e_conv = DecodeError_clone(&e_conv);
15796 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
15797 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
15798 return (uint64_t)ret_conv;
15801 jboolean __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint32_t o) {
15802 LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(o & ~1);
15803 jboolean ret_val = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
15807 void __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
15808 if ((_res & 1) != 0) return;
15809 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15810 CHECK_ACCESS(_res_ptr);
15811 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
15813 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
15816 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
15817 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
15818 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
15819 return (uint64_t)ret_conv;
15821 int64_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint32_t arg) {
15822 LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
15823 int64_t ret_val = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
15827 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
15828 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
15829 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
15830 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
15831 return (uint64_t)ret_conv;
15834 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint32_t o) {
15836 o_conv.inner = (void*)(o & (~1));
15837 o_conv.is_owned = (o & 1) || (o == 0);
15838 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15839 o_conv = Invoice_clone(&o_conv);
15840 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
15841 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
15842 return (uint64_t)ret_conv;
15845 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint32_t e) {
15846 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15847 CHECK_ACCESS(e_ptr);
15848 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
15849 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uint64_t)e) & ~1));
15850 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
15851 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
15852 return (uint64_t)ret_conv;
15855 jboolean __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_is_ok(uint32_t o) {
15856 LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(o & ~1);
15857 jboolean ret_val = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
15861 void __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint32_t _res) {
15862 if ((_res & 1) != 0) return;
15863 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15864 CHECK_ACCESS(_res_ptr);
15865 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
15867 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
15870 static inline uint64_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
15871 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
15872 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
15873 return (uint64_t)ret_conv;
15875 int64_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr(uint32_t arg) {
15876 LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
15877 int64_t ret_val = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
15881 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint32_t orig) {
15882 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
15883 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
15884 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
15885 return (uint64_t)ret_conv;
15888 uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_some(uint32_t o) {
15889 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15890 CHECK_ACCESS(o_ptr);
15891 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
15892 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
15893 *ret_copy = COption_FilterZ_some(o_conv);
15894 uint64_t ret_ref = (uint64_t)ret_copy;
15898 uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_none() {
15899 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
15900 *ret_copy = COption_FilterZ_none();
15901 uint64_t ret_ref = (uint64_t)ret_copy;
15905 void __attribute__((visibility("default"))) TS_COption_FilterZ_free(uint32_t _res) {
15906 if ((_res & 1) != 0) return;
15907 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15908 CHECK_ACCESS(_res_ptr);
15909 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
15911 COption_FilterZ_free(_res_conv);
15914 uint32_t __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint32_t o) {
15915 LDKLockedChannelMonitor o_conv;
15916 o_conv.inner = (void*)(o & (~1));
15917 o_conv.is_owned = (o & 1) || (o == 0);
15918 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15919 // Warning: we need a move here but no clone is available for LDKLockedChannelMonitor
15920 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
15921 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
15922 return (uint64_t)ret_conv;
15925 uint32_t __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
15926 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
15927 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
15928 return (uint64_t)ret_conv;
15931 jboolean __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint32_t o) {
15932 LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(o & ~1);
15933 jboolean ret_val = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
15937 void __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint32_t _res) {
15938 if ((_res & 1) != 0) return;
15939 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15940 CHECK_ACCESS(_res_ptr);
15941 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
15943 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
15946 void __attribute__((visibility("default"))) TS_CVec_OutPointZ_free(uint32_tArray _res) {
15947 LDKCVec_OutPointZ _res_constr;
15948 _res_constr.datalen = *((uint32_t*)_res);
15949 if (_res_constr.datalen > 0)
15950 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
15952 _res_constr.data = NULL;
15953 uint32_t* _res_vals = (uint32_t*)(_res + 4);
15954 for (size_t k = 0; k < _res_constr.datalen; k++) {
15955 uint32_t _res_conv_10 = _res_vals[k];
15956 LDKOutPoint _res_conv_10_conv;
15957 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
15958 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
15959 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
15960 _res_constr.data[k] = _res_conv_10_conv;
15962 CVec_OutPointZ_free(_res_constr);
15965 void __attribute__((visibility("default"))) TS_PaymentPurpose_free(uint32_t this_ptr) {
15966 if ((this_ptr & 1) != 0) return;
15967 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
15968 CHECK_ACCESS(this_ptr_ptr);
15969 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
15970 FREE((void*)this_ptr);
15971 PaymentPurpose_free(this_ptr_conv);
15974 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
15975 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
15976 *ret_copy = PaymentPurpose_clone(arg);
15977 uint64_t ret_ref = (uint64_t)ret_copy;
15980 int64_t __attribute__((visibility("default"))) TS_PaymentPurpose_clone_ptr(uint32_t arg) {
15981 LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)arg;
15982 int64_t ret_val = PaymentPurpose_clone_ptr(arg_conv);
15986 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_clone(uint32_t orig) {
15987 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
15988 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
15989 *ret_copy = PaymentPurpose_clone(orig_conv);
15990 uint64_t ret_ref = (uint64_t)ret_copy;
15994 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret, int64_t user_payment_id) {
15995 LDKThirtyTwoBytes payment_preimage_ref;
15996 CHECK(*((uint32_t*)payment_preimage) == 32);
15997 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
15998 LDKThirtyTwoBytes payment_secret_ref;
15999 CHECK(*((uint32_t*)payment_secret) == 32);
16000 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
16001 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
16002 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref, user_payment_id);
16003 uint64_t ret_ref = (uint64_t)ret_copy;
16007 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
16008 LDKThirtyTwoBytes a_ref;
16009 CHECK(*((uint32_t*)a) == 32);
16010 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
16011 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
16012 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
16013 uint64_t ret_ref = (uint64_t)ret_copy;
16017 void __attribute__((visibility("default"))) TS_ClosureReason_free(uint32_t this_ptr) {
16018 if ((this_ptr & 1) != 0) return;
16019 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16020 CHECK_ACCESS(this_ptr_ptr);
16021 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
16022 FREE((void*)this_ptr);
16023 ClosureReason_free(this_ptr_conv);
16026 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
16027 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16028 *ret_copy = ClosureReason_clone(arg);
16029 uint64_t ret_ref = (uint64_t)ret_copy;
16032 int64_t __attribute__((visibility("default"))) TS_ClosureReason_clone_ptr(uint32_t arg) {
16033 LDKClosureReason* arg_conv = (LDKClosureReason*)arg;
16034 int64_t ret_val = ClosureReason_clone_ptr(arg_conv);
16038 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_clone(uint32_t orig) {
16039 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
16040 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16041 *ret_copy = ClosureReason_clone(orig_conv);
16042 uint64_t ret_ref = (uint64_t)ret_copy;
16046 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
16047 LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
16048 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16049 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
16050 uint64_t ret_ref = (uint64_t)ret_copy;
16054 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_holder_force_closed() {
16055 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16056 *ret_copy = ClosureReason_holder_force_closed();
16057 uint64_t ret_ref = (uint64_t)ret_copy;
16061 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_cooperative_closure() {
16062 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16063 *ret_copy = ClosureReason_cooperative_closure();
16064 uint64_t ret_ref = (uint64_t)ret_copy;
16068 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_commitment_tx_confirmed() {
16069 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16070 *ret_copy = ClosureReason_commitment_tx_confirmed();
16071 uint64_t ret_ref = (uint64_t)ret_copy;
16075 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_processing_error(jstring err) {
16076 LDKStr err_conv = str_ref_to_owned_c(err);
16077 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16078 *ret_copy = ClosureReason_processing_error(err_conv);
16079 uint64_t ret_ref = (uint64_t)ret_copy;
16083 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_disconnected_peer() {
16084 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16085 *ret_copy = ClosureReason_disconnected_peer();
16086 uint64_t ret_ref = (uint64_t)ret_copy;
16090 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_outdated_channel_manager() {
16091 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16092 *ret_copy = ClosureReason_outdated_channel_manager();
16093 uint64_t ret_ref = (uint64_t)ret_copy;
16097 int8_tArray __attribute__((visibility("default"))) TS_ClosureReason_write(uint32_t obj) {
16098 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
16099 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
16100 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16101 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16102 CVec_u8Z_free(ret_var);
16106 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_read(int8_tArray ser) {
16107 LDKu8slice ser_ref;
16108 ser_ref.datalen = *((uint32_t*)ser);
16109 ser_ref.data = (int8_t*)(ser + 4);
16110 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16111 *ret_conv = ClosureReason_read(ser_ref);
16112 return (uint64_t)ret_conv;
16115 void __attribute__((visibility("default"))) TS_Event_free(uint32_t this_ptr) {
16116 if ((this_ptr & 1) != 0) return;
16117 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16118 CHECK_ACCESS(this_ptr_ptr);
16119 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
16120 FREE((void*)this_ptr);
16121 Event_free(this_ptr_conv);
16124 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
16125 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16126 *ret_copy = Event_clone(arg);
16127 uint64_t ret_ref = (uint64_t)ret_copy;
16130 int64_t __attribute__((visibility("default"))) TS_Event_clone_ptr(uint32_t arg) {
16131 LDKEvent* arg_conv = (LDKEvent*)arg;
16132 int64_t ret_val = Event_clone_ptr(arg_conv);
16136 uint32_t __attribute__((visibility("default"))) TS_Event_clone(uint32_t orig) {
16137 LDKEvent* orig_conv = (LDKEvent*)orig;
16138 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16139 *ret_copy = Event_clone(orig_conv);
16140 uint64_t ret_ref = (uint64_t)ret_copy;
16144 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) {
16145 LDKThirtyTwoBytes temporary_channel_id_ref;
16146 CHECK(*((uint32_t*)temporary_channel_id) == 32);
16147 memcpy(temporary_channel_id_ref.data, (uint8_t*)(temporary_channel_id + 4), 32);
16148 LDKCVec_u8Z output_script_ref;
16149 output_script_ref.datalen = *((uint32_t*)output_script);
16150 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
16151 memcpy(output_script_ref.data, (uint8_t*)(output_script + 4), output_script_ref.datalen);
16152 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16153 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
16154 uint64_t ret_ref = (uint64_t)ret_copy;
16158 uint32_t __attribute__((visibility("default"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amt, uint32_t purpose) {
16159 LDKThirtyTwoBytes payment_hash_ref;
16160 CHECK(*((uint32_t*)payment_hash) == 32);
16161 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
16162 void* purpose_ptr = (void*)(((uint64_t)purpose) & ~1);
16163 CHECK_ACCESS(purpose_ptr);
16164 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
16165 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uint64_t)purpose) & ~1));
16166 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16167 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
16168 uint64_t ret_ref = (uint64_t)ret_copy;
16172 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) {
16173 LDKThirtyTwoBytes payment_id_ref;
16174 CHECK(*((uint32_t*)payment_id) == 32);
16175 memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32);
16176 LDKThirtyTwoBytes payment_preimage_ref;
16177 CHECK(*((uint32_t*)payment_preimage) == 32);
16178 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
16179 LDKThirtyTwoBytes payment_hash_ref;
16180 CHECK(*((uint32_t*)payment_hash) == 32);
16181 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
16182 void* fee_paid_msat_ptr = (void*)(((uint64_t)fee_paid_msat) & ~1);
16183 CHECK_ACCESS(fee_paid_msat_ptr);
16184 LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
16185 fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_paid_msat) & ~1));
16186 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16187 *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
16188 uint64_t ret_ref = (uint64_t)ret_copy;
16192 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) {
16193 LDKThirtyTwoBytes payment_id_ref;
16194 CHECK(*((uint32_t*)payment_id) == 32);
16195 memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32);
16196 LDKThirtyTwoBytes payment_hash_ref;
16197 CHECK(*((uint32_t*)payment_hash) == 32);
16198 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
16199 void* network_update_ptr = (void*)(((uint64_t)network_update) & ~1);
16200 CHECK_ACCESS(network_update_ptr);
16201 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
16202 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1));
16203 LDKCVec_RouteHopZ path_constr;
16204 path_constr.datalen = *((uint32_t*)path);
16205 if (path_constr.datalen > 0)
16206 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
16208 path_constr.data = NULL;
16209 uint32_t* path_vals = (uint32_t*)(path + 4);
16210 for (size_t k = 0; k < path_constr.datalen; k++) {
16211 uint32_t path_conv_10 = path_vals[k];
16212 LDKRouteHop path_conv_10_conv;
16213 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
16214 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
16215 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
16216 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
16217 path_constr.data[k] = path_conv_10_conv;
16219 void* short_channel_id_ptr = (void*)(((uint64_t)short_channel_id) & ~1);
16220 CHECK_ACCESS(short_channel_id_ptr);
16221 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
16222 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id) & ~1));
16223 LDKRouteParameters retry_conv;
16224 retry_conv.inner = (void*)(retry & (~1));
16225 retry_conv.is_owned = (retry & 1) || (retry == 0);
16226 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
16227 retry_conv = RouteParameters_clone(&retry_conv);
16228 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16229 *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);
16230 uint64_t ret_ref = (uint64_t)ret_copy;
16234 uint32_t __attribute__((visibility("default"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
16235 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16236 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
16237 uint64_t ret_ref = (uint64_t)ret_copy;
16241 uint32_t __attribute__((visibility("default"))) TS_Event_spendable_outputs(uint32_tArray outputs) {
16242 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
16243 outputs_constr.datalen = *((uint32_t*)outputs);
16244 if (outputs_constr.datalen > 0)
16245 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
16247 outputs_constr.data = NULL;
16248 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
16249 for (size_t b = 0; b < outputs_constr.datalen; b++) {
16250 uint32_t outputs_conv_27 = outputs_vals[b];
16251 void* outputs_conv_27_ptr = (void*)(((uint64_t)outputs_conv_27) & ~1);
16252 CHECK_ACCESS(outputs_conv_27_ptr);
16253 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
16254 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1));
16255 outputs_constr.data[b] = outputs_conv_27_conv;
16257 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16258 *ret_copy = Event_spendable_outputs(outputs_constr);
16259 uint64_t ret_ref = (uint64_t)ret_copy;
16263 uint32_t __attribute__((visibility("default"))) TS_Event_payment_forwarded(uint32_t fee_earned_msat, jboolean claim_from_onchain_tx) {
16264 void* fee_earned_msat_ptr = (void*)(((uint64_t)fee_earned_msat) & ~1);
16265 CHECK_ACCESS(fee_earned_msat_ptr);
16266 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
16267 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1));
16268 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16269 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
16270 uint64_t ret_ref = (uint64_t)ret_copy;
16274 uint32_t __attribute__((visibility("default"))) TS_Event_channel_closed(int8_tArray channel_id, int64_t user_channel_id, uint32_t reason) {
16275 LDKThirtyTwoBytes channel_id_ref;
16276 CHECK(*((uint32_t*)channel_id) == 32);
16277 memcpy(channel_id_ref.data, (uint8_t*)(channel_id + 4), 32);
16278 void* reason_ptr = (void*)(((uint64_t)reason) & ~1);
16279 CHECK_ACCESS(reason_ptr);
16280 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
16281 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1));
16282 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16283 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
16284 uint64_t ret_ref = (uint64_t)ret_copy;
16288 uint32_t __attribute__((visibility("default"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
16289 LDKThirtyTwoBytes channel_id_ref;
16290 CHECK(*((uint32_t*)channel_id) == 32);
16291 memcpy(channel_id_ref.data, (uint8_t*)(channel_id + 4), 32);
16292 LDKTransaction transaction_ref;
16293 transaction_ref.datalen = *((uint32_t*)transaction);
16294 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
16295 memcpy(transaction_ref.data, (uint8_t*)(transaction + 4), transaction_ref.datalen);
16296 transaction_ref.data_is_owned = true;
16297 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16298 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
16299 uint64_t ret_ref = (uint64_t)ret_copy;
16303 int8_tArray __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) {
16304 LDKEvent* obj_conv = (LDKEvent*)obj;
16305 LDKCVec_u8Z ret_var = Event_write(obj_conv);
16306 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16307 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16308 CVec_u8Z_free(ret_var);
16312 uint32_t __attribute__((visibility("default"))) TS_Event_read(int8_tArray ser) {
16313 LDKu8slice ser_ref;
16314 ser_ref.datalen = *((uint32_t*)ser);
16315 ser_ref.data = (int8_t*)(ser + 4);
16316 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16317 *ret_conv = Event_read(ser_ref);
16318 return (uint64_t)ret_conv;
16321 void __attribute__((visibility("default"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
16322 if ((this_ptr & 1) != 0) return;
16323 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16324 CHECK_ACCESS(this_ptr_ptr);
16325 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
16326 FREE((void*)this_ptr);
16327 MessageSendEvent_free(this_ptr_conv);
16330 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
16331 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16332 *ret_copy = MessageSendEvent_clone(arg);
16333 uint64_t ret_ref = (uint64_t)ret_copy;
16336 int64_t __attribute__((visibility("default"))) TS_MessageSendEvent_clone_ptr(uint32_t arg) {
16337 LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)arg;
16338 int64_t ret_val = MessageSendEvent_clone_ptr(arg_conv);
16342 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_clone(uint32_t orig) {
16343 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
16344 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16345 *ret_copy = MessageSendEvent_clone(orig_conv);
16346 uint64_t ret_ref = (uint64_t)ret_copy;
16350 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint32_t msg) {
16351 LDKPublicKey node_id_ref;
16352 CHECK(*((uint32_t*)node_id) == 33);
16353 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16354 LDKAcceptChannel msg_conv;
16355 msg_conv.inner = (void*)(msg & (~1));
16356 msg_conv.is_owned = (msg & 1) || (msg == 0);
16357 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16358 msg_conv = AcceptChannel_clone(&msg_conv);
16359 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16360 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
16361 uint64_t ret_ref = (uint64_t)ret_copy;
16365 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint32_t msg) {
16366 LDKPublicKey node_id_ref;
16367 CHECK(*((uint32_t*)node_id) == 33);
16368 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16369 LDKOpenChannel msg_conv;
16370 msg_conv.inner = (void*)(msg & (~1));
16371 msg_conv.is_owned = (msg & 1) || (msg == 0);
16372 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16373 msg_conv = OpenChannel_clone(&msg_conv);
16374 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16375 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
16376 uint64_t ret_ref = (uint64_t)ret_copy;
16380 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint32_t msg) {
16381 LDKPublicKey node_id_ref;
16382 CHECK(*((uint32_t*)node_id) == 33);
16383 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16384 LDKFundingCreated msg_conv;
16385 msg_conv.inner = (void*)(msg & (~1));
16386 msg_conv.is_owned = (msg & 1) || (msg == 0);
16387 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16388 msg_conv = FundingCreated_clone(&msg_conv);
16389 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16390 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
16391 uint64_t ret_ref = (uint64_t)ret_copy;
16395 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint32_t msg) {
16396 LDKPublicKey node_id_ref;
16397 CHECK(*((uint32_t*)node_id) == 33);
16398 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16399 LDKFundingSigned msg_conv;
16400 msg_conv.inner = (void*)(msg & (~1));
16401 msg_conv.is_owned = (msg & 1) || (msg == 0);
16402 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16403 msg_conv = FundingSigned_clone(&msg_conv);
16404 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16405 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
16406 uint64_t ret_ref = (uint64_t)ret_copy;
16410 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_locked(int8_tArray node_id, uint32_t msg) {
16411 LDKPublicKey node_id_ref;
16412 CHECK(*((uint32_t*)node_id) == 33);
16413 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16414 LDKFundingLocked msg_conv;
16415 msg_conv.inner = (void*)(msg & (~1));
16416 msg_conv.is_owned = (msg & 1) || (msg == 0);
16417 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16418 msg_conv = FundingLocked_clone(&msg_conv);
16419 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16420 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
16421 uint64_t ret_ref = (uint64_t)ret_copy;
16425 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint32_t msg) {
16426 LDKPublicKey node_id_ref;
16427 CHECK(*((uint32_t*)node_id) == 33);
16428 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16429 LDKAnnouncementSignatures msg_conv;
16430 msg_conv.inner = (void*)(msg & (~1));
16431 msg_conv.is_owned = (msg & 1) || (msg == 0);
16432 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16433 msg_conv = AnnouncementSignatures_clone(&msg_conv);
16434 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16435 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
16436 uint64_t ret_ref = (uint64_t)ret_copy;
16440 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint32_t updates) {
16441 LDKPublicKey node_id_ref;
16442 CHECK(*((uint32_t*)node_id) == 33);
16443 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16444 LDKCommitmentUpdate updates_conv;
16445 updates_conv.inner = (void*)(updates & (~1));
16446 updates_conv.is_owned = (updates & 1) || (updates == 0);
16447 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
16448 updates_conv = CommitmentUpdate_clone(&updates_conv);
16449 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16450 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
16451 uint64_t ret_ref = (uint64_t)ret_copy;
16455 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint32_t msg) {
16456 LDKPublicKey node_id_ref;
16457 CHECK(*((uint32_t*)node_id) == 33);
16458 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16459 LDKRevokeAndACK msg_conv;
16460 msg_conv.inner = (void*)(msg & (~1));
16461 msg_conv.is_owned = (msg & 1) || (msg == 0);
16462 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16463 msg_conv = RevokeAndACK_clone(&msg_conv);
16464 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16465 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
16466 uint64_t ret_ref = (uint64_t)ret_copy;
16470 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint32_t msg) {
16471 LDKPublicKey node_id_ref;
16472 CHECK(*((uint32_t*)node_id) == 33);
16473 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16474 LDKClosingSigned msg_conv;
16475 msg_conv.inner = (void*)(msg & (~1));
16476 msg_conv.is_owned = (msg & 1) || (msg == 0);
16477 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16478 msg_conv = ClosingSigned_clone(&msg_conv);
16479 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16480 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
16481 uint64_t ret_ref = (uint64_t)ret_copy;
16485 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint32_t msg) {
16486 LDKPublicKey node_id_ref;
16487 CHECK(*((uint32_t*)node_id) == 33);
16488 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16489 LDKShutdown msg_conv;
16490 msg_conv.inner = (void*)(msg & (~1));
16491 msg_conv.is_owned = (msg & 1) || (msg == 0);
16492 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16493 msg_conv = Shutdown_clone(&msg_conv);
16494 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16495 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
16496 uint64_t ret_ref = (uint64_t)ret_copy;
16500 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint32_t msg) {
16501 LDKPublicKey node_id_ref;
16502 CHECK(*((uint32_t*)node_id) == 33);
16503 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16504 LDKChannelReestablish msg_conv;
16505 msg_conv.inner = (void*)(msg & (~1));
16506 msg_conv.is_owned = (msg & 1) || (msg == 0);
16507 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16508 msg_conv = ChannelReestablish_clone(&msg_conv);
16509 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16510 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
16511 uint64_t ret_ref = (uint64_t)ret_copy;
16515 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_announcement(uint32_t msg, uint32_t update_msg) {
16516 LDKChannelAnnouncement msg_conv;
16517 msg_conv.inner = (void*)(msg & (~1));
16518 msg_conv.is_owned = (msg & 1) || (msg == 0);
16519 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16520 msg_conv = ChannelAnnouncement_clone(&msg_conv);
16521 LDKChannelUpdate update_msg_conv;
16522 update_msg_conv.inner = (void*)(update_msg & (~1));
16523 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
16524 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
16525 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
16526 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16527 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
16528 uint64_t ret_ref = (uint64_t)ret_copy;
16532 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_node_announcement(uint32_t msg) {
16533 LDKNodeAnnouncement msg_conv;
16534 msg_conv.inner = (void*)(msg & (~1));
16535 msg_conv.is_owned = (msg & 1) || (msg == 0);
16536 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16537 msg_conv = NodeAnnouncement_clone(&msg_conv);
16538 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16539 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
16540 uint64_t ret_ref = (uint64_t)ret_copy;
16544 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_update(uint32_t msg) {
16545 LDKChannelUpdate msg_conv;
16546 msg_conv.inner = (void*)(msg & (~1));
16547 msg_conv.is_owned = (msg & 1) || (msg == 0);
16548 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16549 msg_conv = ChannelUpdate_clone(&msg_conv);
16550 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16551 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
16552 uint64_t ret_ref = (uint64_t)ret_copy;
16556 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint32_t msg) {
16557 LDKPublicKey node_id_ref;
16558 CHECK(*((uint32_t*)node_id) == 33);
16559 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16560 LDKChannelUpdate msg_conv;
16561 msg_conv.inner = (void*)(msg & (~1));
16562 msg_conv.is_owned = (msg & 1) || (msg == 0);
16563 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16564 msg_conv = ChannelUpdate_clone(&msg_conv);
16565 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16566 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
16567 uint64_t ret_ref = (uint64_t)ret_copy;
16571 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint32_t action) {
16572 LDKPublicKey node_id_ref;
16573 CHECK(*((uint32_t*)node_id) == 33);
16574 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16575 void* action_ptr = (void*)(((uint64_t)action) & ~1);
16576 CHECK_ACCESS(action_ptr);
16577 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
16578 action_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action) & ~1));
16579 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16580 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
16581 uint64_t ret_ref = (uint64_t)ret_copy;
16585 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint32_t msg) {
16586 LDKPublicKey node_id_ref;
16587 CHECK(*((uint32_t*)node_id) == 33);
16588 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16589 LDKQueryChannelRange msg_conv;
16590 msg_conv.inner = (void*)(msg & (~1));
16591 msg_conv.is_owned = (msg & 1) || (msg == 0);
16592 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16593 msg_conv = QueryChannelRange_clone(&msg_conv);
16594 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16595 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
16596 uint64_t ret_ref = (uint64_t)ret_copy;
16600 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint32_t msg) {
16601 LDKPublicKey node_id_ref;
16602 CHECK(*((uint32_t*)node_id) == 33);
16603 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16604 LDKQueryShortChannelIds msg_conv;
16605 msg_conv.inner = (void*)(msg & (~1));
16606 msg_conv.is_owned = (msg & 1) || (msg == 0);
16607 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16608 msg_conv = QueryShortChannelIds_clone(&msg_conv);
16609 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16610 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
16611 uint64_t ret_ref = (uint64_t)ret_copy;
16615 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint32_t msg) {
16616 LDKPublicKey node_id_ref;
16617 CHECK(*((uint32_t*)node_id) == 33);
16618 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16619 LDKReplyChannelRange msg_conv;
16620 msg_conv.inner = (void*)(msg & (~1));
16621 msg_conv.is_owned = (msg & 1) || (msg == 0);
16622 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16623 msg_conv = ReplyChannelRange_clone(&msg_conv);
16624 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16625 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
16626 uint64_t ret_ref = (uint64_t)ret_copy;
16630 void __attribute__((visibility("default"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
16631 if ((this_ptr & 1) != 0) return;
16632 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16633 CHECK_ACCESS(this_ptr_ptr);
16634 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
16635 FREE((void*)this_ptr);
16636 MessageSendEventsProvider_free(this_ptr_conv);
16639 void __attribute__((visibility("default"))) TS_EventsProvider_free(uint32_t this_ptr) {
16640 if ((this_ptr & 1) != 0) return;
16641 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16642 CHECK_ACCESS(this_ptr_ptr);
16643 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
16644 FREE((void*)this_ptr);
16645 EventsProvider_free(this_ptr_conv);
16648 void __attribute__((visibility("default"))) TS_EventHandler_free(uint32_t this_ptr) {
16649 if ((this_ptr & 1) != 0) return;
16650 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16651 CHECK_ACCESS(this_ptr_ptr);
16652 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
16653 FREE((void*)this_ptr);
16654 EventHandler_free(this_ptr_conv);
16657 void __attribute__((visibility("default"))) TS_APIError_free(uint32_t this_ptr) {
16658 if ((this_ptr & 1) != 0) return;
16659 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16660 CHECK_ACCESS(this_ptr_ptr);
16661 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
16662 FREE((void*)this_ptr);
16663 APIError_free(this_ptr_conv);
16666 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
16667 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16668 *ret_copy = APIError_clone(arg);
16669 uint64_t ret_ref = (uint64_t)ret_copy;
16672 int64_t __attribute__((visibility("default"))) TS_APIError_clone_ptr(uint32_t arg) {
16673 LDKAPIError* arg_conv = (LDKAPIError*)arg;
16674 int64_t ret_val = APIError_clone_ptr(arg_conv);
16678 uint32_t __attribute__((visibility("default"))) TS_APIError_clone(uint32_t orig) {
16679 LDKAPIError* orig_conv = (LDKAPIError*)orig;
16680 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16681 *ret_copy = APIError_clone(orig_conv);
16682 uint64_t ret_ref = (uint64_t)ret_copy;
16686 uint32_t __attribute__((visibility("default"))) TS_APIError_apimisuse_error(jstring err) {
16687 LDKStr err_conv = str_ref_to_owned_c(err);
16688 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16689 *ret_copy = APIError_apimisuse_error(err_conv);
16690 uint64_t ret_ref = (uint64_t)ret_copy;
16694 uint32_t __attribute__((visibility("default"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
16695 LDKStr err_conv = str_ref_to_owned_c(err);
16696 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16697 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
16698 uint64_t ret_ref = (uint64_t)ret_copy;
16702 uint32_t __attribute__((visibility("default"))) TS_APIError_route_error(jstring err) {
16703 LDKStr err_conv = str_ref_to_owned_c(err);
16704 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16705 *ret_copy = APIError_route_error(err_conv);
16706 uint64_t ret_ref = (uint64_t)ret_copy;
16710 uint32_t __attribute__((visibility("default"))) TS_APIError_channel_unavailable(jstring err) {
16711 LDKStr err_conv = str_ref_to_owned_c(err);
16712 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16713 *ret_copy = APIError_channel_unavailable(err_conv);
16714 uint64_t ret_ref = (uint64_t)ret_copy;
16718 uint32_t __attribute__((visibility("default"))) TS_APIError_monitor_update_failed() {
16719 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16720 *ret_copy = APIError_monitor_update_failed();
16721 uint64_t ret_ref = (uint64_t)ret_copy;
16725 uint32_t __attribute__((visibility("default"))) TS_APIError_incompatible_shutdown_script(uint32_t script) {
16726 LDKShutdownScript script_conv;
16727 script_conv.inner = (void*)(script & (~1));
16728 script_conv.is_owned = (script & 1) || (script == 0);
16729 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
16730 script_conv = ShutdownScript_clone(&script_conv);
16731 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16732 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
16733 uint64_t ret_ref = (uint64_t)ret_copy;
16737 uint32_t __attribute__((visibility("default"))) TS_sign(int8_tArray msg, int8_tArray sk) {
16738 LDKu8slice msg_ref;
16739 msg_ref.datalen = *((uint32_t*)msg);
16740 msg_ref.data = (int8_t*)(msg + 4);
16741 unsigned char sk_arr[32];
16742 CHECK(*((uint32_t*)sk) == 32);
16743 memcpy(sk_arr, (uint8_t*)(sk + 4), 32);
16744 unsigned char (*sk_ref)[32] = &sk_arr;
16745 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16746 *ret_conv = sign(msg_ref, sk_ref);
16747 return (uint64_t)ret_conv;
16750 uint32_t __attribute__((visibility("default"))) TS_recover_pk(int8_tArray msg, jstring sig) {
16751 LDKu8slice msg_ref;
16752 msg_ref.datalen = *((uint32_t*)msg);
16753 msg_ref.data = (int8_t*)(msg + 4);
16754 LDKStr sig_conv = str_ref_to_owned_c(sig);
16755 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
16756 *ret_conv = recover_pk(msg_ref, sig_conv);
16757 return (uint64_t)ret_conv;
16760 jboolean __attribute__((visibility("default"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
16761 LDKu8slice msg_ref;
16762 msg_ref.datalen = *((uint32_t*)msg);
16763 msg_ref.data = (int8_t*)(msg + 4);
16764 LDKStr sig_conv = str_ref_to_owned_c(sig);
16765 LDKPublicKey pk_ref;
16766 CHECK(*((uint32_t*)pk) == 33);
16767 memcpy(pk_ref.compressed_form, (uint8_t*)(pk + 4), 33);
16768 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
16772 uint32_t __attribute__((visibility("default"))) TS_Level_clone(uint32_t orig) {
16773 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
16774 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
16778 uint32_t __attribute__((visibility("default"))) TS_Level_trace() {
16779 uint32_t ret_conv = LDKLevel_to_js(Level_trace());
16783 uint32_t __attribute__((visibility("default"))) TS_Level_debug() {
16784 uint32_t ret_conv = LDKLevel_to_js(Level_debug());
16788 uint32_t __attribute__((visibility("default"))) TS_Level_info() {
16789 uint32_t ret_conv = LDKLevel_to_js(Level_info());
16793 uint32_t __attribute__((visibility("default"))) TS_Level_warn() {
16794 uint32_t ret_conv = LDKLevel_to_js(Level_warn());
16798 uint32_t __attribute__((visibility("default"))) TS_Level_error() {
16799 uint32_t ret_conv = LDKLevel_to_js(Level_error());
16803 jboolean __attribute__((visibility("default"))) TS_Level_eq(uint32_t a, uint32_t b) {
16804 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
16805 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
16806 jboolean ret_val = Level_eq(a_conv, b_conv);
16810 int64_t __attribute__((visibility("default"))) TS_Level_hash(uint32_t o) {
16811 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
16812 int64_t ret_val = Level_hash(o_conv);
16816 uint32_t __attribute__((visibility("default"))) TS_Level_max() {
16817 uint32_t ret_conv = LDKLevel_to_js(Level_max());
16821 void __attribute__((visibility("default"))) TS_Record_free(uint32_t this_obj) {
16822 LDKRecord this_obj_conv;
16823 this_obj_conv.inner = (void*)(this_obj & (~1));
16824 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16825 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
16826 Record_free(this_obj_conv);
16829 uint32_t __attribute__((visibility("default"))) TS_Record_get_level(uint32_t this_ptr) {
16830 LDKRecord this_ptr_conv;
16831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16832 this_ptr_conv.is_owned = false;
16833 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16834 uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
16838 void __attribute__((visibility("default"))) TS_Record_set_level(uint32_t this_ptr, uint32_t val) {
16839 LDKRecord this_ptr_conv;
16840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16841 this_ptr_conv.is_owned = false;
16842 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16843 LDKLevel val_conv = LDKLevel_from_js(val);
16844 Record_set_level(&this_ptr_conv, val_conv);
16847 jstring __attribute__((visibility("default"))) TS_Record_get_args(uint32_t this_ptr) {
16848 LDKRecord this_ptr_conv;
16849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16850 this_ptr_conv.is_owned = false;
16851 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16852 LDKStr ret_str = Record_get_args(&this_ptr_conv);
16853 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
16858 void __attribute__((visibility("default"))) TS_Record_set_args(uint32_t this_ptr, jstring val) {
16859 LDKRecord this_ptr_conv;
16860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16861 this_ptr_conv.is_owned = false;
16862 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16863 LDKStr val_conv = str_ref_to_owned_c(val);
16864 Record_set_args(&this_ptr_conv, val_conv);
16867 jstring __attribute__((visibility("default"))) TS_Record_get_module_path(uint32_t this_ptr) {
16868 LDKRecord this_ptr_conv;
16869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16870 this_ptr_conv.is_owned = false;
16871 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16872 LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
16873 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
16878 void __attribute__((visibility("default"))) TS_Record_set_module_path(uint32_t this_ptr, jstring val) {
16879 LDKRecord this_ptr_conv;
16880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16881 this_ptr_conv.is_owned = false;
16882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16883 LDKStr val_conv = str_ref_to_owned_c(val);
16884 Record_set_module_path(&this_ptr_conv, val_conv);
16887 jstring __attribute__((visibility("default"))) TS_Record_get_file(uint32_t this_ptr) {
16888 LDKRecord this_ptr_conv;
16889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16890 this_ptr_conv.is_owned = false;
16891 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16892 LDKStr ret_str = Record_get_file(&this_ptr_conv);
16893 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
16898 void __attribute__((visibility("default"))) TS_Record_set_file(uint32_t this_ptr, jstring val) {
16899 LDKRecord this_ptr_conv;
16900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16901 this_ptr_conv.is_owned = false;
16902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16903 LDKStr val_conv = str_ref_to_owned_c(val);
16904 Record_set_file(&this_ptr_conv, val_conv);
16907 int32_t __attribute__((visibility("default"))) TS_Record_get_line(uint32_t this_ptr) {
16908 LDKRecord this_ptr_conv;
16909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16910 this_ptr_conv.is_owned = false;
16911 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16912 int32_t ret_val = Record_get_line(&this_ptr_conv);
16916 void __attribute__((visibility("default"))) TS_Record_set_line(uint32_t this_ptr, int32_t val) {
16917 LDKRecord this_ptr_conv;
16918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16919 this_ptr_conv.is_owned = false;
16920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16921 Record_set_line(&this_ptr_conv, val);
16924 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
16925 LDKRecord ret_var = Record_clone(arg);
16926 uint64_t ret_ref = 0;
16927 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16928 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16929 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16930 ret_ref = (uint64_t)ret_var.inner;
16931 if (ret_var.is_owned) {
16936 int64_t __attribute__((visibility("default"))) TS_Record_clone_ptr(uint32_t arg) {
16937 LDKRecord arg_conv;
16938 arg_conv.inner = (void*)(arg & (~1));
16939 arg_conv.is_owned = false;
16940 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
16941 int64_t ret_val = Record_clone_ptr(&arg_conv);
16945 uint32_t __attribute__((visibility("default"))) TS_Record_clone(uint32_t orig) {
16946 LDKRecord orig_conv;
16947 orig_conv.inner = (void*)(orig & (~1));
16948 orig_conv.is_owned = false;
16949 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
16950 LDKRecord ret_var = Record_clone(&orig_conv);
16951 uint64_t ret_ref = 0;
16952 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16953 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16954 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16955 ret_ref = (uint64_t)ret_var.inner;
16956 if (ret_var.is_owned) {
16962 void __attribute__((visibility("default"))) TS_Logger_free(uint32_t this_ptr) {
16963 if ((this_ptr & 1) != 0) return;
16964 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16965 CHECK_ACCESS(this_ptr_ptr);
16966 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
16967 FREE((void*)this_ptr);
16968 Logger_free(this_ptr_conv);
16971 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_free(uint32_t this_obj) {
16972 LDKChannelHandshakeConfig this_obj_conv;
16973 this_obj_conv.inner = (void*)(this_obj & (~1));
16974 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16975 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
16976 ChannelHandshakeConfig_free(this_obj_conv);
16979 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
16980 LDKChannelHandshakeConfig this_ptr_conv;
16981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16982 this_ptr_conv.is_owned = false;
16983 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16984 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
16988 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
16989 LDKChannelHandshakeConfig this_ptr_conv;
16990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16991 this_ptr_conv.is_owned = false;
16992 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16993 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
16996 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
16997 LDKChannelHandshakeConfig this_ptr_conv;
16998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16999 this_ptr_conv.is_owned = false;
17000 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17001 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
17005 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_to_self_delay(uint32_t this_ptr, int16_t val) {
17006 LDKChannelHandshakeConfig this_ptr_conv;
17007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17008 this_ptr_conv.is_owned = false;
17009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17010 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
17013 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
17014 LDKChannelHandshakeConfig this_ptr_conv;
17015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17016 this_ptr_conv.is_owned = false;
17017 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17018 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
17022 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
17023 LDKChannelHandshakeConfig this_ptr_conv;
17024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17025 this_ptr_conv.is_owned = false;
17026 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17027 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
17030 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) {
17031 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
17032 uint64_t ret_ref = 0;
17033 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17034 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17035 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17036 ret_ref = (uint64_t)ret_var.inner;
17037 if (ret_var.is_owned) {
17043 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
17044 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
17045 uint64_t ret_ref = 0;
17046 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17047 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17048 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17049 ret_ref = (uint64_t)ret_var.inner;
17050 if (ret_var.is_owned) {
17055 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_clone_ptr(uint32_t arg) {
17056 LDKChannelHandshakeConfig arg_conv;
17057 arg_conv.inner = (void*)(arg & (~1));
17058 arg_conv.is_owned = false;
17059 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17060 int64_t ret_val = ChannelHandshakeConfig_clone_ptr(&arg_conv);
17064 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
17065 LDKChannelHandshakeConfig orig_conv;
17066 orig_conv.inner = (void*)(orig & (~1));
17067 orig_conv.is_owned = false;
17068 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17069 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
17070 uint64_t ret_ref = 0;
17071 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17072 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17073 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17074 ret_ref = (uint64_t)ret_var.inner;
17075 if (ret_var.is_owned) {
17081 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_default() {
17082 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
17083 uint64_t ret_ref = 0;
17084 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17085 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17086 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17087 ret_ref = (uint64_t)ret_var.inner;
17088 if (ret_var.is_owned) {
17094 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_free(uint32_t this_obj) {
17095 LDKChannelHandshakeLimits this_obj_conv;
17096 this_obj_conv.inner = (void*)(this_obj & (~1));
17097 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17098 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17099 ChannelHandshakeLimits_free(this_obj_conv);
17102 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
17103 LDKChannelHandshakeLimits this_ptr_conv;
17104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17105 this_ptr_conv.is_owned = false;
17106 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17107 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
17111 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
17112 LDKChannelHandshakeLimits this_ptr_conv;
17113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17114 this_ptr_conv.is_owned = false;
17115 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17116 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
17119 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
17120 LDKChannelHandshakeLimits this_ptr_conv;
17121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17122 this_ptr_conv.is_owned = false;
17123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17124 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
17128 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
17129 LDKChannelHandshakeLimits this_ptr_conv;
17130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17131 this_ptr_conv.is_owned = false;
17132 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17133 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
17136 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
17137 LDKChannelHandshakeLimits this_ptr_conv;
17138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17139 this_ptr_conv.is_owned = false;
17140 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17141 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
17145 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
17146 LDKChannelHandshakeLimits this_ptr_conv;
17147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17148 this_ptr_conv.is_owned = false;
17149 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17150 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
17153 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
17154 LDKChannelHandshakeLimits this_ptr_conv;
17155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17156 this_ptr_conv.is_owned = false;
17157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17158 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
17162 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
17163 LDKChannelHandshakeLimits this_ptr_conv;
17164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17165 this_ptr_conv.is_owned = false;
17166 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17167 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
17170 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
17171 LDKChannelHandshakeLimits this_ptr_conv;
17172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17173 this_ptr_conv.is_owned = false;
17174 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17175 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
17179 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
17180 LDKChannelHandshakeLimits this_ptr_conv;
17181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17182 this_ptr_conv.is_owned = false;
17183 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17184 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
17187 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
17188 LDKChannelHandshakeLimits this_ptr_conv;
17189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17190 this_ptr_conv.is_owned = false;
17191 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17192 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
17196 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
17197 LDKChannelHandshakeLimits this_ptr_conv;
17198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17199 this_ptr_conv.is_owned = false;
17200 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17201 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
17204 jboolean __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
17205 LDKChannelHandshakeLimits this_ptr_conv;
17206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17207 this_ptr_conv.is_owned = false;
17208 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17209 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
17213 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
17214 LDKChannelHandshakeLimits this_ptr_conv;
17215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17216 this_ptr_conv.is_owned = false;
17217 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17218 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
17221 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
17222 LDKChannelHandshakeLimits this_ptr_conv;
17223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17224 this_ptr_conv.is_owned = false;
17225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17226 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
17230 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_their_to_self_delay(uint32_t this_ptr, int16_t val) {
17231 LDKChannelHandshakeLimits this_ptr_conv;
17232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17233 this_ptr_conv.is_owned = false;
17234 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17235 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
17238 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) {
17239 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);
17240 uint64_t ret_ref = 0;
17241 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17242 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17243 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17244 ret_ref = (uint64_t)ret_var.inner;
17245 if (ret_var.is_owned) {
17251 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
17252 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
17253 uint64_t ret_ref = 0;
17254 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17255 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17256 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17257 ret_ref = (uint64_t)ret_var.inner;
17258 if (ret_var.is_owned) {
17263 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_clone_ptr(uint32_t arg) {
17264 LDKChannelHandshakeLimits arg_conv;
17265 arg_conv.inner = (void*)(arg & (~1));
17266 arg_conv.is_owned = false;
17267 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17268 int64_t ret_val = ChannelHandshakeLimits_clone_ptr(&arg_conv);
17272 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
17273 LDKChannelHandshakeLimits orig_conv;
17274 orig_conv.inner = (void*)(orig & (~1));
17275 orig_conv.is_owned = false;
17276 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17277 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
17278 uint64_t ret_ref = 0;
17279 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17280 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17281 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17282 ret_ref = (uint64_t)ret_var.inner;
17283 if (ret_var.is_owned) {
17289 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_default() {
17290 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
17291 uint64_t ret_ref = 0;
17292 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17293 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17294 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17295 ret_ref = (uint64_t)ret_var.inner;
17296 if (ret_var.is_owned) {
17302 void __attribute__((visibility("default"))) TS_ChannelConfig_free(uint32_t this_obj) {
17303 LDKChannelConfig this_obj_conv;
17304 this_obj_conv.inner = (void*)(this_obj & (~1));
17305 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17306 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17307 ChannelConfig_free(this_obj_conv);
17310 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint32_t this_ptr) {
17311 LDKChannelConfig this_ptr_conv;
17312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17313 this_ptr_conv.is_owned = false;
17314 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17315 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
17319 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
17320 LDKChannelConfig this_ptr_conv;
17321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17322 this_ptr_conv.is_owned = false;
17323 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17324 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
17327 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint32_t this_ptr) {
17328 LDKChannelConfig this_ptr_conv;
17329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17330 this_ptr_conv.is_owned = false;
17331 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17332 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
17336 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_base_msat(uint32_t this_ptr, int32_t val) {
17337 LDKChannelConfig this_ptr_conv;
17338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17339 this_ptr_conv.is_owned = false;
17340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17341 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
17344 int16_t __attribute__((visibility("default"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) {
17345 LDKChannelConfig this_ptr_conv;
17346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17347 this_ptr_conv.is_owned = false;
17348 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17349 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
17353 void __attribute__((visibility("default"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
17354 LDKChannelConfig this_ptr_conv;
17355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17356 this_ptr_conv.is_owned = false;
17357 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17358 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
17361 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
17362 LDKChannelConfig this_ptr_conv;
17363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17364 this_ptr_conv.is_owned = false;
17365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17366 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
17370 void __attribute__((visibility("default"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
17371 LDKChannelConfig this_ptr_conv;
17372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17373 this_ptr_conv.is_owned = false;
17374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17375 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
17378 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
17379 LDKChannelConfig this_ptr_conv;
17380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17381 this_ptr_conv.is_owned = false;
17382 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17383 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
17387 void __attribute__((visibility("default"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
17388 LDKChannelConfig 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 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
17395 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_get_max_dust_htlc_exposure_msat(uint32_t this_ptr) {
17396 LDKChannelConfig this_ptr_conv;
17397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17398 this_ptr_conv.is_owned = false;
17399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17400 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
17404 void __attribute__((visibility("default"))) TS_ChannelConfig_set_max_dust_htlc_exposure_msat(uint32_t this_ptr, int64_t val) {
17405 LDKChannelConfig this_ptr_conv;
17406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17407 this_ptr_conv.is_owned = false;
17408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17409 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
17412 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_get_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr) {
17413 LDKChannelConfig this_ptr_conv;
17414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17415 this_ptr_conv.is_owned = false;
17416 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17417 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
17421 void __attribute__((visibility("default"))) TS_ChannelConfig_set_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
17422 LDKChannelConfig this_ptr_conv;
17423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17424 this_ptr_conv.is_owned = false;
17425 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17426 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
17429 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) {
17430 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);
17431 uint64_t ret_ref = 0;
17432 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17433 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17434 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17435 ret_ref = (uint64_t)ret_var.inner;
17436 if (ret_var.is_owned) {
17442 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
17443 LDKChannelConfig ret_var = ChannelConfig_clone(arg);
17444 uint64_t ret_ref = 0;
17445 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17446 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17447 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17448 ret_ref = (uint64_t)ret_var.inner;
17449 if (ret_var.is_owned) {
17454 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_clone_ptr(uint32_t arg) {
17455 LDKChannelConfig arg_conv;
17456 arg_conv.inner = (void*)(arg & (~1));
17457 arg_conv.is_owned = false;
17458 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17459 int64_t ret_val = ChannelConfig_clone_ptr(&arg_conv);
17463 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_clone(uint32_t orig) {
17464 LDKChannelConfig orig_conv;
17465 orig_conv.inner = (void*)(orig & (~1));
17466 orig_conv.is_owned = false;
17467 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17468 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
17469 uint64_t ret_ref = 0;
17470 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17471 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17472 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17473 ret_ref = (uint64_t)ret_var.inner;
17474 if (ret_var.is_owned) {
17480 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_default() {
17481 LDKChannelConfig ret_var = ChannelConfig_default();
17482 uint64_t ret_ref = 0;
17483 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17484 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17485 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17486 ret_ref = (uint64_t)ret_var.inner;
17487 if (ret_var.is_owned) {
17493 int8_tArray __attribute__((visibility("default"))) TS_ChannelConfig_write(uint32_t obj) {
17494 LDKChannelConfig obj_conv;
17495 obj_conv.inner = (void*)(obj & (~1));
17496 obj_conv.is_owned = false;
17497 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
17498 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
17499 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17500 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17501 CVec_u8Z_free(ret_var);
17505 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_read(int8_tArray ser) {
17506 LDKu8slice ser_ref;
17507 ser_ref.datalen = *((uint32_t*)ser);
17508 ser_ref.data = (int8_t*)(ser + 4);
17509 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
17510 *ret_conv = ChannelConfig_read(ser_ref);
17511 return (uint64_t)ret_conv;
17514 void __attribute__((visibility("default"))) TS_UserConfig_free(uint32_t this_obj) {
17515 LDKUserConfig this_obj_conv;
17516 this_obj_conv.inner = (void*)(this_obj & (~1));
17517 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17518 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17519 UserConfig_free(this_obj_conv);
17522 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
17523 LDKUserConfig this_ptr_conv;
17524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17525 this_ptr_conv.is_owned = false;
17526 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17527 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
17528 uint64_t ret_ref = 0;
17529 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17530 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17531 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17532 ret_ref = (uint64_t)ret_var.inner;
17533 if (ret_var.is_owned) {
17539 void __attribute__((visibility("default"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
17540 LDKUserConfig this_ptr_conv;
17541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17542 this_ptr_conv.is_owned = false;
17543 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17544 LDKChannelHandshakeConfig val_conv;
17545 val_conv.inner = (void*)(val & (~1));
17546 val_conv.is_owned = (val & 1) || (val == 0);
17547 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
17548 val_conv = ChannelHandshakeConfig_clone(&val_conv);
17549 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
17552 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
17553 LDKUserConfig this_ptr_conv;
17554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17555 this_ptr_conv.is_owned = false;
17556 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17557 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
17558 uint64_t ret_ref = 0;
17559 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17560 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17561 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17562 ret_ref = (uint64_t)ret_var.inner;
17563 if (ret_var.is_owned) {
17569 void __attribute__((visibility("default"))) TS_UserConfig_set_peer_channel_config_limits(uint32_t this_ptr, uint32_t val) {
17570 LDKUserConfig this_ptr_conv;
17571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17572 this_ptr_conv.is_owned = false;
17573 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17574 LDKChannelHandshakeLimits val_conv;
17575 val_conv.inner = (void*)(val & (~1));
17576 val_conv.is_owned = (val & 1) || (val == 0);
17577 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
17578 val_conv = ChannelHandshakeLimits_clone(&val_conv);
17579 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
17582 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
17583 LDKUserConfig this_ptr_conv;
17584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17585 this_ptr_conv.is_owned = false;
17586 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17587 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
17588 uint64_t ret_ref = 0;
17589 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17590 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17591 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17592 ret_ref = (uint64_t)ret_var.inner;
17593 if (ret_var.is_owned) {
17599 void __attribute__((visibility("default"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
17600 LDKUserConfig this_ptr_conv;
17601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17602 this_ptr_conv.is_owned = false;
17603 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17604 LDKChannelConfig val_conv;
17605 val_conv.inner = (void*)(val & (~1));
17606 val_conv.is_owned = (val & 1) || (val == 0);
17607 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
17608 val_conv = ChannelConfig_clone(&val_conv);
17609 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
17612 jboolean __attribute__((visibility("default"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint32_t this_ptr) {
17613 LDKUserConfig this_ptr_conv;
17614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17615 this_ptr_conv.is_owned = false;
17616 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17617 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
17621 void __attribute__((visibility("default"))) TS_UserConfig_set_accept_forwards_to_priv_channels(uint32_t this_ptr, jboolean val) {
17622 LDKUserConfig this_ptr_conv;
17623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17624 this_ptr_conv.is_owned = false;
17625 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17626 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
17629 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) {
17630 LDKChannelHandshakeConfig own_channel_config_arg_conv;
17631 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
17632 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
17633 CHECK_INNER_FIELD_ACCESS_OR_NULL(own_channel_config_arg_conv);
17634 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
17635 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
17636 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
17637 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
17638 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_channel_config_limits_arg_conv);
17639 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
17640 LDKChannelConfig channel_options_arg_conv;
17641 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
17642 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
17643 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_options_arg_conv);
17644 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
17645 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);
17646 uint64_t ret_ref = 0;
17647 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17648 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17649 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17650 ret_ref = (uint64_t)ret_var.inner;
17651 if (ret_var.is_owned) {
17657 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
17658 LDKUserConfig ret_var = UserConfig_clone(arg);
17659 uint64_t ret_ref = 0;
17660 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17661 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17662 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17663 ret_ref = (uint64_t)ret_var.inner;
17664 if (ret_var.is_owned) {
17669 int64_t __attribute__((visibility("default"))) TS_UserConfig_clone_ptr(uint32_t arg) {
17670 LDKUserConfig arg_conv;
17671 arg_conv.inner = (void*)(arg & (~1));
17672 arg_conv.is_owned = false;
17673 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17674 int64_t ret_val = UserConfig_clone_ptr(&arg_conv);
17678 uint32_t __attribute__((visibility("default"))) TS_UserConfig_clone(uint32_t orig) {
17679 LDKUserConfig orig_conv;
17680 orig_conv.inner = (void*)(orig & (~1));
17681 orig_conv.is_owned = false;
17682 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17683 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
17684 uint64_t ret_ref = 0;
17685 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17686 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17687 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17688 ret_ref = (uint64_t)ret_var.inner;
17689 if (ret_var.is_owned) {
17695 uint32_t __attribute__((visibility("default"))) TS_UserConfig_default() {
17696 LDKUserConfig ret_var = UserConfig_default();
17697 uint64_t ret_ref = 0;
17698 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17699 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17700 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17701 ret_ref = (uint64_t)ret_var.inner;
17702 if (ret_var.is_owned) {
17708 void __attribute__((visibility("default"))) TS_BestBlock_free(uint32_t this_obj) {
17709 LDKBestBlock this_obj_conv;
17710 this_obj_conv.inner = (void*)(this_obj & (~1));
17711 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17712 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17713 BestBlock_free(this_obj_conv);
17716 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
17717 LDKBestBlock ret_var = BestBlock_clone(arg);
17718 uint64_t ret_ref = 0;
17719 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17720 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17721 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17722 ret_ref = (uint64_t)ret_var.inner;
17723 if (ret_var.is_owned) {
17728 int64_t __attribute__((visibility("default"))) TS_BestBlock_clone_ptr(uint32_t arg) {
17729 LDKBestBlock arg_conv;
17730 arg_conv.inner = (void*)(arg & (~1));
17731 arg_conv.is_owned = false;
17732 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17733 int64_t ret_val = BestBlock_clone_ptr(&arg_conv);
17737 uint32_t __attribute__((visibility("default"))) TS_BestBlock_clone(uint32_t orig) {
17738 LDKBestBlock orig_conv;
17739 orig_conv.inner = (void*)(orig & (~1));
17740 orig_conv.is_owned = false;
17741 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17742 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
17743 uint64_t ret_ref = 0;
17744 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17745 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17746 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17747 ret_ref = (uint64_t)ret_var.inner;
17748 if (ret_var.is_owned) {
17754 uint32_t __attribute__((visibility("default"))) TS_BestBlock_from_genesis(uint32_t network) {
17755 LDKNetwork network_conv = LDKNetwork_from_js(network);
17756 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
17757 uint64_t ret_ref = 0;
17758 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17759 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17760 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17761 ret_ref = (uint64_t)ret_var.inner;
17762 if (ret_var.is_owned) {
17768 uint32_t __attribute__((visibility("default"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
17769 LDKThirtyTwoBytes block_hash_ref;
17770 CHECK(*((uint32_t*)block_hash) == 32);
17771 memcpy(block_hash_ref.data, (uint8_t*)(block_hash + 4), 32);
17772 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
17773 uint64_t ret_ref = 0;
17774 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17775 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17776 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17777 ret_ref = (uint64_t)ret_var.inner;
17778 if (ret_var.is_owned) {
17784 int8_tArray __attribute__((visibility("default"))) TS_BestBlock_block_hash(uint32_t this_arg) {
17785 LDKBestBlock this_arg_conv;
17786 this_arg_conv.inner = (void*)(this_arg & (~1));
17787 this_arg_conv.is_owned = false;
17788 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
17789 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17790 memcpy((uint8_t*)(ret_arr + 4), BestBlock_block_hash(&this_arg_conv).data, 32);
17794 int32_t __attribute__((visibility("default"))) TS_BestBlock_height(uint32_t this_arg) {
17795 LDKBestBlock this_arg_conv;
17796 this_arg_conv.inner = (void*)(this_arg & (~1));
17797 this_arg_conv.is_owned = false;
17798 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
17799 int32_t ret_val = BestBlock_height(&this_arg_conv);
17803 uint32_t __attribute__((visibility("default"))) TS_AccessError_clone(uint32_t orig) {
17804 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
17805 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
17809 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_chain() {
17810 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
17814 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_tx() {
17815 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
17819 void __attribute__((visibility("default"))) TS_Access_free(uint32_t this_ptr) {
17820 if ((this_ptr & 1) != 0) return;
17821 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17822 CHECK_ACCESS(this_ptr_ptr);
17823 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
17824 FREE((void*)this_ptr);
17825 Access_free(this_ptr_conv);
17828 void __attribute__((visibility("default"))) TS_Listen_free(uint32_t this_ptr) {
17829 if ((this_ptr & 1) != 0) return;
17830 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17831 CHECK_ACCESS(this_ptr_ptr);
17832 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
17833 FREE((void*)this_ptr);
17834 Listen_free(this_ptr_conv);
17837 void __attribute__((visibility("default"))) TS_Confirm_free(uint32_t this_ptr) {
17838 if ((this_ptr & 1) != 0) return;
17839 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17840 CHECK_ACCESS(this_ptr_ptr);
17841 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
17842 FREE((void*)this_ptr);
17843 Confirm_free(this_ptr_conv);
17846 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
17847 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
17848 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
17852 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_temporary_failure() {
17853 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure());
17857 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_permanent_failure() {
17858 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure());
17862 void __attribute__((visibility("default"))) TS_Watch_free(uint32_t this_ptr) {
17863 if ((this_ptr & 1) != 0) return;
17864 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17865 CHECK_ACCESS(this_ptr_ptr);
17866 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
17867 FREE((void*)this_ptr);
17868 Watch_free(this_ptr_conv);
17871 void __attribute__((visibility("default"))) TS_Filter_free(uint32_t this_ptr) {
17872 if ((this_ptr & 1) != 0) return;
17873 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17874 CHECK_ACCESS(this_ptr_ptr);
17875 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
17876 FREE((void*)this_ptr);
17877 Filter_free(this_ptr_conv);
17880 void __attribute__((visibility("default"))) TS_WatchedOutput_free(uint32_t this_obj) {
17881 LDKWatchedOutput this_obj_conv;
17882 this_obj_conv.inner = (void*)(this_obj & (~1));
17883 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17885 WatchedOutput_free(this_obj_conv);
17888 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_block_hash(uint32_t this_ptr) {
17889 LDKWatchedOutput this_ptr_conv;
17890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17891 this_ptr_conv.is_owned = false;
17892 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17893 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17894 memcpy((uint8_t*)(ret_arr + 4), WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
17898 void __attribute__((visibility("default"))) TS_WatchedOutput_set_block_hash(uint32_t this_ptr, int8_tArray val) {
17899 LDKWatchedOutput this_ptr_conv;
17900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17901 this_ptr_conv.is_owned = false;
17902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17903 LDKThirtyTwoBytes val_ref;
17904 CHECK(*((uint32_t*)val) == 32);
17905 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17906 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
17909 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_get_outpoint(uint32_t this_ptr) {
17910 LDKWatchedOutput this_ptr_conv;
17911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17912 this_ptr_conv.is_owned = false;
17913 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17914 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
17915 uint64_t ret_ref = 0;
17916 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17917 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17918 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17919 ret_ref = (uint64_t)ret_var.inner;
17920 if (ret_var.is_owned) {
17926 void __attribute__((visibility("default"))) TS_WatchedOutput_set_outpoint(uint32_t this_ptr, uint32_t val) {
17927 LDKWatchedOutput this_ptr_conv;
17928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17929 this_ptr_conv.is_owned = false;
17930 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17931 LDKOutPoint val_conv;
17932 val_conv.inner = (void*)(val & (~1));
17933 val_conv.is_owned = (val & 1) || (val == 0);
17934 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
17935 val_conv = OutPoint_clone(&val_conv);
17936 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
17939 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_script_pubkey(uint32_t this_ptr) {
17940 LDKWatchedOutput this_ptr_conv;
17941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17942 this_ptr_conv.is_owned = false;
17943 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17944 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
17945 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17946 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17950 void __attribute__((visibility("default"))) TS_WatchedOutput_set_script_pubkey(uint32_t this_ptr, int8_tArray val) {
17951 LDKWatchedOutput this_ptr_conv;
17952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17953 this_ptr_conv.is_owned = false;
17954 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17955 LDKCVec_u8Z val_ref;
17956 val_ref.datalen = *((uint32_t*)val);
17957 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
17958 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
17959 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
17962 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_new(int8_tArray block_hash_arg, uint32_t outpoint_arg, int8_tArray script_pubkey_arg) {
17963 LDKThirtyTwoBytes block_hash_arg_ref;
17964 CHECK(*((uint32_t*)block_hash_arg) == 32);
17965 memcpy(block_hash_arg_ref.data, (uint8_t*)(block_hash_arg + 4), 32);
17966 LDKOutPoint outpoint_arg_conv;
17967 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
17968 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
17969 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
17970 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
17971 LDKCVec_u8Z script_pubkey_arg_ref;
17972 script_pubkey_arg_ref.datalen = *((uint32_t*)script_pubkey_arg);
17973 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
17974 memcpy(script_pubkey_arg_ref.data, (uint8_t*)(script_pubkey_arg + 4), script_pubkey_arg_ref.datalen);
17975 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
17976 uint64_t ret_ref = 0;
17977 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17978 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17979 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17980 ret_ref = (uint64_t)ret_var.inner;
17981 if (ret_var.is_owned) {
17987 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
17988 LDKWatchedOutput ret_var = WatchedOutput_clone(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) {
17999 int64_t __attribute__((visibility("default"))) TS_WatchedOutput_clone_ptr(uint32_t arg) {
18000 LDKWatchedOutput arg_conv;
18001 arg_conv.inner = (void*)(arg & (~1));
18002 arg_conv.is_owned = false;
18003 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18004 int64_t ret_val = WatchedOutput_clone_ptr(&arg_conv);
18008 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_clone(uint32_t orig) {
18009 LDKWatchedOutput orig_conv;
18010 orig_conv.inner = (void*)(orig & (~1));
18011 orig_conv.is_owned = false;
18012 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18013 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
18014 uint64_t ret_ref = 0;
18015 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18016 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18017 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18018 ret_ref = (uint64_t)ret_var.inner;
18019 if (ret_var.is_owned) {
18025 int64_t __attribute__((visibility("default"))) TS_WatchedOutput_hash(uint32_t o) {
18026 LDKWatchedOutput o_conv;
18027 o_conv.inner = (void*)(o & (~1));
18028 o_conv.is_owned = false;
18029 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18030 int64_t ret_val = WatchedOutput_hash(&o_conv);
18034 void __attribute__((visibility("default"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
18035 if ((this_ptr & 1) != 0) return;
18036 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18037 CHECK_ACCESS(this_ptr_ptr);
18038 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
18039 FREE((void*)this_ptr);
18040 BroadcasterInterface_free(this_ptr_conv);
18043 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_clone(uint32_t orig) {
18044 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
18045 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
18049 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_background() {
18050 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
18054 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_normal() {
18055 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
18059 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_high_priority() {
18060 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
18064 jboolean __attribute__((visibility("default"))) TS_ConfirmationTarget_eq(uint32_t a, uint32_t b) {
18065 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
18066 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
18067 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
18071 void __attribute__((visibility("default"))) TS_FeeEstimator_free(uint32_t this_ptr) {
18072 if ((this_ptr & 1) != 0) return;
18073 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18074 CHECK_ACCESS(this_ptr_ptr);
18075 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
18076 FREE((void*)this_ptr);
18077 FeeEstimator_free(this_ptr_conv);
18080 void __attribute__((visibility("default"))) TS_MonitorUpdateId_free(uint32_t this_obj) {
18081 LDKMonitorUpdateId this_obj_conv;
18082 this_obj_conv.inner = (void*)(this_obj & (~1));
18083 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18084 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18085 MonitorUpdateId_free(this_obj_conv);
18088 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
18089 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
18090 uint64_t ret_ref = 0;
18091 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18092 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18093 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18094 ret_ref = (uint64_t)ret_var.inner;
18095 if (ret_var.is_owned) {
18100 int64_t __attribute__((visibility("default"))) TS_MonitorUpdateId_clone_ptr(uint32_t arg) {
18101 LDKMonitorUpdateId arg_conv;
18102 arg_conv.inner = (void*)(arg & (~1));
18103 arg_conv.is_owned = false;
18104 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18105 int64_t ret_val = MonitorUpdateId_clone_ptr(&arg_conv);
18109 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateId_clone(uint32_t orig) {
18110 LDKMonitorUpdateId orig_conv;
18111 orig_conv.inner = (void*)(orig & (~1));
18112 orig_conv.is_owned = false;
18113 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18114 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
18115 uint64_t ret_ref = 0;
18116 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18117 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18118 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18119 ret_ref = (uint64_t)ret_var.inner;
18120 if (ret_var.is_owned) {
18126 int64_t __attribute__((visibility("default"))) TS_MonitorUpdateId_hash(uint32_t o) {
18127 LDKMonitorUpdateId o_conv;
18128 o_conv.inner = (void*)(o & (~1));
18129 o_conv.is_owned = false;
18130 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18131 int64_t ret_val = MonitorUpdateId_hash(&o_conv);
18135 jboolean __attribute__((visibility("default"))) TS_MonitorUpdateId_eq(uint32_t a, uint32_t b) {
18136 LDKMonitorUpdateId a_conv;
18137 a_conv.inner = (void*)(a & (~1));
18138 a_conv.is_owned = false;
18139 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18140 LDKMonitorUpdateId b_conv;
18141 b_conv.inner = (void*)(b & (~1));
18142 b_conv.is_owned = false;
18143 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18144 jboolean ret_val = MonitorUpdateId_eq(&a_conv, &b_conv);
18148 void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) {
18149 if ((this_ptr & 1) != 0) return;
18150 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18151 CHECK_ACCESS(this_ptr_ptr);
18152 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
18153 FREE((void*)this_ptr);
18154 Persist_free(this_ptr_conv);
18157 void __attribute__((visibility("default"))) TS_LockedChannelMonitor_free(uint32_t this_obj) {
18158 LDKLockedChannelMonitor this_obj_conv;
18159 this_obj_conv.inner = (void*)(this_obj & (~1));
18160 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18161 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18162 LockedChannelMonitor_free(this_obj_conv);
18165 void __attribute__((visibility("default"))) TS_ChainMonitor_free(uint32_t this_obj) {
18166 LDKChainMonitor this_obj_conv;
18167 this_obj_conv.inner = (void*)(this_obj & (~1));
18168 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18169 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18170 ChainMonitor_free(this_obj_conv);
18173 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_new(uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
18174 void* chain_source_ptr = (void*)(((uint64_t)chain_source) & ~1);
18175 CHECK_ACCESS(chain_source_ptr);
18176 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
18177 // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ
18178 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
18179 // Manually implement clone for Java trait instances
18181 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
18182 CHECK_ACCESS(broadcaster_ptr);
18183 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
18184 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
18185 CHECK_ACCESS(logger_ptr);
18186 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
18187 void* feeest_ptr = (void*)(((uint64_t)feeest) & ~1);
18188 CHECK_ACCESS(feeest_ptr);
18189 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
18190 void* persister_ptr = (void*)(((uint64_t)persister) & ~1);
18191 CHECK_ACCESS(persister_ptr);
18192 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
18193 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
18194 uint64_t ret_ref = 0;
18195 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18196 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18197 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18198 ret_ref = (uint64_t)ret_var.inner;
18199 if (ret_var.is_owned) {
18205 uint32_tArray __attribute__((visibility("default"))) TS_ChainMonitor_get_claimable_balances(uint32_t this_arg, uint32_tArray ignored_channels) {
18206 LDKChainMonitor this_arg_conv;
18207 this_arg_conv.inner = (void*)(this_arg & (~1));
18208 this_arg_conv.is_owned = false;
18209 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18210 LDKCVec_ChannelDetailsZ ignored_channels_constr;
18211 ignored_channels_constr.datalen = *((uint32_t*)ignored_channels);
18212 if (ignored_channels_constr.datalen > 0)
18213 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
18215 ignored_channels_constr.data = NULL;
18216 uint32_t* ignored_channels_vals = (uint32_t*)(ignored_channels + 4);
18217 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
18218 uint32_t ignored_channels_conv_16 = ignored_channels_vals[q];
18219 LDKChannelDetails ignored_channels_conv_16_conv;
18220 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
18221 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
18222 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
18223 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
18224 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
18226 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
18227 uint32_tArray ret_arr = NULL;
18228 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
18229 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
18230 for (size_t j = 0; j < ret_var.datalen; j++) {
18231 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18232 *ret_conv_9_copy = ret_var.data[j];
18233 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
18234 ret_arr_ptr[j] = ret_conv_9_ref;
18237 FREE(ret_var.data);
18241 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_get_monitor(uint32_t this_arg, uint32_t funding_txo) {
18242 LDKChainMonitor this_arg_conv;
18243 this_arg_conv.inner = (void*)(this_arg & (~1));
18244 this_arg_conv.is_owned = false;
18245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18246 LDKOutPoint funding_txo_conv;
18247 funding_txo_conv.inner = (void*)(funding_txo & (~1));
18248 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
18249 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
18250 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
18251 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
18252 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
18253 return (uint64_t)ret_conv;
18256 uint32_tArray __attribute__((visibility("default"))) TS_ChainMonitor_list_monitors(uint32_t this_arg) {
18257 LDKChainMonitor this_arg_conv;
18258 this_arg_conv.inner = (void*)(this_arg & (~1));
18259 this_arg_conv.is_owned = false;
18260 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18261 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
18262 uint32_tArray ret_arr = NULL;
18263 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
18264 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
18265 for (size_t k = 0; k < ret_var.datalen; k++) {
18266 LDKOutPoint ret_conv_10_var = ret_var.data[k];
18267 uint64_t ret_conv_10_ref = 0;
18268 CHECK((((uint64_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18269 CHECK((((uint64_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18270 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
18271 ret_conv_10_ref = (uint64_t)ret_conv_10_var.inner;
18272 if (ret_conv_10_var.is_owned) {
18273 ret_conv_10_ref |= 1;
18275 ret_arr_ptr[k] = ret_conv_10_ref;
18278 FREE(ret_var.data);
18282 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_channel_monitor_updated(uint32_t this_arg, uint32_t funding_txo, uint32_t completed_update_id) {
18283 LDKChainMonitor this_arg_conv;
18284 this_arg_conv.inner = (void*)(this_arg & (~1));
18285 this_arg_conv.is_owned = false;
18286 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18287 LDKOutPoint funding_txo_conv;
18288 funding_txo_conv.inner = (void*)(funding_txo & (~1));
18289 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
18290 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
18291 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
18292 LDKMonitorUpdateId completed_update_id_conv;
18293 completed_update_id_conv.inner = (void*)(completed_update_id & (~1));
18294 completed_update_id_conv.is_owned = (completed_update_id & 1) || (completed_update_id == 0);
18295 CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
18296 completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
18297 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18298 *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
18299 return (uint64_t)ret_conv;
18302 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Listen(uint32_t this_arg) {
18303 LDKChainMonitor this_arg_conv;
18304 this_arg_conv.inner = (void*)(this_arg & (~1));
18305 this_arg_conv.is_owned = false;
18306 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18307 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
18308 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
18309 return (uint64_t)ret_ret;
18312 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Confirm(uint32_t this_arg) {
18313 LDKChainMonitor this_arg_conv;
18314 this_arg_conv.inner = (void*)(this_arg & (~1));
18315 this_arg_conv.is_owned = false;
18316 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18317 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
18318 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
18319 return (uint64_t)ret_ret;
18322 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
18323 LDKChainMonitor this_arg_conv;
18324 this_arg_conv.inner = (void*)(this_arg & (~1));
18325 this_arg_conv.is_owned = false;
18326 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18327 LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
18328 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
18329 return (uint64_t)ret_ret;
18332 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
18333 LDKChainMonitor this_arg_conv;
18334 this_arg_conv.inner = (void*)(this_arg & (~1));
18335 this_arg_conv.is_owned = false;
18336 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18337 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
18338 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
18339 return (uint64_t)ret_ret;
18342 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
18343 LDKChannelMonitorUpdate this_obj_conv;
18344 this_obj_conv.inner = (void*)(this_obj & (~1));
18345 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18346 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18347 ChannelMonitorUpdate_free(this_obj_conv);
18350 int64_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
18351 LDKChannelMonitorUpdate this_ptr_conv;
18352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18353 this_ptr_conv.is_owned = false;
18354 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18355 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
18359 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
18360 LDKChannelMonitorUpdate this_ptr_conv;
18361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18362 this_ptr_conv.is_owned = false;
18363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18364 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
18367 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
18368 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
18369 uint64_t ret_ref = 0;
18370 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18371 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18372 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18373 ret_ref = (uint64_t)ret_var.inner;
18374 if (ret_var.is_owned) {
18379 int64_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_clone_ptr(uint32_t arg) {
18380 LDKChannelMonitorUpdate arg_conv;
18381 arg_conv.inner = (void*)(arg & (~1));
18382 arg_conv.is_owned = false;
18383 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18384 int64_t ret_val = ChannelMonitorUpdate_clone_ptr(&arg_conv);
18388 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
18389 LDKChannelMonitorUpdate orig_conv;
18390 orig_conv.inner = (void*)(orig & (~1));
18391 orig_conv.is_owned = false;
18392 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18393 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
18394 uint64_t ret_ref = 0;
18395 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18396 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18397 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18398 ret_ref = (uint64_t)ret_var.inner;
18399 if (ret_var.is_owned) {
18405 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
18406 LDKChannelMonitorUpdate obj_conv;
18407 obj_conv.inner = (void*)(obj & (~1));
18408 obj_conv.is_owned = false;
18409 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
18410 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
18411 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18412 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18413 CVec_u8Z_free(ret_var);
18417 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
18418 LDKu8slice ser_ref;
18419 ser_ref.datalen = *((uint32_t*)ser);
18420 ser_ref.data = (int8_t*)(ser + 4);
18421 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18422 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
18423 return (uint64_t)ret_conv;
18426 void __attribute__((visibility("default"))) TS_MonitorUpdateError_free(uint32_t this_obj) {
18427 LDKMonitorUpdateError this_obj_conv;
18428 this_obj_conv.inner = (void*)(this_obj & (~1));
18429 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18431 MonitorUpdateError_free(this_obj_conv);
18434 jstring __attribute__((visibility("default"))) TS_MonitorUpdateError_get_a(uint32_t this_ptr) {
18435 LDKMonitorUpdateError this_ptr_conv;
18436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18437 this_ptr_conv.is_owned = false;
18438 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18439 LDKStr ret_str = MonitorUpdateError_get_a(&this_ptr_conv);
18440 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
18445 void __attribute__((visibility("default"))) TS_MonitorUpdateError_set_a(uint32_t this_ptr, jstring val) {
18446 LDKMonitorUpdateError this_ptr_conv;
18447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18448 this_ptr_conv.is_owned = false;
18449 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18450 LDKStr val_conv = str_ref_to_owned_c(val);
18451 MonitorUpdateError_set_a(&this_ptr_conv, val_conv);
18454 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateError_new(jstring a_arg) {
18455 LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
18456 LDKMonitorUpdateError ret_var = MonitorUpdateError_new(a_arg_conv);
18457 uint64_t ret_ref = 0;
18458 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18459 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18460 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18461 ret_ref = (uint64_t)ret_var.inner;
18462 if (ret_var.is_owned) {
18468 static inline uint64_t MonitorUpdateError_clone_ptr(LDKMonitorUpdateError *NONNULL_PTR arg) {
18469 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(arg);
18470 uint64_t ret_ref = 0;
18471 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18472 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18473 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18474 ret_ref = (uint64_t)ret_var.inner;
18475 if (ret_var.is_owned) {
18480 int64_t __attribute__((visibility("default"))) TS_MonitorUpdateError_clone_ptr(uint32_t arg) {
18481 LDKMonitorUpdateError arg_conv;
18482 arg_conv.inner = (void*)(arg & (~1));
18483 arg_conv.is_owned = false;
18484 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18485 int64_t ret_val = MonitorUpdateError_clone_ptr(&arg_conv);
18489 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateError_clone(uint32_t orig) {
18490 LDKMonitorUpdateError orig_conv;
18491 orig_conv.inner = (void*)(orig & (~1));
18492 orig_conv.is_owned = false;
18493 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18494 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
18495 uint64_t ret_ref = 0;
18496 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18497 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18498 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18499 ret_ref = (uint64_t)ret_var.inner;
18500 if (ret_var.is_owned) {
18506 void __attribute__((visibility("default"))) TS_MonitorEvent_free(uint32_t this_ptr) {
18507 if ((this_ptr & 1) != 0) return;
18508 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18509 CHECK_ACCESS(this_ptr_ptr);
18510 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
18511 FREE((void*)this_ptr);
18512 MonitorEvent_free(this_ptr_conv);
18515 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
18516 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18517 *ret_copy = MonitorEvent_clone(arg);
18518 uint64_t ret_ref = (uint64_t)ret_copy;
18521 int64_t __attribute__((visibility("default"))) TS_MonitorEvent_clone_ptr(uint32_t arg) {
18522 LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)arg;
18523 int64_t ret_val = MonitorEvent_clone_ptr(arg_conv);
18527 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_clone(uint32_t orig) {
18528 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
18529 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18530 *ret_copy = MonitorEvent_clone(orig_conv);
18531 uint64_t ret_ref = (uint64_t)ret_copy;
18535 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_htlcevent(uint32_t a) {
18536 LDKHTLCUpdate a_conv;
18537 a_conv.inner = (void*)(a & (~1));
18538 a_conv.is_owned = (a & 1) || (a == 0);
18539 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18540 a_conv = HTLCUpdate_clone(&a_conv);
18541 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18542 *ret_copy = MonitorEvent_htlcevent(a_conv);
18543 uint64_t ret_ref = (uint64_t)ret_copy;
18547 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_commitment_tx_confirmed(uint32_t a) {
18548 LDKOutPoint a_conv;
18549 a_conv.inner = (void*)(a & (~1));
18550 a_conv.is_owned = (a & 1) || (a == 0);
18551 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18552 a_conv = OutPoint_clone(&a_conv);
18553 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18554 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
18555 uint64_t ret_ref = (uint64_t)ret_copy;
18559 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_update_completed(uint32_t funding_txo, int64_t monitor_update_id) {
18560 LDKOutPoint funding_txo_conv;
18561 funding_txo_conv.inner = (void*)(funding_txo & (~1));
18562 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
18563 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
18564 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
18565 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18566 *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
18567 uint64_t ret_ref = (uint64_t)ret_copy;
18571 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_update_failed(uint32_t a) {
18572 LDKOutPoint a_conv;
18573 a_conv.inner = (void*)(a & (~1));
18574 a_conv.is_owned = (a & 1) || (a == 0);
18575 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18576 a_conv = OutPoint_clone(&a_conv);
18577 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18578 *ret_copy = MonitorEvent_update_failed(a_conv);
18579 uint64_t ret_ref = (uint64_t)ret_copy;
18583 int8_tArray __attribute__((visibility("default"))) TS_MonitorEvent_write(uint32_t obj) {
18584 LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)obj;
18585 LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
18586 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18587 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18588 CVec_u8Z_free(ret_var);
18592 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_read(int8_tArray ser) {
18593 LDKu8slice ser_ref;
18594 ser_ref.datalen = *((uint32_t*)ser);
18595 ser_ref.data = (int8_t*)(ser + 4);
18596 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18597 *ret_conv = MonitorEvent_read(ser_ref);
18598 return (uint64_t)ret_conv;
18601 void __attribute__((visibility("default"))) TS_HTLCUpdate_free(uint32_t this_obj) {
18602 LDKHTLCUpdate this_obj_conv;
18603 this_obj_conv.inner = (void*)(this_obj & (~1));
18604 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18605 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18606 HTLCUpdate_free(this_obj_conv);
18609 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
18610 LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
18611 uint64_t ret_ref = 0;
18612 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18613 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18614 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18615 ret_ref = (uint64_t)ret_var.inner;
18616 if (ret_var.is_owned) {
18621 int64_t __attribute__((visibility("default"))) TS_HTLCUpdate_clone_ptr(uint32_t arg) {
18622 LDKHTLCUpdate arg_conv;
18623 arg_conv.inner = (void*)(arg & (~1));
18624 arg_conv.is_owned = false;
18625 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18626 int64_t ret_val = HTLCUpdate_clone_ptr(&arg_conv);
18630 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_clone(uint32_t orig) {
18631 LDKHTLCUpdate orig_conv;
18632 orig_conv.inner = (void*)(orig & (~1));
18633 orig_conv.is_owned = false;
18634 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18635 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
18636 uint64_t ret_ref = 0;
18637 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18638 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18639 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18640 ret_ref = (uint64_t)ret_var.inner;
18641 if (ret_var.is_owned) {
18647 int8_tArray __attribute__((visibility("default"))) TS_HTLCUpdate_write(uint32_t obj) {
18648 LDKHTLCUpdate obj_conv;
18649 obj_conv.inner = (void*)(obj & (~1));
18650 obj_conv.is_owned = false;
18651 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
18652 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
18653 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18654 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18655 CVec_u8Z_free(ret_var);
18659 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_read(int8_tArray ser) {
18660 LDKu8slice ser_ref;
18661 ser_ref.datalen = *((uint32_t*)ser);
18662 ser_ref.data = (int8_t*)(ser + 4);
18663 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18664 *ret_conv = HTLCUpdate_read(ser_ref);
18665 return (uint64_t)ret_conv;
18668 void __attribute__((visibility("default"))) TS_Balance_free(uint32_t this_ptr) {
18669 if ((this_ptr & 1) != 0) return;
18670 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18671 CHECK_ACCESS(this_ptr_ptr);
18672 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
18673 FREE((void*)this_ptr);
18674 Balance_free(this_ptr_conv);
18677 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
18678 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18679 *ret_copy = Balance_clone(arg);
18680 uint64_t ret_ref = (uint64_t)ret_copy;
18683 int64_t __attribute__((visibility("default"))) TS_Balance_clone_ptr(uint32_t arg) {
18684 LDKBalance* arg_conv = (LDKBalance*)arg;
18685 int64_t ret_val = Balance_clone_ptr(arg_conv);
18689 uint32_t __attribute__((visibility("default"))) TS_Balance_clone(uint32_t orig) {
18690 LDKBalance* orig_conv = (LDKBalance*)orig;
18691 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18692 *ret_copy = Balance_clone(orig_conv);
18693 uint64_t ret_ref = (uint64_t)ret_copy;
18697 uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
18698 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18699 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
18700 uint64_t ret_ref = (uint64_t)ret_copy;
18704 uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
18705 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18706 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
18707 uint64_t ret_ref = (uint64_t)ret_copy;
18711 uint32_t __attribute__((visibility("default"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
18712 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18713 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
18714 uint64_t ret_ref = (uint64_t)ret_copy;
18718 uint32_t __attribute__((visibility("default"))) TS_Balance_maybe_claimable_htlcawaiting_timeout(int64_t claimable_amount_satoshis, int32_t claimable_height) {
18719 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18720 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
18721 uint64_t ret_ref = (uint64_t)ret_copy;
18725 jboolean __attribute__((visibility("default"))) TS_Balance_eq(uint32_t a, uint32_t b) {
18726 LDKBalance* a_conv = (LDKBalance*)a;
18727 LDKBalance* b_conv = (LDKBalance*)b;
18728 jboolean ret_val = Balance_eq(a_conv, b_conv);
18732 void __attribute__((visibility("default"))) TS_ChannelMonitor_free(uint32_t this_obj) {
18733 LDKChannelMonitor 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 ChannelMonitor_free(this_obj_conv);
18740 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
18741 LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
18742 uint64_t ret_ref = 0;
18743 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18744 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18745 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18746 ret_ref = (uint64_t)ret_var.inner;
18747 if (ret_var.is_owned) {
18752 int64_t __attribute__((visibility("default"))) TS_ChannelMonitor_clone_ptr(uint32_t arg) {
18753 LDKChannelMonitor arg_conv;
18754 arg_conv.inner = (void*)(arg & (~1));
18755 arg_conv.is_owned = false;
18756 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18757 int64_t ret_val = ChannelMonitor_clone_ptr(&arg_conv);
18761 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_clone(uint32_t orig) {
18762 LDKChannelMonitor orig_conv;
18763 orig_conv.inner = (void*)(orig & (~1));
18764 orig_conv.is_owned = false;
18765 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18766 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
18767 uint64_t ret_ref = 0;
18768 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18769 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18770 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18771 ret_ref = (uint64_t)ret_var.inner;
18772 if (ret_var.is_owned) {
18778 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_write(uint32_t obj) {
18779 LDKChannelMonitor obj_conv;
18780 obj_conv.inner = (void*)(obj & (~1));
18781 obj_conv.is_owned = false;
18782 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
18783 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
18784 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18785 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18786 CVec_u8Z_free(ret_var);
18790 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) {
18791 LDKChannelMonitor this_arg_conv;
18792 this_arg_conv.inner = (void*)(this_arg & (~1));
18793 this_arg_conv.is_owned = false;
18794 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18795 LDKChannelMonitorUpdate updates_conv;
18796 updates_conv.inner = (void*)(updates & (~1));
18797 updates_conv.is_owned = false;
18798 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
18799 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
18800 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
18801 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
18802 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
18803 if (!(fee_estimator & 1)) { CHECK_ACCESS(fee_estimator_ptr); }
18804 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
18805 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
18806 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
18807 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
18808 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
18809 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
18810 return (uint64_t)ret_conv;
18813 int64_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
18814 LDKChannelMonitor this_arg_conv;
18815 this_arg_conv.inner = (void*)(this_arg & (~1));
18816 this_arg_conv.is_owned = false;
18817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18818 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
18822 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
18823 LDKChannelMonitor this_arg_conv;
18824 this_arg_conv.inner = (void*)(this_arg & (~1));
18825 this_arg_conv.is_owned = false;
18826 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18827 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
18828 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
18829 return ((uint64_t)ret_conv);
18832 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_outputs_to_watch(uint32_t this_arg) {
18833 LDKChannelMonitor this_arg_conv;
18834 this_arg_conv.inner = (void*)(this_arg & (~1));
18835 this_arg_conv.is_owned = false;
18836 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18837 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
18838 uint32_tArray ret_arr = NULL;
18839 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
18840 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
18841 for (size_t o = 0; o < ret_var.datalen; o++) {
18842 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18843 *ret_conv_40_conv = ret_var.data[o];
18844 ret_arr_ptr[o] = ((uint64_t)ret_conv_40_conv);
18847 FREE(ret_var.data);
18851 void __attribute__((visibility("default"))) TS_ChannelMonitor_load_outputs_to_watch(uint32_t this_arg, uint32_t filter) {
18852 LDKChannelMonitor this_arg_conv;
18853 this_arg_conv.inner = (void*)(this_arg & (~1));
18854 this_arg_conv.is_owned = false;
18855 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18856 void* filter_ptr = (void*)(((uint64_t)filter) & ~1);
18857 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
18858 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
18859 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
18862 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_monitor_events(uint32_t this_arg) {
18863 LDKChannelMonitor this_arg_conv;
18864 this_arg_conv.inner = (void*)(this_arg & (~1));
18865 this_arg_conv.is_owned = false;
18866 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18867 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
18868 uint32_tArray ret_arr = NULL;
18869 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
18870 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
18871 for (size_t o = 0; o < ret_var.datalen; o++) {
18872 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18873 *ret_conv_14_copy = ret_var.data[o];
18874 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
18875 ret_arr_ptr[o] = ret_conv_14_ref;
18878 FREE(ret_var.data);
18882 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
18883 LDKChannelMonitor this_arg_conv;
18884 this_arg_conv.inner = (void*)(this_arg & (~1));
18885 this_arg_conv.is_owned = false;
18886 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18887 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
18888 uint32_tArray ret_arr = NULL;
18889 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
18890 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
18891 for (size_t h = 0; h < ret_var.datalen; h++) {
18892 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
18893 *ret_conv_7_copy = ret_var.data[h];
18894 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
18895 ret_arr_ptr[h] = ret_conv_7_ref;
18898 FREE(ret_var.data);
18902 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_holder_commitment_txn(uint32_t this_arg, uint32_t logger) {
18903 LDKChannelMonitor this_arg_conv;
18904 this_arg_conv.inner = (void*)(this_arg & (~1));
18905 this_arg_conv.is_owned = false;
18906 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18907 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
18908 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
18909 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
18910 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
18911 ptrArray ret_arr = NULL;
18912 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
18913 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
18914 for (size_t m = 0; m < ret_var.datalen; m++) {
18915 LDKTransaction ret_conv_12_var = ret_var.data[m];
18916 int8_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18917 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_conv_12_var.data, ret_conv_12_var.datalen);
18918 Transaction_free(ret_conv_12_var);
18919 ret_arr_ptr[m] = ret_conv_12_arr;
18922 FREE(ret_var.data);
18926 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) {
18927 LDKChannelMonitor this_arg_conv;
18928 this_arg_conv.inner = (void*)(this_arg & (~1));
18929 this_arg_conv.is_owned = false;
18930 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18931 unsigned char header_arr[80];
18932 CHECK(*((uint32_t*)header) == 80);
18933 memcpy(header_arr, (uint8_t*)(header + 4), 80);
18934 unsigned char (*header_ref)[80] = &header_arr;
18935 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
18936 txdata_constr.datalen = *((uint32_t*)txdata);
18937 if (txdata_constr.datalen > 0)
18938 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
18940 txdata_constr.data = NULL;
18941 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
18942 for (size_t c = 0; c < txdata_constr.datalen; c++) {
18943 uint32_t txdata_conv_28 = txdata_vals[c];
18944 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
18945 CHECK_ACCESS(txdata_conv_28_ptr);
18946 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
18947 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
18948 txdata_constr.data[c] = txdata_conv_28_conv;
18950 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
18951 CHECK_ACCESS(broadcaster_ptr);
18952 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
18953 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
18954 CHECK_ACCESS(fee_estimator_ptr);
18955 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
18956 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
18957 CHECK_ACCESS(logger_ptr);
18958 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
18959 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);
18960 uint32_tArray ret_arr = NULL;
18961 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
18962 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
18963 for (size_t n = 0; n < ret_var.datalen; n++) {
18964 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18965 *ret_conv_39_conv = ret_var.data[n];
18966 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
18969 FREE(ret_var.data);
18973 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) {
18974 LDKChannelMonitor this_arg_conv;
18975 this_arg_conv.inner = (void*)(this_arg & (~1));
18976 this_arg_conv.is_owned = false;
18977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18978 unsigned char header_arr[80];
18979 CHECK(*((uint32_t*)header) == 80);
18980 memcpy(header_arr, (uint8_t*)(header + 4), 80);
18981 unsigned char (*header_ref)[80] = &header_arr;
18982 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
18983 CHECK_ACCESS(broadcaster_ptr);
18984 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
18985 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
18986 CHECK_ACCESS(fee_estimator_ptr);
18987 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
18988 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
18989 CHECK_ACCESS(logger_ptr);
18990 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
18991 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
18994 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) {
18995 LDKChannelMonitor this_arg_conv;
18996 this_arg_conv.inner = (void*)(this_arg & (~1));
18997 this_arg_conv.is_owned = false;
18998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18999 unsigned char header_arr[80];
19000 CHECK(*((uint32_t*)header) == 80);
19001 memcpy(header_arr, (uint8_t*)(header + 4), 80);
19002 unsigned char (*header_ref)[80] = &header_arr;
19003 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
19004 txdata_constr.datalen = *((uint32_t*)txdata);
19005 if (txdata_constr.datalen > 0)
19006 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
19008 txdata_constr.data = NULL;
19009 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
19010 for (size_t c = 0; c < txdata_constr.datalen; c++) {
19011 uint32_t txdata_conv_28 = txdata_vals[c];
19012 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
19013 CHECK_ACCESS(txdata_conv_28_ptr);
19014 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
19015 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
19016 txdata_constr.data[c] = txdata_conv_28_conv;
19018 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19019 CHECK_ACCESS(broadcaster_ptr);
19020 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19021 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19022 CHECK_ACCESS(fee_estimator_ptr);
19023 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19024 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19025 CHECK_ACCESS(logger_ptr);
19026 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19027 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);
19028 uint32_tArray ret_arr = NULL;
19029 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
19030 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19031 for (size_t n = 0; n < ret_var.datalen; n++) {
19032 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19033 *ret_conv_39_conv = ret_var.data[n];
19034 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
19037 FREE(ret_var.data);
19041 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) {
19042 LDKChannelMonitor this_arg_conv;
19043 this_arg_conv.inner = (void*)(this_arg & (~1));
19044 this_arg_conv.is_owned = false;
19045 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19046 unsigned char txid_arr[32];
19047 CHECK(*((uint32_t*)txid) == 32);
19048 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
19049 unsigned char (*txid_ref)[32] = &txid_arr;
19050 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19051 CHECK_ACCESS(broadcaster_ptr);
19052 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19053 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19054 CHECK_ACCESS(fee_estimator_ptr);
19055 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19056 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19057 CHECK_ACCESS(logger_ptr);
19058 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19059 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
19062 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) {
19063 LDKChannelMonitor this_arg_conv;
19064 this_arg_conv.inner = (void*)(this_arg & (~1));
19065 this_arg_conv.is_owned = false;
19066 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19067 unsigned char header_arr[80];
19068 CHECK(*((uint32_t*)header) == 80);
19069 memcpy(header_arr, (uint8_t*)(header + 4), 80);
19070 unsigned char (*header_ref)[80] = &header_arr;
19071 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19072 CHECK_ACCESS(broadcaster_ptr);
19073 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19074 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19075 CHECK_ACCESS(fee_estimator_ptr);
19076 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19077 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19078 CHECK_ACCESS(logger_ptr);
19079 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19080 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
19081 uint32_tArray ret_arr = NULL;
19082 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
19083 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19084 for (size_t n = 0; n < ret_var.datalen; n++) {
19085 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19086 *ret_conv_39_conv = ret_var.data[n];
19087 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
19090 FREE(ret_var.data);
19094 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_relevant_txids(uint32_t this_arg) {
19095 LDKChannelMonitor this_arg_conv;
19096 this_arg_conv.inner = (void*)(this_arg & (~1));
19097 this_arg_conv.is_owned = false;
19098 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19099 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
19100 ptrArray ret_arr = NULL;
19101 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
19102 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
19103 for (size_t m = 0; m < ret_var.datalen; m++) {
19104 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19105 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
19106 ret_arr_ptr[m] = ret_conv_12_arr;
19109 FREE(ret_var.data);
19113 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_current_best_block(uint32_t this_arg) {
19114 LDKChannelMonitor this_arg_conv;
19115 this_arg_conv.inner = (void*)(this_arg & (~1));
19116 this_arg_conv.is_owned = false;
19117 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19118 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
19119 uint64_t ret_ref = 0;
19120 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19121 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19122 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19123 ret_ref = (uint64_t)ret_var.inner;
19124 if (ret_var.is_owned) {
19130 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_claimable_balances(uint32_t this_arg) {
19131 LDKChannelMonitor this_arg_conv;
19132 this_arg_conv.inner = (void*)(this_arg & (~1));
19133 this_arg_conv.is_owned = false;
19134 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19135 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
19136 uint32_tArray ret_arr = NULL;
19137 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
19138 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19139 for (size_t j = 0; j < ret_var.datalen; j++) {
19140 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19141 *ret_conv_9_copy = ret_var.data[j];
19142 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
19143 ret_arr_ptr[j] = ret_conv_9_ref;
19146 FREE(ret_var.data);
19150 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
19151 LDKu8slice ser_ref;
19152 ser_ref.datalen = *((uint32_t*)ser);
19153 ser_ref.data = (int8_t*)(ser + 4);
19154 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
19155 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
19156 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
19157 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19158 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
19159 return (uint64_t)ret_conv;
19162 void __attribute__((visibility("default"))) TS_OutPoint_free(uint32_t this_obj) {
19163 LDKOutPoint this_obj_conv;
19164 this_obj_conv.inner = (void*)(this_obj & (~1));
19165 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19166 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19167 OutPoint_free(this_obj_conv);
19170 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
19171 LDKOutPoint this_ptr_conv;
19172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19173 this_ptr_conv.is_owned = false;
19174 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19175 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19176 memcpy((uint8_t*)(ret_arr + 4), *OutPoint_get_txid(&this_ptr_conv), 32);
19180 void __attribute__((visibility("default"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
19181 LDKOutPoint this_ptr_conv;
19182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19183 this_ptr_conv.is_owned = false;
19184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19185 LDKThirtyTwoBytes val_ref;
19186 CHECK(*((uint32_t*)val) == 32);
19187 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19188 OutPoint_set_txid(&this_ptr_conv, val_ref);
19191 int16_t __attribute__((visibility("default"))) TS_OutPoint_get_index(uint32_t this_ptr) {
19192 LDKOutPoint this_ptr_conv;
19193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19194 this_ptr_conv.is_owned = false;
19195 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19196 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
19200 void __attribute__((visibility("default"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
19201 LDKOutPoint this_ptr_conv;
19202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19203 this_ptr_conv.is_owned = false;
19204 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19205 OutPoint_set_index(&this_ptr_conv, val);
19208 uint32_t __attribute__((visibility("default"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
19209 LDKThirtyTwoBytes txid_arg_ref;
19210 CHECK(*((uint32_t*)txid_arg) == 32);
19211 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
19212 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
19213 uint64_t ret_ref = 0;
19214 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19215 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19216 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19217 ret_ref = (uint64_t)ret_var.inner;
19218 if (ret_var.is_owned) {
19224 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
19225 LDKOutPoint ret_var = OutPoint_clone(arg);
19226 uint64_t ret_ref = 0;
19227 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19228 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19229 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19230 ret_ref = (uint64_t)ret_var.inner;
19231 if (ret_var.is_owned) {
19236 int64_t __attribute__((visibility("default"))) TS_OutPoint_clone_ptr(uint32_t arg) {
19237 LDKOutPoint arg_conv;
19238 arg_conv.inner = (void*)(arg & (~1));
19239 arg_conv.is_owned = false;
19240 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
19241 int64_t ret_val = OutPoint_clone_ptr(&arg_conv);
19245 uint32_t __attribute__((visibility("default"))) TS_OutPoint_clone(uint32_t orig) {
19246 LDKOutPoint orig_conv;
19247 orig_conv.inner = (void*)(orig & (~1));
19248 orig_conv.is_owned = false;
19249 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
19250 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
19251 uint64_t ret_ref = 0;
19252 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19253 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19254 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19255 ret_ref = (uint64_t)ret_var.inner;
19256 if (ret_var.is_owned) {
19262 jboolean __attribute__((visibility("default"))) TS_OutPoint_eq(uint32_t a, uint32_t b) {
19263 LDKOutPoint a_conv;
19264 a_conv.inner = (void*)(a & (~1));
19265 a_conv.is_owned = false;
19266 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19267 LDKOutPoint b_conv;
19268 b_conv.inner = (void*)(b & (~1));
19269 b_conv.is_owned = false;
19270 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19271 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
19275 int64_t __attribute__((visibility("default"))) TS_OutPoint_hash(uint32_t o) {
19276 LDKOutPoint o_conv;
19277 o_conv.inner = (void*)(o & (~1));
19278 o_conv.is_owned = false;
19279 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19280 int64_t ret_val = OutPoint_hash(&o_conv);
19284 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
19285 LDKOutPoint this_arg_conv;
19286 this_arg_conv.inner = (void*)(this_arg & (~1));
19287 this_arg_conv.is_owned = false;
19288 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19289 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19290 memcpy((uint8_t*)(ret_arr + 4), OutPoint_to_channel_id(&this_arg_conv).data, 32);
19294 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_write(uint32_t obj) {
19295 LDKOutPoint obj_conv;
19296 obj_conv.inner = (void*)(obj & (~1));
19297 obj_conv.is_owned = false;
19298 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
19299 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
19300 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19301 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19302 CVec_u8Z_free(ret_var);
19306 uint32_t __attribute__((visibility("default"))) TS_OutPoint_read(int8_tArray ser) {
19307 LDKu8slice ser_ref;
19308 ser_ref.datalen = *((uint32_t*)ser);
19309 ser_ref.data = (int8_t*)(ser + 4);
19310 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
19311 *ret_conv = OutPoint_read(ser_ref);
19312 return (uint64_t)ret_conv;
19315 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_obj) {
19316 LDKDelayedPaymentOutputDescriptor this_obj_conv;
19317 this_obj_conv.inner = (void*)(this_obj & (~1));
19318 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19319 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19320 DelayedPaymentOutputDescriptor_free(this_obj_conv);
19323 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
19324 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19326 this_ptr_conv.is_owned = false;
19327 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19328 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
19329 uint64_t ret_ref = 0;
19330 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19331 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19332 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19333 ret_ref = (uint64_t)ret_var.inner;
19334 if (ret_var.is_owned) {
19340 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
19341 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19343 this_ptr_conv.is_owned = false;
19344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19345 LDKOutPoint val_conv;
19346 val_conv.inner = (void*)(val & (~1));
19347 val_conv.is_owned = (val & 1) || (val == 0);
19348 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
19349 val_conv = OutPoint_clone(&val_conv);
19350 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
19353 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
19354 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19356 this_ptr_conv.is_owned = false;
19357 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19358 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19359 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
19363 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
19364 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19366 this_ptr_conv.is_owned = false;
19367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19368 LDKPublicKey val_ref;
19369 CHECK(*((uint32_t*)val) == 33);
19370 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19371 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
19374 int16_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
19375 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19377 this_ptr_conv.is_owned = false;
19378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19379 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
19383 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
19384 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19386 this_ptr_conv.is_owned = false;
19387 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19388 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
19391 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
19392 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19394 this_ptr_conv.is_owned = false;
19395 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19396 void* val_ptr = (void*)(((uint64_t)val) & ~1);
19397 CHECK_ACCESS(val_ptr);
19398 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
19399 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
19400 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
19403 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
19404 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19406 this_ptr_conv.is_owned = false;
19407 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19408 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19409 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
19413 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
19414 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19416 this_ptr_conv.is_owned = false;
19417 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19418 LDKPublicKey val_ref;
19419 CHECK(*((uint32_t*)val) == 33);
19420 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19421 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
19424 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
19425 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19427 this_ptr_conv.is_owned = false;
19428 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19429 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19430 memcpy((uint8_t*)(ret_arr + 4), *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
19434 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
19435 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19437 this_ptr_conv.is_owned = false;
19438 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19439 LDKThirtyTwoBytes val_ref;
19440 CHECK(*((uint32_t*)val) == 32);
19441 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19442 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
19445 int64_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
19446 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19448 this_ptr_conv.is_owned = false;
19449 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19450 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
19454 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
19455 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19457 this_ptr_conv.is_owned = false;
19458 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19459 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
19462 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) {
19463 LDKOutPoint outpoint_arg_conv;
19464 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
19465 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
19466 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
19467 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
19468 LDKPublicKey per_commitment_point_arg_ref;
19469 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
19470 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
19471 void* output_arg_ptr = (void*)(((uint64_t)output_arg) & ~1);
19472 CHECK_ACCESS(output_arg_ptr);
19473 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
19474 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
19475 LDKPublicKey revocation_pubkey_arg_ref;
19476 CHECK(*((uint32_t*)revocation_pubkey_arg) == 33);
19477 memcpy(revocation_pubkey_arg_ref.compressed_form, (uint8_t*)(revocation_pubkey_arg + 4), 33);
19478 LDKThirtyTwoBytes channel_keys_id_arg_ref;
19479 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
19480 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
19481 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);
19482 uint64_t ret_ref = 0;
19483 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19484 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19485 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19486 ret_ref = (uint64_t)ret_var.inner;
19487 if (ret_var.is_owned) {
19493 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
19494 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
19495 uint64_t ret_ref = 0;
19496 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19497 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19498 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19499 ret_ref = (uint64_t)ret_var.inner;
19500 if (ret_var.is_owned) {
19505 int64_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint32_t arg) {
19506 LDKDelayedPaymentOutputDescriptor arg_conv;
19507 arg_conv.inner = (void*)(arg & (~1));
19508 arg_conv.is_owned = false;
19509 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
19510 int64_t ret_val = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
19514 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
19515 LDKDelayedPaymentOutputDescriptor orig_conv;
19516 orig_conv.inner = (void*)(orig & (~1));
19517 orig_conv.is_owned = false;
19518 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
19519 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
19520 uint64_t ret_ref = 0;
19521 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19522 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19523 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19524 ret_ref = (uint64_t)ret_var.inner;
19525 if (ret_var.is_owned) {
19531 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_write(uint32_t obj) {
19532 LDKDelayedPaymentOutputDescriptor obj_conv;
19533 obj_conv.inner = (void*)(obj & (~1));
19534 obj_conv.is_owned = false;
19535 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
19536 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
19537 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19538 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19539 CVec_u8Z_free(ret_var);
19543 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
19544 LDKu8slice ser_ref;
19545 ser_ref.datalen = *((uint32_t*)ser);
19546 ser_ref.data = (int8_t*)(ser + 4);
19547 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19548 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
19549 return (uint64_t)ret_conv;
19552 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_obj) {
19553 LDKStaticPaymentOutputDescriptor this_obj_conv;
19554 this_obj_conv.inner = (void*)(this_obj & (~1));
19555 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19556 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19557 StaticPaymentOutputDescriptor_free(this_obj_conv);
19560 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
19561 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19563 this_ptr_conv.is_owned = false;
19564 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19565 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
19566 uint64_t ret_ref = 0;
19567 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19568 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19569 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19570 ret_ref = (uint64_t)ret_var.inner;
19571 if (ret_var.is_owned) {
19577 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
19578 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19580 this_ptr_conv.is_owned = false;
19581 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19582 LDKOutPoint val_conv;
19583 val_conv.inner = (void*)(val & (~1));
19584 val_conv.is_owned = (val & 1) || (val == 0);
19585 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
19586 val_conv = OutPoint_clone(&val_conv);
19587 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
19590 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
19591 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19593 this_ptr_conv.is_owned = false;
19594 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19595 void* val_ptr = (void*)(((uint64_t)val) & ~1);
19596 CHECK_ACCESS(val_ptr);
19597 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
19598 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
19599 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
19602 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
19603 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19605 this_ptr_conv.is_owned = false;
19606 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19607 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19608 memcpy((uint8_t*)(ret_arr + 4), *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
19612 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
19613 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19615 this_ptr_conv.is_owned = false;
19616 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19617 LDKThirtyTwoBytes val_ref;
19618 CHECK(*((uint32_t*)val) == 32);
19619 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19620 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
19623 int64_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
19624 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19626 this_ptr_conv.is_owned = false;
19627 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19628 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
19632 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
19633 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19635 this_ptr_conv.is_owned = false;
19636 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19637 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
19640 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) {
19641 LDKOutPoint outpoint_arg_conv;
19642 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
19643 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
19644 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
19645 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
19646 void* output_arg_ptr = (void*)(((uint64_t)output_arg) & ~1);
19647 CHECK_ACCESS(output_arg_ptr);
19648 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
19649 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
19650 LDKThirtyTwoBytes channel_keys_id_arg_ref;
19651 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
19652 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
19653 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
19654 uint64_t ret_ref = 0;
19655 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19656 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19657 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19658 ret_ref = (uint64_t)ret_var.inner;
19659 if (ret_var.is_owned) {
19665 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
19666 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
19667 uint64_t ret_ref = 0;
19668 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19669 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19670 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19671 ret_ref = (uint64_t)ret_var.inner;
19672 if (ret_var.is_owned) {
19677 int64_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint32_t arg) {
19678 LDKStaticPaymentOutputDescriptor arg_conv;
19679 arg_conv.inner = (void*)(arg & (~1));
19680 arg_conv.is_owned = false;
19681 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
19682 int64_t ret_val = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
19686 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
19687 LDKStaticPaymentOutputDescriptor orig_conv;
19688 orig_conv.inner = (void*)(orig & (~1));
19689 orig_conv.is_owned = false;
19690 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
19691 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
19692 uint64_t ret_ref = 0;
19693 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19694 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19695 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19696 ret_ref = (uint64_t)ret_var.inner;
19697 if (ret_var.is_owned) {
19703 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_write(uint32_t obj) {
19704 LDKStaticPaymentOutputDescriptor obj_conv;
19705 obj_conv.inner = (void*)(obj & (~1));
19706 obj_conv.is_owned = false;
19707 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
19708 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
19709 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19710 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19711 CVec_u8Z_free(ret_var);
19715 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
19716 LDKu8slice ser_ref;
19717 ser_ref.datalen = *((uint32_t*)ser);
19718 ser_ref.data = (int8_t*)(ser + 4);
19719 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19720 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
19721 return (uint64_t)ret_conv;
19724 void __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
19725 if ((this_ptr & 1) != 0) return;
19726 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
19727 CHECK_ACCESS(this_ptr_ptr);
19728 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
19729 FREE((void*)this_ptr);
19730 SpendableOutputDescriptor_free(this_ptr_conv);
19733 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
19734 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
19735 *ret_copy = SpendableOutputDescriptor_clone(arg);
19736 uint64_t ret_ref = (uint64_t)ret_copy;
19739 int64_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_clone_ptr(uint32_t arg) {
19740 LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)arg;
19741 int64_t ret_val = SpendableOutputDescriptor_clone_ptr(arg_conv);
19745 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
19746 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
19747 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
19748 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
19749 uint64_t ret_ref = (uint64_t)ret_copy;
19753 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_output(uint32_t outpoint, uint32_t output) {
19754 LDKOutPoint outpoint_conv;
19755 outpoint_conv.inner = (void*)(outpoint & (~1));
19756 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
19757 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
19758 outpoint_conv = OutPoint_clone(&outpoint_conv);
19759 void* output_ptr = (void*)(((uint64_t)output) & ~1);
19760 CHECK_ACCESS(output_ptr);
19761 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
19762 output_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output) & ~1));
19763 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
19764 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
19765 uint64_t ret_ref = (uint64_t)ret_copy;
19769 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint32_t a) {
19770 LDKDelayedPaymentOutputDescriptor a_conv;
19771 a_conv.inner = (void*)(a & (~1));
19772 a_conv.is_owned = (a & 1) || (a == 0);
19773 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19774 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
19775 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
19776 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
19777 uint64_t ret_ref = (uint64_t)ret_copy;
19781 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_payment_output(uint32_t a) {
19782 LDKStaticPaymentOutputDescriptor a_conv;
19783 a_conv.inner = (void*)(a & (~1));
19784 a_conv.is_owned = (a & 1) || (a == 0);
19785 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19786 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
19787 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
19788 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
19789 uint64_t ret_ref = (uint64_t)ret_copy;
19793 int8_tArray __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
19794 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
19795 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
19796 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19797 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19798 CVec_u8Z_free(ret_var);
19802 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
19803 LDKu8slice ser_ref;
19804 ser_ref.datalen = *((uint32_t*)ser);
19805 ser_ref.data = (int8_t*)(ser + 4);
19806 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19807 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
19808 return (uint64_t)ret_conv;
19811 void __attribute__((visibility("default"))) TS_BaseSign_free(uint32_t this_ptr) {
19812 if ((this_ptr & 1) != 0) return;
19813 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
19814 CHECK_ACCESS(this_ptr_ptr);
19815 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
19816 FREE((void*)this_ptr);
19817 BaseSign_free(this_ptr_conv);
19820 static inline uint64_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
19821 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
19822 *ret_ret = Sign_clone(arg);
19823 return (uint64_t)ret_ret;
19825 int64_t __attribute__((visibility("default"))) TS_Sign_clone_ptr(uint32_t arg) {
19826 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
19827 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
19828 LDKSign* arg_conv = (LDKSign*)arg_ptr;
19829 int64_t ret_val = Sign_clone_ptr(arg_conv);
19833 uint32_t __attribute__((visibility("default"))) TS_Sign_clone(uint32_t orig) {
19834 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
19835 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
19836 LDKSign* orig_conv = (LDKSign*)orig_ptr;
19837 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
19838 *ret_ret = Sign_clone(orig_conv);
19839 return (uint64_t)ret_ret;
19842 void __attribute__((visibility("default"))) TS_Sign_free(uint32_t this_ptr) {
19843 if ((this_ptr & 1) != 0) return;
19844 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
19845 CHECK_ACCESS(this_ptr_ptr);
19846 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
19847 FREE((void*)this_ptr);
19848 Sign_free(this_ptr_conv);
19851 void __attribute__((visibility("default"))) TS_KeysInterface_free(uint32_t this_ptr) {
19852 if ((this_ptr & 1) != 0) return;
19853 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
19854 CHECK_ACCESS(this_ptr_ptr);
19855 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
19856 FREE((void*)this_ptr);
19857 KeysInterface_free(this_ptr_conv);
19860 void __attribute__((visibility("default"))) TS_InMemorySigner_free(uint32_t this_obj) {
19861 LDKInMemorySigner this_obj_conv;
19862 this_obj_conv.inner = (void*)(this_obj & (~1));
19863 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19865 InMemorySigner_free(this_obj_conv);
19868 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
19869 LDKInMemorySigner this_ptr_conv;
19870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19871 this_ptr_conv.is_owned = false;
19872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19873 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19874 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
19878 void __attribute__((visibility("default"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
19879 LDKInMemorySigner 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 LDKSecretKey val_ref;
19884 CHECK(*((uint32_t*)val) == 32);
19885 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
19886 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
19889 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
19890 LDKInMemorySigner this_ptr_conv;
19891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19892 this_ptr_conv.is_owned = false;
19893 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19894 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19895 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
19899 void __attribute__((visibility("default"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
19900 LDKInMemorySigner this_ptr_conv;
19901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19902 this_ptr_conv.is_owned = false;
19903 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19904 LDKSecretKey val_ref;
19905 CHECK(*((uint32_t*)val) == 32);
19906 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
19907 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
19910 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
19911 LDKInMemorySigner this_ptr_conv;
19912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19913 this_ptr_conv.is_owned = false;
19914 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19915 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19916 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
19920 void __attribute__((visibility("default"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
19921 LDKInMemorySigner this_ptr_conv;
19922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19923 this_ptr_conv.is_owned = false;
19924 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19925 LDKSecretKey val_ref;
19926 CHECK(*((uint32_t*)val) == 32);
19927 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
19928 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
19931 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
19932 LDKInMemorySigner this_ptr_conv;
19933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19934 this_ptr_conv.is_owned = false;
19935 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19936 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19937 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
19941 void __attribute__((visibility("default"))) TS_InMemorySigner_set_delayed_payment_base_key(uint32_t this_ptr, int8_tArray val) {
19942 LDKInMemorySigner this_ptr_conv;
19943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19944 this_ptr_conv.is_owned = false;
19945 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19946 LDKSecretKey val_ref;
19947 CHECK(*((uint32_t*)val) == 32);
19948 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
19949 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
19952 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
19953 LDKInMemorySigner this_ptr_conv;
19954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19955 this_ptr_conv.is_owned = false;
19956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19957 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19958 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
19962 void __attribute__((visibility("default"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
19963 LDKInMemorySigner this_ptr_conv;
19964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19965 this_ptr_conv.is_owned = false;
19966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19967 LDKSecretKey val_ref;
19968 CHECK(*((uint32_t*)val) == 32);
19969 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
19970 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
19973 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
19974 LDKInMemorySigner this_ptr_conv;
19975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19976 this_ptr_conv.is_owned = false;
19977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19978 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19979 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
19983 void __attribute__((visibility("default"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
19984 LDKInMemorySigner this_ptr_conv;
19985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19986 this_ptr_conv.is_owned = false;
19987 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19988 LDKThirtyTwoBytes val_ref;
19989 CHECK(*((uint32_t*)val) == 32);
19990 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19991 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
19994 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
19995 LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
19996 uint64_t ret_ref = 0;
19997 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19998 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19999 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20000 ret_ref = (uint64_t)ret_var.inner;
20001 if (ret_var.is_owned) {
20006 int64_t __attribute__((visibility("default"))) TS_InMemorySigner_clone_ptr(uint32_t arg) {
20007 LDKInMemorySigner arg_conv;
20008 arg_conv.inner = (void*)(arg & (~1));
20009 arg_conv.is_owned = false;
20010 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20011 int64_t ret_val = InMemorySigner_clone_ptr(&arg_conv);
20015 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_clone(uint32_t orig) {
20016 LDKInMemorySigner orig_conv;
20017 orig_conv.inner = (void*)(orig & (~1));
20018 orig_conv.is_owned = false;
20019 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20020 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
20021 uint64_t ret_ref = 0;
20022 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20023 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20024 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20025 ret_ref = (uint64_t)ret_var.inner;
20026 if (ret_var.is_owned) {
20032 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) {
20033 LDKSecretKey funding_key_ref;
20034 CHECK(*((uint32_t*)funding_key) == 32);
20035 memcpy(funding_key_ref.bytes, (uint8_t*)(funding_key + 4), 32);
20036 LDKSecretKey revocation_base_key_ref;
20037 CHECK(*((uint32_t*)revocation_base_key) == 32);
20038 memcpy(revocation_base_key_ref.bytes, (uint8_t*)(revocation_base_key + 4), 32);
20039 LDKSecretKey payment_key_ref;
20040 CHECK(*((uint32_t*)payment_key) == 32);
20041 memcpy(payment_key_ref.bytes, (uint8_t*)(payment_key + 4), 32);
20042 LDKSecretKey delayed_payment_base_key_ref;
20043 CHECK(*((uint32_t*)delayed_payment_base_key) == 32);
20044 memcpy(delayed_payment_base_key_ref.bytes, (uint8_t*)(delayed_payment_base_key + 4), 32);
20045 LDKSecretKey htlc_base_key_ref;
20046 CHECK(*((uint32_t*)htlc_base_key) == 32);
20047 memcpy(htlc_base_key_ref.bytes, (uint8_t*)(htlc_base_key + 4), 32);
20048 LDKThirtyTwoBytes commitment_seed_ref;
20049 CHECK(*((uint32_t*)commitment_seed) == 32);
20050 memcpy(commitment_seed_ref.data, (uint8_t*)(commitment_seed + 4), 32);
20051 LDKThirtyTwoBytes channel_keys_id_ref;
20052 CHECK(*((uint32_t*)channel_keys_id) == 32);
20053 memcpy(channel_keys_id_ref.data, (uint8_t*)(channel_keys_id + 4), 32);
20054 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);
20055 uint64_t ret_ref = 0;
20056 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20057 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20058 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20059 ret_ref = (uint64_t)ret_var.inner;
20060 if (ret_var.is_owned) {
20066 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
20067 LDKInMemorySigner this_arg_conv;
20068 this_arg_conv.inner = (void*)(this_arg & (~1));
20069 this_arg_conv.is_owned = false;
20070 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20071 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
20072 uint64_t ret_ref = 0;
20073 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20074 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20075 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20076 ret_ref = (uint64_t)ret_var.inner;
20077 if (ret_var.is_owned) {
20083 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
20084 LDKInMemorySigner this_arg_conv;
20085 this_arg_conv.inner = (void*)(this_arg & (~1));
20086 this_arg_conv.is_owned = false;
20087 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20088 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
20092 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
20093 LDKInMemorySigner this_arg_conv;
20094 this_arg_conv.inner = (void*)(this_arg & (~1));
20095 this_arg_conv.is_owned = false;
20096 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20097 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
20101 jboolean __attribute__((visibility("default"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
20102 LDKInMemorySigner this_arg_conv;
20103 this_arg_conv.inner = (void*)(this_arg & (~1));
20104 this_arg_conv.is_owned = false;
20105 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20106 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
20110 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
20111 LDKInMemorySigner this_arg_conv;
20112 this_arg_conv.inner = (void*)(this_arg & (~1));
20113 this_arg_conv.is_owned = false;
20114 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20115 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
20116 uint64_t ret_ref = 0;
20117 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20118 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20119 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20120 ret_ref = (uint64_t)ret_var.inner;
20121 if (ret_var.is_owned) {
20127 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
20128 LDKInMemorySigner this_arg_conv;
20129 this_arg_conv.inner = (void*)(this_arg & (~1));
20130 this_arg_conv.is_owned = false;
20131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20132 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
20133 uint64_t ret_ref = 0;
20134 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20135 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20136 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20137 ret_ref = (uint64_t)ret_var.inner;
20138 if (ret_var.is_owned) {
20144 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) {
20145 LDKInMemorySigner this_arg_conv;
20146 this_arg_conv.inner = (void*)(this_arg & (~1));
20147 this_arg_conv.is_owned = false;
20148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20149 LDKTransaction spend_tx_ref;
20150 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
20151 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
20152 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
20153 spend_tx_ref.data_is_owned = true;
20154 LDKStaticPaymentOutputDescriptor descriptor_conv;
20155 descriptor_conv.inner = (void*)(descriptor & (~1));
20156 descriptor_conv.is_owned = false;
20157 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
20158 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20159 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
20160 return (uint64_t)ret_conv;
20163 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) {
20164 LDKInMemorySigner this_arg_conv;
20165 this_arg_conv.inner = (void*)(this_arg & (~1));
20166 this_arg_conv.is_owned = false;
20167 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20168 LDKTransaction spend_tx_ref;
20169 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
20170 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
20171 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
20172 spend_tx_ref.data_is_owned = true;
20173 LDKDelayedPaymentOutputDescriptor descriptor_conv;
20174 descriptor_conv.inner = (void*)(descriptor & (~1));
20175 descriptor_conv.is_owned = false;
20176 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
20177 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20178 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
20179 return (uint64_t)ret_conv;
20182 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_BaseSign(uint32_t this_arg) {
20183 LDKInMemorySigner this_arg_conv;
20184 this_arg_conv.inner = (void*)(this_arg & (~1));
20185 this_arg_conv.is_owned = false;
20186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20187 LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
20188 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
20189 return (uint64_t)ret_ret;
20192 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
20193 LDKInMemorySigner this_arg_conv;
20194 this_arg_conv.inner = (void*)(this_arg & (~1));
20195 this_arg_conv.is_owned = false;
20196 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20197 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
20198 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
20199 return (uint64_t)ret_ret;
20202 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_write(uint32_t obj) {
20203 LDKInMemorySigner obj_conv;
20204 obj_conv.inner = (void*)(obj & (~1));
20205 obj_conv.is_owned = false;
20206 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
20207 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
20208 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20209 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20210 CVec_u8Z_free(ret_var);
20214 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_read(int8_tArray ser) {
20215 LDKu8slice ser_ref;
20216 ser_ref.datalen = *((uint32_t*)ser);
20217 ser_ref.data = (int8_t*)(ser + 4);
20218 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20219 *ret_conv = InMemorySigner_read(ser_ref);
20220 return (uint64_t)ret_conv;
20223 void __attribute__((visibility("default"))) TS_KeysManager_free(uint32_t this_obj) {
20224 LDKKeysManager this_obj_conv;
20225 this_obj_conv.inner = (void*)(this_obj & (~1));
20226 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20228 KeysManager_free(this_obj_conv);
20231 uint32_t __attribute__((visibility("default"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
20232 unsigned char seed_arr[32];
20233 CHECK(*((uint32_t*)seed) == 32);
20234 memcpy(seed_arr, (uint8_t*)(seed + 4), 32);
20235 unsigned char (*seed_ref)[32] = &seed_arr;
20236 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
20237 uint64_t ret_ref = 0;
20238 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20239 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20240 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20241 ret_ref = (uint64_t)ret_var.inner;
20242 if (ret_var.is_owned) {
20248 uint32_t __attribute__((visibility("default"))) TS_KeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
20249 LDKKeysManager this_arg_conv;
20250 this_arg_conv.inner = (void*)(this_arg & (~1));
20251 this_arg_conv.is_owned = false;
20252 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20253 unsigned char params_arr[32];
20254 CHECK(*((uint32_t*)params) == 32);
20255 memcpy(params_arr, (uint8_t*)(params + 4), 32);
20256 unsigned char (*params_ref)[32] = ¶ms_arr;
20257 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
20258 uint64_t ret_ref = 0;
20259 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20260 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20261 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20262 ret_ref = (uint64_t)ret_var.inner;
20263 if (ret_var.is_owned) {
20269 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) {
20270 LDKKeysManager this_arg_conv;
20271 this_arg_conv.inner = (void*)(this_arg & (~1));
20272 this_arg_conv.is_owned = false;
20273 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20274 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
20275 descriptors_constr.datalen = *((uint32_t*)descriptors);
20276 if (descriptors_constr.datalen > 0)
20277 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
20279 descriptors_constr.data = NULL;
20280 uint32_t* descriptors_vals = (uint32_t*)(descriptors + 4);
20281 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
20282 uint32_t descriptors_conv_27 = descriptors_vals[b];
20283 void* descriptors_conv_27_ptr = (void*)(((uint64_t)descriptors_conv_27) & ~1);
20284 CHECK_ACCESS(descriptors_conv_27_ptr);
20285 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
20286 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
20287 descriptors_constr.data[b] = descriptors_conv_27_conv;
20289 LDKCVec_TxOutZ outputs_constr;
20290 outputs_constr.datalen = *((uint32_t*)outputs);
20291 if (outputs_constr.datalen > 0)
20292 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
20294 outputs_constr.data = NULL;
20295 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
20296 for (size_t h = 0; h < outputs_constr.datalen; h++) {
20297 uint32_t outputs_conv_7 = outputs_vals[h];
20298 void* outputs_conv_7_ptr = (void*)(((uint64_t)outputs_conv_7) & ~1);
20299 CHECK_ACCESS(outputs_conv_7_ptr);
20300 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
20301 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
20302 outputs_constr.data[h] = outputs_conv_7_conv;
20304 LDKCVec_u8Z change_destination_script_ref;
20305 change_destination_script_ref.datalen = *((uint32_t*)change_destination_script);
20306 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
20307 memcpy(change_destination_script_ref.data, (uint8_t*)(change_destination_script + 4), change_destination_script_ref.datalen);
20308 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20309 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
20310 return (uint64_t)ret_conv;
20313 uint32_t __attribute__((visibility("default"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
20314 LDKKeysManager this_arg_conv;
20315 this_arg_conv.inner = (void*)(this_arg & (~1));
20316 this_arg_conv.is_owned = false;
20317 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20318 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
20319 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
20320 return (uint64_t)ret_ret;
20323 void __attribute__((visibility("default"))) TS_ChannelManager_free(uint32_t this_obj) {
20324 LDKChannelManager this_obj_conv;
20325 this_obj_conv.inner = (void*)(this_obj & (~1));
20326 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20327 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20328 ChannelManager_free(this_obj_conv);
20331 void __attribute__((visibility("default"))) TS_ChainParameters_free(uint32_t this_obj) {
20332 LDKChainParameters this_obj_conv;
20333 this_obj_conv.inner = (void*)(this_obj & (~1));
20334 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20335 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20336 ChainParameters_free(this_obj_conv);
20339 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
20340 LDKChainParameters this_ptr_conv;
20341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20342 this_ptr_conv.is_owned = false;
20343 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20344 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
20348 void __attribute__((visibility("default"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
20349 LDKChainParameters this_ptr_conv;
20350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20351 this_ptr_conv.is_owned = false;
20352 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20353 LDKNetwork val_conv = LDKNetwork_from_js(val);
20354 ChainParameters_set_network(&this_ptr_conv, val_conv);
20357 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_best_block(uint32_t this_ptr) {
20358 LDKChainParameters this_ptr_conv;
20359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20360 this_ptr_conv.is_owned = false;
20361 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20362 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
20363 uint64_t ret_ref = 0;
20364 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20365 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20366 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20367 ret_ref = (uint64_t)ret_var.inner;
20368 if (ret_var.is_owned) {
20374 void __attribute__((visibility("default"))) TS_ChainParameters_set_best_block(uint32_t this_ptr, uint32_t val) {
20375 LDKChainParameters this_ptr_conv;
20376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20377 this_ptr_conv.is_owned = false;
20378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20379 LDKBestBlock val_conv;
20380 val_conv.inner = (void*)(val & (~1));
20381 val_conv.is_owned = (val & 1) || (val == 0);
20382 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20383 val_conv = BestBlock_clone(&val_conv);
20384 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
20387 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_new(uint32_t network_arg, uint32_t best_block_arg) {
20388 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
20389 LDKBestBlock best_block_arg_conv;
20390 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
20391 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
20392 CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
20393 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
20394 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
20395 uint64_t ret_ref = 0;
20396 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20397 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20398 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20399 ret_ref = (uint64_t)ret_var.inner;
20400 if (ret_var.is_owned) {
20406 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
20407 LDKChainParameters ret_var = ChainParameters_clone(arg);
20408 uint64_t ret_ref = 0;
20409 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20410 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20411 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20412 ret_ref = (uint64_t)ret_var.inner;
20413 if (ret_var.is_owned) {
20418 int64_t __attribute__((visibility("default"))) TS_ChainParameters_clone_ptr(uint32_t arg) {
20419 LDKChainParameters arg_conv;
20420 arg_conv.inner = (void*)(arg & (~1));
20421 arg_conv.is_owned = false;
20422 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20423 int64_t ret_val = ChainParameters_clone_ptr(&arg_conv);
20427 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_clone(uint32_t orig) {
20428 LDKChainParameters orig_conv;
20429 orig_conv.inner = (void*)(orig & (~1));
20430 orig_conv.is_owned = false;
20431 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20432 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
20433 uint64_t ret_ref = 0;
20434 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20435 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20436 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20437 ret_ref = (uint64_t)ret_var.inner;
20438 if (ret_var.is_owned) {
20444 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_free(uint32_t this_obj) {
20445 LDKCounterpartyForwardingInfo this_obj_conv;
20446 this_obj_conv.inner = (void*)(this_obj & (~1));
20447 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20449 CounterpartyForwardingInfo_free(this_obj_conv);
20452 int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint32_t this_ptr) {
20453 LDKCounterpartyForwardingInfo this_ptr_conv;
20454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20455 this_ptr_conv.is_owned = false;
20456 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20457 int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
20461 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
20462 LDKCounterpartyForwardingInfo this_ptr_conv;
20463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20464 this_ptr_conv.is_owned = false;
20465 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20466 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
20469 int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint32_t this_ptr) {
20470 LDKCounterpartyForwardingInfo this_ptr_conv;
20471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20472 this_ptr_conv.is_owned = false;
20473 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20474 int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
20478 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
20479 LDKCounterpartyForwardingInfo 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 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
20486 int16_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
20487 LDKCounterpartyForwardingInfo this_ptr_conv;
20488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20489 this_ptr_conv.is_owned = false;
20490 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20491 int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
20495 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
20496 LDKCounterpartyForwardingInfo this_ptr_conv;
20497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20498 this_ptr_conv.is_owned = false;
20499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20500 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
20503 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) {
20504 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
20505 uint64_t ret_ref = 0;
20506 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20507 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20508 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20509 ret_ref = (uint64_t)ret_var.inner;
20510 if (ret_var.is_owned) {
20516 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
20517 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
20518 uint64_t ret_ref = 0;
20519 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20520 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20521 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20522 ret_ref = (uint64_t)ret_var.inner;
20523 if (ret_var.is_owned) {
20528 int64_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_clone_ptr(uint32_t arg) {
20529 LDKCounterpartyForwardingInfo arg_conv;
20530 arg_conv.inner = (void*)(arg & (~1));
20531 arg_conv.is_owned = false;
20532 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20533 int64_t ret_val = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
20537 uint32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_clone(uint32_t orig) {
20538 LDKCounterpartyForwardingInfo orig_conv;
20539 orig_conv.inner = (void*)(orig & (~1));
20540 orig_conv.is_owned = false;
20541 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20542 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
20543 uint64_t ret_ref = 0;
20544 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20545 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20546 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20547 ret_ref = (uint64_t)ret_var.inner;
20548 if (ret_var.is_owned) {
20554 void __attribute__((visibility("default"))) TS_ChannelCounterparty_free(uint32_t this_obj) {
20555 LDKChannelCounterparty this_obj_conv;
20556 this_obj_conv.inner = (void*)(this_obj & (~1));
20557 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20559 ChannelCounterparty_free(this_obj_conv);
20562 int8_tArray __attribute__((visibility("default"))) TS_ChannelCounterparty_get_node_id(uint32_t this_ptr) {
20563 LDKChannelCounterparty this_ptr_conv;
20564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20565 this_ptr_conv.is_owned = false;
20566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20567 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
20568 memcpy((uint8_t*)(ret_arr + 4), ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
20572 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_node_id(uint32_t this_ptr, int8_tArray val) {
20573 LDKChannelCounterparty this_ptr_conv;
20574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20575 this_ptr_conv.is_owned = false;
20576 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20577 LDKPublicKey val_ref;
20578 CHECK(*((uint32_t*)val) == 33);
20579 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
20580 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
20583 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_features(uint32_t this_ptr) {
20584 LDKChannelCounterparty this_ptr_conv;
20585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20586 this_ptr_conv.is_owned = false;
20587 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20588 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
20589 uint64_t ret_ref = 0;
20590 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20591 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20592 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20593 ret_ref = (uint64_t)ret_var.inner;
20594 if (ret_var.is_owned) {
20600 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_features(uint32_t this_ptr, uint32_t val) {
20601 LDKChannelCounterparty this_ptr_conv;
20602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20603 this_ptr_conv.is_owned = false;
20604 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20605 LDKInitFeatures val_conv;
20606 val_conv.inner = (void*)(val & (~1));
20607 val_conv.is_owned = (val & 1) || (val == 0);
20608 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20609 val_conv = InitFeatures_clone(&val_conv);
20610 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
20613 int64_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint32_t this_ptr) {
20614 LDKChannelCounterparty this_ptr_conv;
20615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20616 this_ptr_conv.is_owned = false;
20617 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20618 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
20622 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint32_t this_ptr, int64_t val) {
20623 LDKChannelCounterparty this_ptr_conv;
20624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20625 this_ptr_conv.is_owned = false;
20626 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20627 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
20630 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_forwarding_info(uint32_t this_ptr) {
20631 LDKChannelCounterparty this_ptr_conv;
20632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20633 this_ptr_conv.is_owned = false;
20634 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20635 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
20636 uint64_t ret_ref = 0;
20637 if ((uint64_t)ret_var.inner > 4096) {
20638 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20639 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20640 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20641 ret_ref = (uint64_t)ret_var.inner;
20642 if (ret_var.is_owned) {
20649 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_forwarding_info(uint32_t this_ptr, uint32_t val) {
20650 LDKChannelCounterparty this_ptr_conv;
20651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20652 this_ptr_conv.is_owned = false;
20653 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20654 LDKCounterpartyForwardingInfo val_conv;
20655 val_conv.inner = (void*)(val & (~1));
20656 val_conv.is_owned = (val & 1) || (val == 0);
20657 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20658 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
20659 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
20662 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) {
20663 LDKPublicKey node_id_arg_ref;
20664 CHECK(*((uint32_t*)node_id_arg) == 33);
20665 memcpy(node_id_arg_ref.compressed_form, (uint8_t*)(node_id_arg + 4), 33);
20666 LDKInitFeatures features_arg_conv;
20667 features_arg_conv.inner = (void*)(features_arg & (~1));
20668 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
20669 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
20670 features_arg_conv = InitFeatures_clone(&features_arg_conv);
20671 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
20672 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
20673 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
20674 CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
20675 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
20676 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
20677 uint64_t ret_ref = 0;
20678 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20679 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20680 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20681 ret_ref = (uint64_t)ret_var.inner;
20682 if (ret_var.is_owned) {
20688 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
20689 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
20690 uint64_t ret_ref = 0;
20691 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20692 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20693 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20694 ret_ref = (uint64_t)ret_var.inner;
20695 if (ret_var.is_owned) {
20700 int64_t __attribute__((visibility("default"))) TS_ChannelCounterparty_clone_ptr(uint32_t arg) {
20701 LDKChannelCounterparty arg_conv;
20702 arg_conv.inner = (void*)(arg & (~1));
20703 arg_conv.is_owned = false;
20704 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20705 int64_t ret_val = ChannelCounterparty_clone_ptr(&arg_conv);
20709 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_clone(uint32_t orig) {
20710 LDKChannelCounterparty orig_conv;
20711 orig_conv.inner = (void*)(orig & (~1));
20712 orig_conv.is_owned = false;
20713 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20714 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
20715 uint64_t ret_ref = 0;
20716 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20717 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20718 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20719 ret_ref = (uint64_t)ret_var.inner;
20720 if (ret_var.is_owned) {
20726 void __attribute__((visibility("default"))) TS_ChannelDetails_free(uint32_t this_obj) {
20727 LDKChannelDetails this_obj_conv;
20728 this_obj_conv.inner = (void*)(this_obj & (~1));
20729 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20730 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20731 ChannelDetails_free(this_obj_conv);
20734 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
20735 LDKChannelDetails this_ptr_conv;
20736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20737 this_ptr_conv.is_owned = false;
20738 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20739 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20740 memcpy((uint8_t*)(ret_arr + 4), *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
20744 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
20745 LDKChannelDetails this_ptr_conv;
20746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20747 this_ptr_conv.is_owned = false;
20748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20749 LDKThirtyTwoBytes val_ref;
20750 CHECK(*((uint32_t*)val) == 32);
20751 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20752 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
20755 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_counterparty(uint32_t this_ptr) {
20756 LDKChannelDetails this_ptr_conv;
20757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20758 this_ptr_conv.is_owned = false;
20759 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20760 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
20761 uint64_t ret_ref = 0;
20762 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20763 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20764 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20765 ret_ref = (uint64_t)ret_var.inner;
20766 if (ret_var.is_owned) {
20772 void __attribute__((visibility("default"))) TS_ChannelDetails_set_counterparty(uint32_t this_ptr, uint32_t val) {
20773 LDKChannelDetails this_ptr_conv;
20774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20775 this_ptr_conv.is_owned = false;
20776 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20777 LDKChannelCounterparty val_conv;
20778 val_conv.inner = (void*)(val & (~1));
20779 val_conv.is_owned = (val & 1) || (val == 0);
20780 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20781 val_conv = ChannelCounterparty_clone(&val_conv);
20782 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
20785 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_funding_txo(uint32_t this_ptr) {
20786 LDKChannelDetails this_ptr_conv;
20787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20788 this_ptr_conv.is_owned = false;
20789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20790 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
20791 uint64_t ret_ref = 0;
20792 if ((uint64_t)ret_var.inner > 4096) {
20793 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20794 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20795 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20796 ret_ref = (uint64_t)ret_var.inner;
20797 if (ret_var.is_owned) {
20804 void __attribute__((visibility("default"))) TS_ChannelDetails_set_funding_txo(uint32_t this_ptr, uint32_t val) {
20805 LDKChannelDetails this_ptr_conv;
20806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20807 this_ptr_conv.is_owned = false;
20808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20809 LDKOutPoint val_conv;
20810 val_conv.inner = (void*)(val & (~1));
20811 val_conv.is_owned = (val & 1) || (val == 0);
20812 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20813 val_conv = OutPoint_clone(&val_conv);
20814 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
20817 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_short_channel_id(uint32_t this_ptr) {
20818 LDKChannelDetails this_ptr_conv;
20819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20820 this_ptr_conv.is_owned = false;
20821 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20822 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
20823 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
20824 uint64_t ret_ref = (uint64_t)ret_copy;
20828 void __attribute__((visibility("default"))) TS_ChannelDetails_set_short_channel_id(uint32_t this_ptr, uint32_t val) {
20829 LDKChannelDetails this_ptr_conv;
20830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20831 this_ptr_conv.is_owned = false;
20832 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20833 void* val_ptr = (void*)(((uint64_t)val) & ~1);
20834 CHECK_ACCESS(val_ptr);
20835 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
20836 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
20837 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
20840 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
20841 LDKChannelDetails this_ptr_conv;
20842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20843 this_ptr_conv.is_owned = false;
20844 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20845 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
20849 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
20850 LDKChannelDetails this_ptr_conv;
20851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20852 this_ptr_conv.is_owned = false;
20853 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20854 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
20857 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint32_t this_ptr) {
20858 LDKChannelDetails this_ptr_conv;
20859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20860 this_ptr_conv.is_owned = false;
20861 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20862 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
20863 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
20864 uint64_t ret_ref = (uint64_t)ret_copy;
20868 void __attribute__((visibility("default"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint32_t this_ptr, uint32_t val) {
20869 LDKChannelDetails this_ptr_conv;
20870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20871 this_ptr_conv.is_owned = false;
20872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20873 void* val_ptr = (void*)(((uint64_t)val) & ~1);
20874 CHECK_ACCESS(val_ptr);
20875 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
20876 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
20877 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
20880 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_user_channel_id(uint32_t this_ptr) {
20881 LDKChannelDetails this_ptr_conv;
20882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20883 this_ptr_conv.is_owned = false;
20884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20885 int64_t ret_val = ChannelDetails_get_user_channel_id(&this_ptr_conv);
20889 void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_channel_id(uint32_t this_ptr, int64_t val) {
20890 LDKChannelDetails this_ptr_conv;
20891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20892 this_ptr_conv.is_owned = false;
20893 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20894 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
20897 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
20898 LDKChannelDetails this_ptr_conv;
20899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20900 this_ptr_conv.is_owned = false;
20901 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20902 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
20906 void __attribute__((visibility("default"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
20907 LDKChannelDetails this_ptr_conv;
20908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20909 this_ptr_conv.is_owned = false;
20910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20911 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
20914 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
20915 LDKChannelDetails this_ptr_conv;
20916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20917 this_ptr_conv.is_owned = false;
20918 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20919 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
20923 void __attribute__((visibility("default"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
20924 LDKChannelDetails this_ptr_conv;
20925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20926 this_ptr_conv.is_owned = false;
20927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20928 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
20931 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_confirmations_required(uint32_t this_ptr) {
20932 LDKChannelDetails this_ptr_conv;
20933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20934 this_ptr_conv.is_owned = false;
20935 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20936 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
20937 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
20938 uint64_t ret_ref = (uint64_t)ret_copy;
20942 void __attribute__((visibility("default"))) TS_ChannelDetails_set_confirmations_required(uint32_t this_ptr, uint32_t val) {
20943 LDKChannelDetails this_ptr_conv;
20944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20945 this_ptr_conv.is_owned = false;
20946 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20947 void* val_ptr = (void*)(((uint64_t)val) & ~1);
20948 CHECK_ACCESS(val_ptr);
20949 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
20950 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
20951 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
20954 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_force_close_spend_delay(uint32_t this_ptr) {
20955 LDKChannelDetails this_ptr_conv;
20956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20957 this_ptr_conv.is_owned = false;
20958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20959 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20960 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
20961 uint64_t ret_ref = (uint64_t)ret_copy;
20965 void __attribute__((visibility("default"))) TS_ChannelDetails_set_force_close_spend_delay(uint32_t this_ptr, uint32_t val) {
20966 LDKChannelDetails 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 void* val_ptr = (void*)(((uint64_t)val) & ~1);
20971 CHECK_ACCESS(val_ptr);
20972 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
20973 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)val) & ~1));
20974 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
20977 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_outbound(uint32_t this_ptr) {
20978 LDKChannelDetails this_ptr_conv;
20979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20980 this_ptr_conv.is_owned = false;
20981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20982 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
20986 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_outbound(uint32_t this_ptr, jboolean val) {
20987 LDKChannelDetails this_ptr_conv;
20988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20989 this_ptr_conv.is_owned = false;
20990 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20991 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
20994 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_funding_locked(uint32_t this_ptr) {
20995 LDKChannelDetails this_ptr_conv;
20996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20997 this_ptr_conv.is_owned = false;
20998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20999 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
21003 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_funding_locked(uint32_t this_ptr, jboolean val) {
21004 LDKChannelDetails this_ptr_conv;
21005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21006 this_ptr_conv.is_owned = false;
21007 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21008 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
21011 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_usable(uint32_t this_ptr) {
21012 LDKChannelDetails this_ptr_conv;
21013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21014 this_ptr_conv.is_owned = false;
21015 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21016 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
21020 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_usable(uint32_t this_ptr, jboolean val) {
21021 LDKChannelDetails this_ptr_conv;
21022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21023 this_ptr_conv.is_owned = false;
21024 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21025 ChannelDetails_set_is_usable(&this_ptr_conv, val);
21028 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_public(uint32_t this_ptr) {
21029 LDKChannelDetails this_ptr_conv;
21030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21031 this_ptr_conv.is_owned = false;
21032 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21033 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
21037 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_public(uint32_t this_ptr, jboolean val) {
21038 LDKChannelDetails this_ptr_conv;
21039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21040 this_ptr_conv.is_owned = false;
21041 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21042 ChannelDetails_set_is_public(&this_ptr_conv, val);
21045 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 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) {
21046 LDKThirtyTwoBytes channel_id_arg_ref;
21047 CHECK(*((uint32_t*)channel_id_arg) == 32);
21048 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
21049 LDKChannelCounterparty counterparty_arg_conv;
21050 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
21051 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
21052 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
21053 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
21054 LDKOutPoint funding_txo_arg_conv;
21055 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
21056 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
21057 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
21058 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
21059 void* short_channel_id_arg_ptr = (void*)(((uint64_t)short_channel_id_arg) & ~1);
21060 CHECK_ACCESS(short_channel_id_arg_ptr);
21061 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
21062 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1));
21063 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
21064 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
21065 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
21066 void* confirmations_required_arg_ptr = (void*)(((uint64_t)confirmations_required_arg) & ~1);
21067 CHECK_ACCESS(confirmations_required_arg_ptr);
21068 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
21069 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1));
21070 void* force_close_spend_delay_arg_ptr = (void*)(((uint64_t)force_close_spend_delay_arg) & ~1);
21071 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
21072 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
21073 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1));
21074 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, 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);
21075 uint64_t ret_ref = 0;
21076 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21077 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21078 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21079 ret_ref = (uint64_t)ret_var.inner;
21080 if (ret_var.is_owned) {
21086 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
21087 LDKChannelDetails ret_var = ChannelDetails_clone(arg);
21088 uint64_t ret_ref = 0;
21089 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21090 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21091 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21092 ret_ref = (uint64_t)ret_var.inner;
21093 if (ret_var.is_owned) {
21098 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_clone_ptr(uint32_t arg) {
21099 LDKChannelDetails arg_conv;
21100 arg_conv.inner = (void*)(arg & (~1));
21101 arg_conv.is_owned = false;
21102 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21103 int64_t ret_val = ChannelDetails_clone_ptr(&arg_conv);
21107 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_clone(uint32_t orig) {
21108 LDKChannelDetails orig_conv;
21109 orig_conv.inner = (void*)(orig & (~1));
21110 orig_conv.is_owned = false;
21111 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21112 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
21113 uint64_t ret_ref = 0;
21114 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21115 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21116 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21117 ret_ref = (uint64_t)ret_var.inner;
21118 if (ret_var.is_owned) {
21124 void __attribute__((visibility("default"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
21125 if ((this_ptr & 1) != 0) return;
21126 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
21127 CHECK_ACCESS(this_ptr_ptr);
21128 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
21129 FREE((void*)this_ptr);
21130 PaymentSendFailure_free(this_ptr_conv);
21133 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
21134 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21135 *ret_copy = PaymentSendFailure_clone(arg);
21136 uint64_t ret_ref = (uint64_t)ret_copy;
21139 int64_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone_ptr(uint32_t arg) {
21140 LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)arg;
21141 int64_t ret_val = PaymentSendFailure_clone_ptr(arg_conv);
21145 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone(uint32_t orig) {
21146 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
21147 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21148 *ret_copy = PaymentSendFailure_clone(orig_conv);
21149 uint64_t ret_ref = (uint64_t)ret_copy;
21153 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_parameter_error(uint32_t a) {
21154 void* a_ptr = (void*)(((uint64_t)a) & ~1);
21155 CHECK_ACCESS(a_ptr);
21156 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
21157 a_conv = APIError_clone((LDKAPIError*)(((uint64_t)a) & ~1));
21158 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21159 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
21160 uint64_t ret_ref = (uint64_t)ret_copy;
21164 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_path_parameter_error(uint32_tArray a) {
21165 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
21166 a_constr.datalen = *((uint32_t*)a);
21167 if (a_constr.datalen > 0)
21168 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
21170 a_constr.data = NULL;
21171 uint32_t* a_vals = (uint32_t*)(a + 4);
21172 for (size_t w = 0; w < a_constr.datalen; w++) {
21173 uint32_t a_conv_22 = a_vals[w];
21174 void* a_conv_22_ptr = (void*)(((uint64_t)a_conv_22) & ~1);
21175 CHECK_ACCESS(a_conv_22_ptr);
21176 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
21177 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
21178 a_constr.data[w] = a_conv_22_conv;
21180 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21181 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
21182 uint64_t ret_ref = (uint64_t)ret_copy;
21186 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_all_failed_retry_safe(uint32_tArray a) {
21187 LDKCVec_APIErrorZ a_constr;
21188 a_constr.datalen = *((uint32_t*)a);
21189 if (a_constr.datalen > 0)
21190 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
21192 a_constr.data = NULL;
21193 uint32_t* a_vals = (uint32_t*)(a + 4);
21194 for (size_t k = 0; k < a_constr.datalen; k++) {
21195 uint32_t a_conv_10 = a_vals[k];
21196 void* a_conv_10_ptr = (void*)(((uint64_t)a_conv_10) & ~1);
21197 CHECK_ACCESS(a_conv_10_ptr);
21198 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
21199 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uint64_t)a_conv_10) & ~1));
21200 a_constr.data[k] = a_conv_10_conv;
21202 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21203 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
21204 uint64_t ret_ref = (uint64_t)ret_copy;
21208 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_partial_failure(uint32_tArray results, uint32_t failed_paths_retry, int8_tArray payment_id) {
21209 LDKCVec_CResult_NoneAPIErrorZZ results_constr;
21210 results_constr.datalen = *((uint32_t*)results);
21211 if (results_constr.datalen > 0)
21212 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
21214 results_constr.data = NULL;
21215 uint32_t* results_vals = (uint32_t*)(results + 4);
21216 for (size_t w = 0; w < results_constr.datalen; w++) {
21217 uint32_t results_conv_22 = results_vals[w];
21218 void* results_conv_22_ptr = (void*)(((uint64_t)results_conv_22) & ~1);
21219 CHECK_ACCESS(results_conv_22_ptr);
21220 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
21221 results_constr.data[w] = results_conv_22_conv;
21223 LDKRouteParameters failed_paths_retry_conv;
21224 failed_paths_retry_conv.inner = (void*)(failed_paths_retry & (~1));
21225 failed_paths_retry_conv.is_owned = (failed_paths_retry & 1) || (failed_paths_retry == 0);
21226 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
21227 failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
21228 LDKThirtyTwoBytes payment_id_ref;
21229 CHECK(*((uint32_t*)payment_id) == 32);
21230 memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32);
21231 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21232 *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
21233 uint64_t ret_ref = (uint64_t)ret_copy;
21237 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) {
21238 void* fee_est_ptr = (void*)(((uint64_t)fee_est) & ~1);
21239 CHECK_ACCESS(fee_est_ptr);
21240 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
21241 void* chain_monitor_ptr = (void*)(((uint64_t)chain_monitor) & ~1);
21242 CHECK_ACCESS(chain_monitor_ptr);
21243 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
21244 void* tx_broadcaster_ptr = (void*)(((uint64_t)tx_broadcaster) & ~1);
21245 CHECK_ACCESS(tx_broadcaster_ptr);
21246 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
21247 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
21248 CHECK_ACCESS(logger_ptr);
21249 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
21250 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
21251 CHECK_ACCESS(keys_manager_ptr);
21252 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
21253 LDKUserConfig config_conv;
21254 config_conv.inner = (void*)(config & (~1));
21255 config_conv.is_owned = (config & 1) || (config == 0);
21256 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
21257 config_conv = UserConfig_clone(&config_conv);
21258 LDKChainParameters params_conv;
21259 params_conv.inner = (void*)(params & (~1));
21260 params_conv.is_owned = (params & 1) || (params == 0);
21261 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
21262 params_conv = ChainParameters_clone(¶ms_conv);
21263 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
21264 uint64_t ret_ref = 0;
21265 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21266 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21267 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21268 ret_ref = (uint64_t)ret_var.inner;
21269 if (ret_var.is_owned) {
21275 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_get_current_default_configuration(uint32_t this_arg) {
21276 LDKChannelManager this_arg_conv;
21277 this_arg_conv.inner = (void*)(this_arg & (~1));
21278 this_arg_conv.is_owned = false;
21279 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21280 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
21281 uint64_t ret_ref = 0;
21282 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21283 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21284 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21285 ret_ref = (uint64_t)ret_var.inner;
21286 if (ret_var.is_owned) {
21292 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) {
21293 LDKChannelManager this_arg_conv;
21294 this_arg_conv.inner = (void*)(this_arg & (~1));
21295 this_arg_conv.is_owned = false;
21296 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21297 LDKPublicKey their_network_key_ref;
21298 CHECK(*((uint32_t*)their_network_key) == 33);
21299 memcpy(their_network_key_ref.compressed_form, (uint8_t*)(their_network_key + 4), 33);
21300 LDKUserConfig override_config_conv;
21301 override_config_conv.inner = (void*)(override_config & (~1));
21302 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
21303 CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
21304 override_config_conv = UserConfig_clone(&override_config_conv);
21305 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
21306 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
21307 return (uint64_t)ret_conv;
21310 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
21311 LDKChannelManager this_arg_conv;
21312 this_arg_conv.inner = (void*)(this_arg & (~1));
21313 this_arg_conv.is_owned = false;
21314 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21315 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
21316 uint32_tArray ret_arr = NULL;
21317 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
21318 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
21319 for (size_t q = 0; q < ret_var.datalen; q++) {
21320 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
21321 uint64_t ret_conv_16_ref = 0;
21322 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21323 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21324 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
21325 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
21326 if (ret_conv_16_var.is_owned) {
21327 ret_conv_16_ref |= 1;
21329 ret_arr_ptr[q] = ret_conv_16_ref;
21332 FREE(ret_var.data);
21336 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
21337 LDKChannelManager this_arg_conv;
21338 this_arg_conv.inner = (void*)(this_arg & (~1));
21339 this_arg_conv.is_owned = false;
21340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21341 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
21342 uint32_tArray ret_arr = NULL;
21343 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
21344 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
21345 for (size_t q = 0; q < ret_var.datalen; q++) {
21346 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
21347 uint64_t ret_conv_16_ref = 0;
21348 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21349 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21350 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
21351 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
21352 if (ret_conv_16_var.is_owned) {
21353 ret_conv_16_ref |= 1;
21355 ret_arr_ptr[q] = ret_conv_16_ref;
21358 FREE(ret_var.data);
21362 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id) {
21363 LDKChannelManager this_arg_conv;
21364 this_arg_conv.inner = (void*)(this_arg & (~1));
21365 this_arg_conv.is_owned = false;
21366 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21367 unsigned char channel_id_arr[32];
21368 CHECK(*((uint32_t*)channel_id) == 32);
21369 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
21370 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
21371 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21372 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
21373 return (uint64_t)ret_conv;
21376 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) {
21377 LDKChannelManager this_arg_conv;
21378 this_arg_conv.inner = (void*)(this_arg & (~1));
21379 this_arg_conv.is_owned = false;
21380 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21381 unsigned char channel_id_arr[32];
21382 CHECK(*((uint32_t*)channel_id) == 32);
21383 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
21384 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
21385 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21386 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
21387 return (uint64_t)ret_conv;
21390 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
21391 LDKChannelManager this_arg_conv;
21392 this_arg_conv.inner = (void*)(this_arg & (~1));
21393 this_arg_conv.is_owned = false;
21394 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21395 unsigned char channel_id_arr[32];
21396 CHECK(*((uint32_t*)channel_id) == 32);
21397 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
21398 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
21399 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21400 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
21401 return (uint64_t)ret_conv;
21404 void __attribute__((visibility("default"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
21405 LDKChannelManager this_arg_conv;
21406 this_arg_conv.inner = (void*)(this_arg & (~1));
21407 this_arg_conv.is_owned = false;
21408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21409 ChannelManager_force_close_all_channels(&this_arg_conv);
21412 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
21413 LDKChannelManager this_arg_conv;
21414 this_arg_conv.inner = (void*)(this_arg & (~1));
21415 this_arg_conv.is_owned = false;
21416 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21417 LDKRoute route_conv;
21418 route_conv.inner = (void*)(route & (~1));
21419 route_conv.is_owned = false;
21420 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
21421 LDKThirtyTwoBytes payment_hash_ref;
21422 CHECK(*((uint32_t*)payment_hash) == 32);
21423 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
21424 LDKThirtyTwoBytes payment_secret_ref;
21425 CHECK(*((uint32_t*)payment_secret) == 32);
21426 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
21427 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
21428 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
21429 return (uint64_t)ret_conv;
21432 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_retry_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_id) {
21433 LDKChannelManager this_arg_conv;
21434 this_arg_conv.inner = (void*)(this_arg & (~1));
21435 this_arg_conv.is_owned = false;
21436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21437 LDKRoute route_conv;
21438 route_conv.inner = (void*)(route & (~1));
21439 route_conv.is_owned = false;
21440 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
21441 LDKThirtyTwoBytes payment_id_ref;
21442 CHECK(*((uint32_t*)payment_id) == 32);
21443 memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32);
21444 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
21445 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
21446 return (uint64_t)ret_conv;
21449 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_spontaneous_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_preimage) {
21450 LDKChannelManager this_arg_conv;
21451 this_arg_conv.inner = (void*)(this_arg & (~1));
21452 this_arg_conv.is_owned = false;
21453 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21454 LDKRoute route_conv;
21455 route_conv.inner = (void*)(route & (~1));
21456 route_conv.is_owned = false;
21457 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
21458 LDKThirtyTwoBytes payment_preimage_ref;
21459 CHECK(*((uint32_t*)payment_preimage) == 32);
21460 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
21461 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
21462 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
21463 return (uint64_t)ret_conv;
21466 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_funding_transaction_generated(uint32_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
21467 LDKChannelManager this_arg_conv;
21468 this_arg_conv.inner = (void*)(this_arg & (~1));
21469 this_arg_conv.is_owned = false;
21470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21471 unsigned char temporary_channel_id_arr[32];
21472 CHECK(*((uint32_t*)temporary_channel_id) == 32);
21473 memcpy(temporary_channel_id_arr, (uint8_t*)(temporary_channel_id + 4), 32);
21474 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
21475 LDKTransaction funding_transaction_ref;
21476 funding_transaction_ref.datalen = *((uint32_t*)funding_transaction);
21477 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
21478 memcpy(funding_transaction_ref.data, (uint8_t*)(funding_transaction + 4), funding_transaction_ref.datalen);
21479 funding_transaction_ref.data_is_owned = true;
21480 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21481 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
21482 return (uint64_t)ret_conv;
21485 void __attribute__((visibility("default"))) TS_ChannelManager_broadcast_node_announcement(uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
21486 LDKChannelManager this_arg_conv;
21487 this_arg_conv.inner = (void*)(this_arg & (~1));
21488 this_arg_conv.is_owned = false;
21489 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21490 LDKThreeBytes rgb_ref;
21491 CHECK(*((uint32_t*)rgb) == 3);
21492 memcpy(rgb_ref.data, (uint8_t*)(rgb + 4), 3);
21493 LDKThirtyTwoBytes alias_ref;
21494 CHECK(*((uint32_t*)alias) == 32);
21495 memcpy(alias_ref.data, (uint8_t*)(alias + 4), 32);
21496 LDKCVec_NetAddressZ addresses_constr;
21497 addresses_constr.datalen = *((uint32_t*)addresses);
21498 if (addresses_constr.datalen > 0)
21499 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
21501 addresses_constr.data = NULL;
21502 uint32_t* addresses_vals = (uint32_t*)(addresses + 4);
21503 for (size_t m = 0; m < addresses_constr.datalen; m++) {
21504 uint32_t addresses_conv_12 = addresses_vals[m];
21505 void* addresses_conv_12_ptr = (void*)(((uint64_t)addresses_conv_12) & ~1);
21506 CHECK_ACCESS(addresses_conv_12_ptr);
21507 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
21508 addresses_constr.data[m] = addresses_conv_12_conv;
21510 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
21513 void __attribute__((visibility("default"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
21514 LDKChannelManager this_arg_conv;
21515 this_arg_conv.inner = (void*)(this_arg & (~1));
21516 this_arg_conv.is_owned = false;
21517 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21518 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
21521 void __attribute__((visibility("default"))) TS_ChannelManager_timer_tick_occurred(uint32_t this_arg) {
21522 LDKChannelManager this_arg_conv;
21523 this_arg_conv.inner = (void*)(this_arg & (~1));
21524 this_arg_conv.is_owned = false;
21525 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21526 ChannelManager_timer_tick_occurred(&this_arg_conv);
21529 jboolean __attribute__((visibility("default"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash) {
21530 LDKChannelManager this_arg_conv;
21531 this_arg_conv.inner = (void*)(this_arg & (~1));
21532 this_arg_conv.is_owned = false;
21533 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21534 unsigned char payment_hash_arr[32];
21535 CHECK(*((uint32_t*)payment_hash) == 32);
21536 memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32);
21537 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
21538 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
21542 jboolean __attribute__((visibility("default"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage) {
21543 LDKChannelManager this_arg_conv;
21544 this_arg_conv.inner = (void*)(this_arg & (~1));
21545 this_arg_conv.is_owned = false;
21546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21547 LDKThirtyTwoBytes payment_preimage_ref;
21548 CHECK(*((uint32_t*)payment_preimage) == 32);
21549 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
21550 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
21554 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
21555 LDKChannelManager this_arg_conv;
21556 this_arg_conv.inner = (void*)(this_arg & (~1));
21557 this_arg_conv.is_owned = false;
21558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21559 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21560 memcpy((uint8_t*)(ret_arr + 4), ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
21564 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, int64_t user_payment_id) {
21565 LDKChannelManager this_arg_conv;
21566 this_arg_conv.inner = (void*)(this_arg & (~1));
21567 this_arg_conv.is_owned = false;
21568 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21569 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
21570 CHECK_ACCESS(min_value_msat_ptr);
21571 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
21572 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
21573 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
21574 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
21575 return ((uint64_t)ret_conv);
21578 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, int64_t user_payment_id) {
21579 LDKChannelManager this_arg_conv;
21580 this_arg_conv.inner = (void*)(this_arg & (~1));
21581 this_arg_conv.is_owned = false;
21582 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21583 LDKThirtyTwoBytes payment_hash_ref;
21584 CHECK(*((uint32_t*)payment_hash) == 32);
21585 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
21586 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
21587 CHECK_ACCESS(min_value_msat_ptr);
21588 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
21589 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
21590 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
21591 *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
21592 return (uint64_t)ret_conv;
21595 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
21596 LDKChannelManager this_arg_conv;
21597 this_arg_conv.inner = (void*)(this_arg & (~1));
21598 this_arg_conv.is_owned = false;
21599 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21600 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
21601 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
21602 return (uint64_t)ret_ret;
21605 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
21606 LDKChannelManager this_arg_conv;
21607 this_arg_conv.inner = (void*)(this_arg & (~1));
21608 this_arg_conv.is_owned = false;
21609 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21610 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
21611 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
21612 return (uint64_t)ret_ret;
21615 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
21616 LDKChannelManager this_arg_conv;
21617 this_arg_conv.inner = (void*)(this_arg & (~1));
21618 this_arg_conv.is_owned = false;
21619 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21620 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
21621 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
21622 return (uint64_t)ret_ret;
21625 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Confirm(uint32_t this_arg) {
21626 LDKChannelManager this_arg_conv;
21627 this_arg_conv.inner = (void*)(this_arg & (~1));
21628 this_arg_conv.is_owned = false;
21629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21630 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
21631 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
21632 return (uint64_t)ret_ret;
21635 jboolean __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update_timeout(uint32_t this_arg, int64_t max_wait) {
21636 LDKChannelManager this_arg_conv;
21637 this_arg_conv.inner = (void*)(this_arg & (~1));
21638 this_arg_conv.is_owned = false;
21639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21640 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
21644 void __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
21645 LDKChannelManager this_arg_conv;
21646 this_arg_conv.inner = (void*)(this_arg & (~1));
21647 this_arg_conv.is_owned = false;
21648 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21649 ChannelManager_await_persistable_update(&this_arg_conv);
21652 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_current_best_block(uint32_t this_arg) {
21653 LDKChannelManager this_arg_conv;
21654 this_arg_conv.inner = (void*)(this_arg & (~1));
21655 this_arg_conv.is_owned = false;
21656 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21657 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
21658 uint64_t ret_ref = 0;
21659 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21660 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21661 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21662 ret_ref = (uint64_t)ret_var.inner;
21663 if (ret_var.is_owned) {
21669 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
21670 LDKChannelManager this_arg_conv;
21671 this_arg_conv.inner = (void*)(this_arg & (~1));
21672 this_arg_conv.is_owned = false;
21673 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21674 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
21675 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
21676 return (uint64_t)ret_ret;
21679 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_write(uint32_t obj) {
21680 LDKChannelManager obj_conv;
21681 obj_conv.inner = (void*)(obj & (~1));
21682 obj_conv.is_owned = false;
21683 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
21684 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
21685 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21686 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21687 CVec_u8Z_free(ret_var);
21691 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
21692 LDKChannelManagerReadArgs this_obj_conv;
21693 this_obj_conv.inner = (void*)(this_obj & (~1));
21694 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21695 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21696 ChannelManagerReadArgs_free(this_obj_conv);
21699 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
21700 LDKChannelManagerReadArgs this_ptr_conv;
21701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21702 this_ptr_conv.is_owned = false;
21703 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21704 // WARNING: This object doesn't live past this scope, needs clone!
21705 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv)) | 1;
21709 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
21710 LDKChannelManagerReadArgs this_ptr_conv;
21711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21712 this_ptr_conv.is_owned = false;
21713 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21714 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21715 CHECK_ACCESS(val_ptr);
21716 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
21717 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
21720 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
21721 LDKChannelManagerReadArgs this_ptr_conv;
21722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21723 this_ptr_conv.is_owned = false;
21724 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21725 // WARNING: This object doesn't live past this scope, needs clone!
21726 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv)) | 1;
21730 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
21731 LDKChannelManagerReadArgs this_ptr_conv;
21732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21733 this_ptr_conv.is_owned = false;
21734 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21735 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21736 CHECK_ACCESS(val_ptr);
21737 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
21738 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
21741 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
21742 LDKChannelManagerReadArgs this_ptr_conv;
21743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21744 this_ptr_conv.is_owned = false;
21745 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21746 // WARNING: This object doesn't live past this scope, needs clone!
21747 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv)) | 1;
21751 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
21752 LDKChannelManagerReadArgs this_ptr_conv;
21753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21754 this_ptr_conv.is_owned = false;
21755 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21756 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21757 CHECK_ACCESS(val_ptr);
21758 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
21759 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
21762 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
21763 LDKChannelManagerReadArgs this_ptr_conv;
21764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21765 this_ptr_conv.is_owned = false;
21766 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21767 // WARNING: This object doesn't live past this scope, needs clone!
21768 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv)) | 1;
21772 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
21773 LDKChannelManagerReadArgs this_ptr_conv;
21774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21775 this_ptr_conv.is_owned = false;
21776 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21777 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21778 CHECK_ACCESS(val_ptr);
21779 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
21780 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
21783 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
21784 LDKChannelManagerReadArgs this_ptr_conv;
21785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21786 this_ptr_conv.is_owned = false;
21787 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21788 // WARNING: This object doesn't live past this scope, needs clone!
21789 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv)) | 1;
21793 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
21794 LDKChannelManagerReadArgs this_ptr_conv;
21795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21796 this_ptr_conv.is_owned = false;
21797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21798 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21799 CHECK_ACCESS(val_ptr);
21800 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
21801 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
21804 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
21805 LDKChannelManagerReadArgs this_ptr_conv;
21806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21807 this_ptr_conv.is_owned = false;
21808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21809 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
21810 uint64_t ret_ref = 0;
21811 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21812 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21813 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21814 ret_ref = (uint64_t)ret_var.inner;
21815 if (ret_var.is_owned) {
21821 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
21822 LDKChannelManagerReadArgs this_ptr_conv;
21823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21824 this_ptr_conv.is_owned = false;
21825 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21826 LDKUserConfig val_conv;
21827 val_conv.inner = (void*)(val & (~1));
21828 val_conv.is_owned = (val & 1) || (val == 0);
21829 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21830 val_conv = UserConfig_clone(&val_conv);
21831 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
21834 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) {
21835 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
21836 CHECK_ACCESS(keys_manager_ptr);
21837 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
21838 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
21839 CHECK_ACCESS(fee_estimator_ptr);
21840 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
21841 void* chain_monitor_ptr = (void*)(((uint64_t)chain_monitor) & ~1);
21842 CHECK_ACCESS(chain_monitor_ptr);
21843 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
21844 void* tx_broadcaster_ptr = (void*)(((uint64_t)tx_broadcaster) & ~1);
21845 CHECK_ACCESS(tx_broadcaster_ptr);
21846 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
21847 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
21848 CHECK_ACCESS(logger_ptr);
21849 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
21850 LDKUserConfig default_config_conv;
21851 default_config_conv.inner = (void*)(default_config & (~1));
21852 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
21853 CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
21854 default_config_conv = UserConfig_clone(&default_config_conv);
21855 LDKCVec_ChannelMonitorZ channel_monitors_constr;
21856 channel_monitors_constr.datalen = *((uint32_t*)channel_monitors);
21857 if (channel_monitors_constr.datalen > 0)
21858 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
21860 channel_monitors_constr.data = NULL;
21861 uint32_t* channel_monitors_vals = (uint32_t*)(channel_monitors + 4);
21862 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
21863 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
21864 LDKChannelMonitor channel_monitors_conv_16_conv;
21865 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
21866 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
21867 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
21868 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
21870 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);
21871 uint64_t ret_ref = 0;
21872 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21873 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21874 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21875 ret_ref = (uint64_t)ret_var.inner;
21876 if (ret_var.is_owned) {
21882 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
21883 LDKu8slice ser_ref;
21884 ser_ref.datalen = *((uint32_t*)ser);
21885 ser_ref.data = (int8_t*)(ser + 4);
21886 LDKChannelManagerReadArgs arg_conv;
21887 arg_conv.inner = (void*)(arg & (~1));
21888 arg_conv.is_owned = (arg & 1) || (arg == 0);
21889 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21890 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
21891 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
21892 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
21893 return (uint64_t)ret_conv;
21896 void __attribute__((visibility("default"))) TS_DecodeError_free(uint32_t this_obj) {
21897 LDKDecodeError this_obj_conv;
21898 this_obj_conv.inner = (void*)(this_obj & (~1));
21899 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21900 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21901 DecodeError_free(this_obj_conv);
21904 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
21905 LDKDecodeError ret_var = DecodeError_clone(arg);
21906 uint64_t ret_ref = 0;
21907 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21908 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21909 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21910 ret_ref = (uint64_t)ret_var.inner;
21911 if (ret_var.is_owned) {
21916 int64_t __attribute__((visibility("default"))) TS_DecodeError_clone_ptr(uint32_t arg) {
21917 LDKDecodeError arg_conv;
21918 arg_conv.inner = (void*)(arg & (~1));
21919 arg_conv.is_owned = false;
21920 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21921 int64_t ret_val = DecodeError_clone_ptr(&arg_conv);
21925 uint32_t __attribute__((visibility("default"))) TS_DecodeError_clone(uint32_t orig) {
21926 LDKDecodeError orig_conv;
21927 orig_conv.inner = (void*)(orig & (~1));
21928 orig_conv.is_owned = false;
21929 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21930 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
21931 uint64_t ret_ref = 0;
21932 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21933 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21934 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21935 ret_ref = (uint64_t)ret_var.inner;
21936 if (ret_var.is_owned) {
21942 void __attribute__((visibility("default"))) TS_Init_free(uint32_t this_obj) {
21943 LDKInit this_obj_conv;
21944 this_obj_conv.inner = (void*)(this_obj & (~1));
21945 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21946 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21947 Init_free(this_obj_conv);
21950 uint32_t __attribute__((visibility("default"))) TS_Init_get_features(uint32_t this_ptr) {
21951 LDKInit this_ptr_conv;
21952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21953 this_ptr_conv.is_owned = false;
21954 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21955 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
21956 uint64_t ret_ref = 0;
21957 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21958 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21959 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21960 ret_ref = (uint64_t)ret_var.inner;
21961 if (ret_var.is_owned) {
21967 void __attribute__((visibility("default"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
21968 LDKInit this_ptr_conv;
21969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21970 this_ptr_conv.is_owned = false;
21971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21972 LDKInitFeatures val_conv;
21973 val_conv.inner = (void*)(val & (~1));
21974 val_conv.is_owned = (val & 1) || (val == 0);
21975 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21976 val_conv = InitFeatures_clone(&val_conv);
21977 Init_set_features(&this_ptr_conv, val_conv);
21980 uint32_t __attribute__((visibility("default"))) TS_Init_new(uint32_t features_arg) {
21981 LDKInitFeatures features_arg_conv;
21982 features_arg_conv.inner = (void*)(features_arg & (~1));
21983 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
21984 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
21985 features_arg_conv = InitFeatures_clone(&features_arg_conv);
21986 LDKInit ret_var = Init_new(features_arg_conv);
21987 uint64_t ret_ref = 0;
21988 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21989 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21990 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21991 ret_ref = (uint64_t)ret_var.inner;
21992 if (ret_var.is_owned) {
21998 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
21999 LDKInit ret_var = Init_clone(arg);
22000 uint64_t ret_ref = 0;
22001 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22002 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22003 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22004 ret_ref = (uint64_t)ret_var.inner;
22005 if (ret_var.is_owned) {
22010 int64_t __attribute__((visibility("default"))) TS_Init_clone_ptr(uint32_t arg) {
22012 arg_conv.inner = (void*)(arg & (~1));
22013 arg_conv.is_owned = false;
22014 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22015 int64_t ret_val = Init_clone_ptr(&arg_conv);
22019 uint32_t __attribute__((visibility("default"))) TS_Init_clone(uint32_t orig) {
22021 orig_conv.inner = (void*)(orig & (~1));
22022 orig_conv.is_owned = false;
22023 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22024 LDKInit ret_var = Init_clone(&orig_conv);
22025 uint64_t ret_ref = 0;
22026 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22027 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22028 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22029 ret_ref = (uint64_t)ret_var.inner;
22030 if (ret_var.is_owned) {
22036 void __attribute__((visibility("default"))) TS_ErrorMessage_free(uint32_t this_obj) {
22037 LDKErrorMessage this_obj_conv;
22038 this_obj_conv.inner = (void*)(this_obj & (~1));
22039 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22040 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22041 ErrorMessage_free(this_obj_conv);
22044 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
22045 LDKErrorMessage this_ptr_conv;
22046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22047 this_ptr_conv.is_owned = false;
22048 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22049 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22050 memcpy((uint8_t*)(ret_arr + 4), *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
22054 void __attribute__((visibility("default"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
22055 LDKErrorMessage this_ptr_conv;
22056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22057 this_ptr_conv.is_owned = false;
22058 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22059 LDKThirtyTwoBytes val_ref;
22060 CHECK(*((uint32_t*)val) == 32);
22061 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
22062 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
22065 jstring __attribute__((visibility("default"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
22066 LDKErrorMessage this_ptr_conv;
22067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22068 this_ptr_conv.is_owned = false;
22069 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22070 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
22071 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
22076 void __attribute__((visibility("default"))) TS_ErrorMessage_set_data(uint32_t this_ptr, jstring val) {
22077 LDKErrorMessage this_ptr_conv;
22078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22079 this_ptr_conv.is_owned = false;
22080 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22081 LDKStr val_conv = str_ref_to_owned_c(val);
22082 ErrorMessage_set_data(&this_ptr_conv, val_conv);
22085 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
22086 LDKThirtyTwoBytes channel_id_arg_ref;
22087 CHECK(*((uint32_t*)channel_id_arg) == 32);
22088 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
22089 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
22090 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
22091 uint64_t ret_ref = 0;
22092 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22093 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22094 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22095 ret_ref = (uint64_t)ret_var.inner;
22096 if (ret_var.is_owned) {
22102 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
22103 LDKErrorMessage ret_var = ErrorMessage_clone(arg);
22104 uint64_t ret_ref = 0;
22105 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22106 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22107 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22108 ret_ref = (uint64_t)ret_var.inner;
22109 if (ret_var.is_owned) {
22114 int64_t __attribute__((visibility("default"))) TS_ErrorMessage_clone_ptr(uint32_t arg) {
22115 LDKErrorMessage arg_conv;
22116 arg_conv.inner = (void*)(arg & (~1));
22117 arg_conv.is_owned = false;
22118 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22119 int64_t ret_val = ErrorMessage_clone_ptr(&arg_conv);
22123 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_clone(uint32_t orig) {
22124 LDKErrorMessage orig_conv;
22125 orig_conv.inner = (void*)(orig & (~1));
22126 orig_conv.is_owned = false;
22127 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22128 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
22129 uint64_t ret_ref = 0;
22130 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22131 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22132 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22133 ret_ref = (uint64_t)ret_var.inner;
22134 if (ret_var.is_owned) {
22140 void __attribute__((visibility("default"))) TS_Ping_free(uint32_t this_obj) {
22141 LDKPing this_obj_conv;
22142 this_obj_conv.inner = (void*)(this_obj & (~1));
22143 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22144 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22145 Ping_free(this_obj_conv);
22148 int16_t __attribute__((visibility("default"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
22149 LDKPing this_ptr_conv;
22150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22151 this_ptr_conv.is_owned = false;
22152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22153 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
22157 void __attribute__((visibility("default"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
22158 LDKPing this_ptr_conv;
22159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22160 this_ptr_conv.is_owned = false;
22161 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22162 Ping_set_ponglen(&this_ptr_conv, val);
22165 int16_t __attribute__((visibility("default"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
22166 LDKPing this_ptr_conv;
22167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22168 this_ptr_conv.is_owned = false;
22169 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22170 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
22174 void __attribute__((visibility("default"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
22175 LDKPing this_ptr_conv;
22176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22177 this_ptr_conv.is_owned = false;
22178 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22179 Ping_set_byteslen(&this_ptr_conv, val);
22182 uint32_t __attribute__((visibility("default"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
22183 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
22184 uint64_t ret_ref = 0;
22185 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22186 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22187 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22188 ret_ref = (uint64_t)ret_var.inner;
22189 if (ret_var.is_owned) {
22195 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
22196 LDKPing ret_var = Ping_clone(arg);
22197 uint64_t ret_ref = 0;
22198 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22199 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22200 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22201 ret_ref = (uint64_t)ret_var.inner;
22202 if (ret_var.is_owned) {
22207 int64_t __attribute__((visibility("default"))) TS_Ping_clone_ptr(uint32_t arg) {
22209 arg_conv.inner = (void*)(arg & (~1));
22210 arg_conv.is_owned = false;
22211 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22212 int64_t ret_val = Ping_clone_ptr(&arg_conv);
22216 uint32_t __attribute__((visibility("default"))) TS_Ping_clone(uint32_t orig) {
22218 orig_conv.inner = (void*)(orig & (~1));
22219 orig_conv.is_owned = false;
22220 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22221 LDKPing ret_var = Ping_clone(&orig_conv);
22222 uint64_t ret_ref = 0;
22223 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22224 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22225 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22226 ret_ref = (uint64_t)ret_var.inner;
22227 if (ret_var.is_owned) {
22233 void __attribute__((visibility("default"))) TS_Pong_free(uint32_t this_obj) {
22234 LDKPong this_obj_conv;
22235 this_obj_conv.inner = (void*)(this_obj & (~1));
22236 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22238 Pong_free(this_obj_conv);
22241 int16_t __attribute__((visibility("default"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
22242 LDKPong this_ptr_conv;
22243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22244 this_ptr_conv.is_owned = false;
22245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22246 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
22250 void __attribute__((visibility("default"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
22251 LDKPong this_ptr_conv;
22252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22253 this_ptr_conv.is_owned = false;
22254 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22255 Pong_set_byteslen(&this_ptr_conv, val);
22258 uint32_t __attribute__((visibility("default"))) TS_Pong_new(int16_t byteslen_arg) {
22259 LDKPong ret_var = Pong_new(byteslen_arg);
22260 uint64_t ret_ref = 0;
22261 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22262 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22263 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22264 ret_ref = (uint64_t)ret_var.inner;
22265 if (ret_var.is_owned) {
22271 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
22272 LDKPong ret_var = Pong_clone(arg);
22273 uint64_t ret_ref = 0;
22274 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22275 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22276 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22277 ret_ref = (uint64_t)ret_var.inner;
22278 if (ret_var.is_owned) {
22283 int64_t __attribute__((visibility("default"))) TS_Pong_clone_ptr(uint32_t arg) {
22285 arg_conv.inner = (void*)(arg & (~1));
22286 arg_conv.is_owned = false;
22287 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22288 int64_t ret_val = Pong_clone_ptr(&arg_conv);
22292 uint32_t __attribute__((visibility("default"))) TS_Pong_clone(uint32_t orig) {
22294 orig_conv.inner = (void*)(orig & (~1));
22295 orig_conv.is_owned = false;
22296 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22297 LDKPong ret_var = Pong_clone(&orig_conv);
22298 uint64_t ret_ref = 0;
22299 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22300 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22301 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22302 ret_ref = (uint64_t)ret_var.inner;
22303 if (ret_var.is_owned) {
22309 void __attribute__((visibility("default"))) TS_OpenChannel_free(uint32_t this_obj) {
22310 LDKOpenChannel this_obj_conv;
22311 this_obj_conv.inner = (void*)(this_obj & (~1));
22312 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22313 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22314 OpenChannel_free(this_obj_conv);
22317 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
22318 LDKOpenChannel this_ptr_conv;
22319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22320 this_ptr_conv.is_owned = false;
22321 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22322 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22323 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
22327 void __attribute__((visibility("default"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
22328 LDKOpenChannel this_ptr_conv;
22329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22330 this_ptr_conv.is_owned = false;
22331 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22332 LDKThirtyTwoBytes val_ref;
22333 CHECK(*((uint32_t*)val) == 32);
22334 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
22335 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
22338 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
22339 LDKOpenChannel this_ptr_conv;
22340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22341 this_ptr_conv.is_owned = false;
22342 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22343 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22344 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
22348 void __attribute__((visibility("default"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
22349 LDKOpenChannel this_ptr_conv;
22350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22351 this_ptr_conv.is_owned = false;
22352 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22353 LDKThirtyTwoBytes val_ref;
22354 CHECK(*((uint32_t*)val) == 32);
22355 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
22356 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
22359 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
22360 LDKOpenChannel this_ptr_conv;
22361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22362 this_ptr_conv.is_owned = false;
22363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22364 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
22368 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
22369 LDKOpenChannel this_ptr_conv;
22370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22371 this_ptr_conv.is_owned = false;
22372 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22373 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
22376 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
22377 LDKOpenChannel this_ptr_conv;
22378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22379 this_ptr_conv.is_owned = false;
22380 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22381 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
22385 void __attribute__((visibility("default"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
22386 LDKOpenChannel this_ptr_conv;
22387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22388 this_ptr_conv.is_owned = false;
22389 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22390 OpenChannel_set_push_msat(&this_ptr_conv, val);
22393 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
22394 LDKOpenChannel this_ptr_conv;
22395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22396 this_ptr_conv.is_owned = false;
22397 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22398 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
22402 void __attribute__((visibility("default"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
22403 LDKOpenChannel this_ptr_conv;
22404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22405 this_ptr_conv.is_owned = false;
22406 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22407 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
22410 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
22411 LDKOpenChannel this_ptr_conv;
22412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22413 this_ptr_conv.is_owned = false;
22414 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22415 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
22419 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
22420 LDKOpenChannel this_ptr_conv;
22421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22422 this_ptr_conv.is_owned = false;
22423 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22424 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
22427 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
22428 LDKOpenChannel this_ptr_conv;
22429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22430 this_ptr_conv.is_owned = false;
22431 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22432 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
22436 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
22437 LDKOpenChannel this_ptr_conv;
22438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22439 this_ptr_conv.is_owned = false;
22440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22441 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
22444 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
22445 LDKOpenChannel this_ptr_conv;
22446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22447 this_ptr_conv.is_owned = false;
22448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22449 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
22453 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
22454 LDKOpenChannel this_ptr_conv;
22455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22456 this_ptr_conv.is_owned = false;
22457 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22458 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
22461 int32_t __attribute__((visibility("default"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
22462 LDKOpenChannel this_ptr_conv;
22463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22464 this_ptr_conv.is_owned = false;
22465 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22466 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
22470 void __attribute__((visibility("default"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
22471 LDKOpenChannel this_ptr_conv;
22472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22473 this_ptr_conv.is_owned = false;
22474 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22475 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
22478 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
22479 LDKOpenChannel this_ptr_conv;
22480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22481 this_ptr_conv.is_owned = false;
22482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22483 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
22487 void __attribute__((visibility("default"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
22488 LDKOpenChannel this_ptr_conv;
22489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22490 this_ptr_conv.is_owned = false;
22491 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22492 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
22495 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
22496 LDKOpenChannel this_ptr_conv;
22497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22498 this_ptr_conv.is_owned = false;
22499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22500 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
22504 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
22505 LDKOpenChannel this_ptr_conv;
22506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22507 this_ptr_conv.is_owned = false;
22508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22509 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
22512 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
22513 LDKOpenChannel this_ptr_conv;
22514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22515 this_ptr_conv.is_owned = false;
22516 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22517 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22518 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
22522 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
22523 LDKOpenChannel this_ptr_conv;
22524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22525 this_ptr_conv.is_owned = false;
22526 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22527 LDKPublicKey val_ref;
22528 CHECK(*((uint32_t*)val) == 33);
22529 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22530 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
22533 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
22534 LDKOpenChannel this_ptr_conv;
22535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22536 this_ptr_conv.is_owned = false;
22537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22538 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22539 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
22543 void __attribute__((visibility("default"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
22544 LDKOpenChannel this_ptr_conv;
22545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22546 this_ptr_conv.is_owned = false;
22547 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22548 LDKPublicKey val_ref;
22549 CHECK(*((uint32_t*)val) == 33);
22550 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22551 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
22554 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
22555 LDKOpenChannel this_ptr_conv;
22556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22557 this_ptr_conv.is_owned = false;
22558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22559 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22560 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
22564 void __attribute__((visibility("default"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
22565 LDKOpenChannel this_ptr_conv;
22566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22567 this_ptr_conv.is_owned = false;
22568 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22569 LDKPublicKey val_ref;
22570 CHECK(*((uint32_t*)val) == 33);
22571 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22572 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
22575 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
22576 LDKOpenChannel this_ptr_conv;
22577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22578 this_ptr_conv.is_owned = false;
22579 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22580 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22581 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
22585 void __attribute__((visibility("default"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
22586 LDKOpenChannel this_ptr_conv;
22587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22588 this_ptr_conv.is_owned = false;
22589 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22590 LDKPublicKey val_ref;
22591 CHECK(*((uint32_t*)val) == 33);
22592 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22593 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
22596 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
22597 LDKOpenChannel this_ptr_conv;
22598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22599 this_ptr_conv.is_owned = false;
22600 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22601 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22602 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
22606 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
22607 LDKOpenChannel this_ptr_conv;
22608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22609 this_ptr_conv.is_owned = false;
22610 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22611 LDKPublicKey val_ref;
22612 CHECK(*((uint32_t*)val) == 33);
22613 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22614 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
22617 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
22618 LDKOpenChannel this_ptr_conv;
22619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22620 this_ptr_conv.is_owned = false;
22621 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22622 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22623 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
22627 void __attribute__((visibility("default"))) TS_OpenChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
22628 LDKOpenChannel this_ptr_conv;
22629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22630 this_ptr_conv.is_owned = false;
22631 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22632 LDKPublicKey val_ref;
22633 CHECK(*((uint32_t*)val) == 33);
22634 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22635 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
22638 int8_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
22639 LDKOpenChannel this_ptr_conv;
22640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22641 this_ptr_conv.is_owned = false;
22642 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22643 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
22647 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
22648 LDKOpenChannel this_ptr_conv;
22649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22650 this_ptr_conv.is_owned = false;
22651 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22652 OpenChannel_set_channel_flags(&this_ptr_conv, val);
22655 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
22656 LDKOpenChannel ret_var = OpenChannel_clone(arg);
22657 uint64_t ret_ref = 0;
22658 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22659 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22660 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22661 ret_ref = (uint64_t)ret_var.inner;
22662 if (ret_var.is_owned) {
22667 int64_t __attribute__((visibility("default"))) TS_OpenChannel_clone_ptr(uint32_t arg) {
22668 LDKOpenChannel arg_conv;
22669 arg_conv.inner = (void*)(arg & (~1));
22670 arg_conv.is_owned = false;
22671 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22672 int64_t ret_val = OpenChannel_clone_ptr(&arg_conv);
22676 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_clone(uint32_t orig) {
22677 LDKOpenChannel orig_conv;
22678 orig_conv.inner = (void*)(orig & (~1));
22679 orig_conv.is_owned = false;
22680 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22681 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
22682 uint64_t ret_ref = 0;
22683 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22684 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22685 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22686 ret_ref = (uint64_t)ret_var.inner;
22687 if (ret_var.is_owned) {
22693 void __attribute__((visibility("default"))) TS_AcceptChannel_free(uint32_t this_obj) {
22694 LDKAcceptChannel this_obj_conv;
22695 this_obj_conv.inner = (void*)(this_obj & (~1));
22696 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22697 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22698 AcceptChannel_free(this_obj_conv);
22701 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
22702 LDKAcceptChannel this_ptr_conv;
22703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22704 this_ptr_conv.is_owned = false;
22705 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22706 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22707 memcpy((uint8_t*)(ret_arr + 4), *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
22711 void __attribute__((visibility("default"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
22712 LDKAcceptChannel this_ptr_conv;
22713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22714 this_ptr_conv.is_owned = false;
22715 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22716 LDKThirtyTwoBytes val_ref;
22717 CHECK(*((uint32_t*)val) == 32);
22718 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
22719 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
22722 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
22723 LDKAcceptChannel this_ptr_conv;
22724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22725 this_ptr_conv.is_owned = false;
22726 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22727 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
22731 void __attribute__((visibility("default"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
22732 LDKAcceptChannel this_ptr_conv;
22733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22734 this_ptr_conv.is_owned = false;
22735 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22736 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
22739 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
22740 LDKAcceptChannel this_ptr_conv;
22741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22742 this_ptr_conv.is_owned = false;
22743 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22744 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
22748 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
22749 LDKAcceptChannel this_ptr_conv;
22750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22751 this_ptr_conv.is_owned = false;
22752 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22753 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
22756 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
22757 LDKAcceptChannel this_ptr_conv;
22758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22759 this_ptr_conv.is_owned = false;
22760 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22761 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
22765 void __attribute__((visibility("default"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
22766 LDKAcceptChannel this_ptr_conv;
22767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22768 this_ptr_conv.is_owned = false;
22769 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22770 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
22773 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
22774 LDKAcceptChannel this_ptr_conv;
22775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22776 this_ptr_conv.is_owned = false;
22777 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22778 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
22782 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
22783 LDKAcceptChannel this_ptr_conv;
22784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22785 this_ptr_conv.is_owned = false;
22786 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22787 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
22790 int32_t __attribute__((visibility("default"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
22791 LDKAcceptChannel this_ptr_conv;
22792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22793 this_ptr_conv.is_owned = false;
22794 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22795 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
22799 void __attribute__((visibility("default"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
22800 LDKAcceptChannel this_ptr_conv;
22801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22802 this_ptr_conv.is_owned = false;
22803 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22804 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
22807 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
22808 LDKAcceptChannel this_ptr_conv;
22809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22810 this_ptr_conv.is_owned = false;
22811 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22812 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
22816 void __attribute__((visibility("default"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
22817 LDKAcceptChannel this_ptr_conv;
22818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22819 this_ptr_conv.is_owned = false;
22820 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22821 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
22824 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
22825 LDKAcceptChannel this_ptr_conv;
22826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22827 this_ptr_conv.is_owned = false;
22828 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22829 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
22833 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
22834 LDKAcceptChannel this_ptr_conv;
22835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22836 this_ptr_conv.is_owned = false;
22837 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22838 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
22841 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
22842 LDKAcceptChannel this_ptr_conv;
22843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22844 this_ptr_conv.is_owned = false;
22845 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22846 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22847 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
22851 void __attribute__((visibility("default"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
22852 LDKAcceptChannel this_ptr_conv;
22853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22854 this_ptr_conv.is_owned = false;
22855 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22856 LDKPublicKey val_ref;
22857 CHECK(*((uint32_t*)val) == 33);
22858 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22859 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
22862 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
22863 LDKAcceptChannel this_ptr_conv;
22864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22865 this_ptr_conv.is_owned = false;
22866 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22867 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22868 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
22872 void __attribute__((visibility("default"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
22873 LDKAcceptChannel this_ptr_conv;
22874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22875 this_ptr_conv.is_owned = false;
22876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22877 LDKPublicKey val_ref;
22878 CHECK(*((uint32_t*)val) == 33);
22879 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22880 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
22883 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
22884 LDKAcceptChannel this_ptr_conv;
22885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22886 this_ptr_conv.is_owned = false;
22887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22888 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22889 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
22893 void __attribute__((visibility("default"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
22894 LDKAcceptChannel this_ptr_conv;
22895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22896 this_ptr_conv.is_owned = false;
22897 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22898 LDKPublicKey val_ref;
22899 CHECK(*((uint32_t*)val) == 33);
22900 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22901 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
22904 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
22905 LDKAcceptChannel this_ptr_conv;
22906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22907 this_ptr_conv.is_owned = false;
22908 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22909 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22910 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
22914 void __attribute__((visibility("default"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
22915 LDKAcceptChannel this_ptr_conv;
22916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22917 this_ptr_conv.is_owned = false;
22918 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22919 LDKPublicKey val_ref;
22920 CHECK(*((uint32_t*)val) == 33);
22921 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22922 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
22925 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
22926 LDKAcceptChannel this_ptr_conv;
22927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22928 this_ptr_conv.is_owned = false;
22929 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22930 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22931 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
22935 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
22936 LDKAcceptChannel this_ptr_conv;
22937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22938 this_ptr_conv.is_owned = false;
22939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22940 LDKPublicKey val_ref;
22941 CHECK(*((uint32_t*)val) == 33);
22942 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22943 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
22946 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
22947 LDKAcceptChannel this_ptr_conv;
22948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22949 this_ptr_conv.is_owned = false;
22950 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22951 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22952 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
22956 void __attribute__((visibility("default"))) TS_AcceptChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
22957 LDKAcceptChannel this_ptr_conv;
22958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22959 this_ptr_conv.is_owned = false;
22960 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22961 LDKPublicKey val_ref;
22962 CHECK(*((uint32_t*)val) == 33);
22963 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22964 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
22967 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
22968 LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
22969 uint64_t ret_ref = 0;
22970 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22971 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22972 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22973 ret_ref = (uint64_t)ret_var.inner;
22974 if (ret_var.is_owned) {
22979 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_clone_ptr(uint32_t arg) {
22980 LDKAcceptChannel arg_conv;
22981 arg_conv.inner = (void*)(arg & (~1));
22982 arg_conv.is_owned = false;
22983 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22984 int64_t ret_val = AcceptChannel_clone_ptr(&arg_conv);
22988 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_clone(uint32_t orig) {
22989 LDKAcceptChannel orig_conv;
22990 orig_conv.inner = (void*)(orig & (~1));
22991 orig_conv.is_owned = false;
22992 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22993 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
22994 uint64_t ret_ref = 0;
22995 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22996 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22997 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22998 ret_ref = (uint64_t)ret_var.inner;
22999 if (ret_var.is_owned) {
23005 void __attribute__((visibility("default"))) TS_FundingCreated_free(uint32_t this_obj) {
23006 LDKFundingCreated this_obj_conv;
23007 this_obj_conv.inner = (void*)(this_obj & (~1));
23008 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23010 FundingCreated_free(this_obj_conv);
23013 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
23014 LDKFundingCreated this_ptr_conv;
23015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23016 this_ptr_conv.is_owned = false;
23017 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23018 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23019 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
23023 void __attribute__((visibility("default"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
23024 LDKFundingCreated 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 LDKThirtyTwoBytes val_ref;
23029 CHECK(*((uint32_t*)val) == 32);
23030 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23031 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
23034 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
23035 LDKFundingCreated this_ptr_conv;
23036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23037 this_ptr_conv.is_owned = false;
23038 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23039 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23040 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
23044 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
23045 LDKFundingCreated this_ptr_conv;
23046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23047 this_ptr_conv.is_owned = false;
23048 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23049 LDKThirtyTwoBytes val_ref;
23050 CHECK(*((uint32_t*)val) == 32);
23051 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23052 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
23055 int16_t __attribute__((visibility("default"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
23056 LDKFundingCreated this_ptr_conv;
23057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23058 this_ptr_conv.is_owned = false;
23059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23060 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
23064 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
23065 LDKFundingCreated this_ptr_conv;
23066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23067 this_ptr_conv.is_owned = false;
23068 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23069 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
23072 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
23073 LDKFundingCreated this_ptr_conv;
23074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23075 this_ptr_conv.is_owned = false;
23076 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23077 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
23078 memcpy((uint8_t*)(ret_arr + 4), FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
23082 void __attribute__((visibility("default"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
23083 LDKFundingCreated this_ptr_conv;
23084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23085 this_ptr_conv.is_owned = false;
23086 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23087 LDKSignature val_ref;
23088 CHECK(*((uint32_t*)val) == 64);
23089 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
23090 FundingCreated_set_signature(&this_ptr_conv, val_ref);
23093 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) {
23094 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
23095 CHECK(*((uint32_t*)temporary_channel_id_arg) == 32);
23096 memcpy(temporary_channel_id_arg_ref.data, (uint8_t*)(temporary_channel_id_arg + 4), 32);
23097 LDKThirtyTwoBytes funding_txid_arg_ref;
23098 CHECK(*((uint32_t*)funding_txid_arg) == 32);
23099 memcpy(funding_txid_arg_ref.data, (uint8_t*)(funding_txid_arg + 4), 32);
23100 LDKSignature signature_arg_ref;
23101 CHECK(*((uint32_t*)signature_arg) == 64);
23102 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
23103 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
23104 uint64_t ret_ref = 0;
23105 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23106 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23107 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23108 ret_ref = (uint64_t)ret_var.inner;
23109 if (ret_var.is_owned) {
23115 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
23116 LDKFundingCreated ret_var = FundingCreated_clone(arg);
23117 uint64_t ret_ref = 0;
23118 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23119 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23120 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23121 ret_ref = (uint64_t)ret_var.inner;
23122 if (ret_var.is_owned) {
23127 int64_t __attribute__((visibility("default"))) TS_FundingCreated_clone_ptr(uint32_t arg) {
23128 LDKFundingCreated arg_conv;
23129 arg_conv.inner = (void*)(arg & (~1));
23130 arg_conv.is_owned = false;
23131 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23132 int64_t ret_val = FundingCreated_clone_ptr(&arg_conv);
23136 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_clone(uint32_t orig) {
23137 LDKFundingCreated orig_conv;
23138 orig_conv.inner = (void*)(orig & (~1));
23139 orig_conv.is_owned = false;
23140 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23141 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
23142 uint64_t ret_ref = 0;
23143 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23144 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23145 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23146 ret_ref = (uint64_t)ret_var.inner;
23147 if (ret_var.is_owned) {
23153 void __attribute__((visibility("default"))) TS_FundingSigned_free(uint32_t this_obj) {
23154 LDKFundingSigned this_obj_conv;
23155 this_obj_conv.inner = (void*)(this_obj & (~1));
23156 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23158 FundingSigned_free(this_obj_conv);
23161 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
23162 LDKFundingSigned this_ptr_conv;
23163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23164 this_ptr_conv.is_owned = false;
23165 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23166 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23167 memcpy((uint8_t*)(ret_arr + 4), *FundingSigned_get_channel_id(&this_ptr_conv), 32);
23171 void __attribute__((visibility("default"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23172 LDKFundingSigned this_ptr_conv;
23173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23174 this_ptr_conv.is_owned = false;
23175 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23176 LDKThirtyTwoBytes val_ref;
23177 CHECK(*((uint32_t*)val) == 32);
23178 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23179 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
23182 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
23183 LDKFundingSigned this_ptr_conv;
23184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23185 this_ptr_conv.is_owned = false;
23186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23187 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
23188 memcpy((uint8_t*)(ret_arr + 4), FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
23192 void __attribute__((visibility("default"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
23193 LDKFundingSigned this_ptr_conv;
23194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23195 this_ptr_conv.is_owned = false;
23196 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23197 LDKSignature val_ref;
23198 CHECK(*((uint32_t*)val) == 64);
23199 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
23200 FundingSigned_set_signature(&this_ptr_conv, val_ref);
23203 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
23204 LDKThirtyTwoBytes channel_id_arg_ref;
23205 CHECK(*((uint32_t*)channel_id_arg) == 32);
23206 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
23207 LDKSignature signature_arg_ref;
23208 CHECK(*((uint32_t*)signature_arg) == 64);
23209 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
23210 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
23211 uint64_t ret_ref = 0;
23212 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23213 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23214 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23215 ret_ref = (uint64_t)ret_var.inner;
23216 if (ret_var.is_owned) {
23222 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
23223 LDKFundingSigned ret_var = FundingSigned_clone(arg);
23224 uint64_t ret_ref = 0;
23225 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23226 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23227 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23228 ret_ref = (uint64_t)ret_var.inner;
23229 if (ret_var.is_owned) {
23234 int64_t __attribute__((visibility("default"))) TS_FundingSigned_clone_ptr(uint32_t arg) {
23235 LDKFundingSigned arg_conv;
23236 arg_conv.inner = (void*)(arg & (~1));
23237 arg_conv.is_owned = false;
23238 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23239 int64_t ret_val = FundingSigned_clone_ptr(&arg_conv);
23243 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_clone(uint32_t orig) {
23244 LDKFundingSigned orig_conv;
23245 orig_conv.inner = (void*)(orig & (~1));
23246 orig_conv.is_owned = false;
23247 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23248 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
23249 uint64_t ret_ref = 0;
23250 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23251 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23252 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23253 ret_ref = (uint64_t)ret_var.inner;
23254 if (ret_var.is_owned) {
23260 void __attribute__((visibility("default"))) TS_FundingLocked_free(uint32_t this_obj) {
23261 LDKFundingLocked this_obj_conv;
23262 this_obj_conv.inner = (void*)(this_obj & (~1));
23263 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23264 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23265 FundingLocked_free(this_obj_conv);
23268 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_channel_id(uint32_t this_ptr) {
23269 LDKFundingLocked this_ptr_conv;
23270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23271 this_ptr_conv.is_owned = false;
23272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23273 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23274 memcpy((uint8_t*)(ret_arr + 4), *FundingLocked_get_channel_id(&this_ptr_conv), 32);
23278 void __attribute__((visibility("default"))) TS_FundingLocked_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23279 LDKFundingLocked this_ptr_conv;
23280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23281 this_ptr_conv.is_owned = false;
23282 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23283 LDKThirtyTwoBytes val_ref;
23284 CHECK(*((uint32_t*)val) == 32);
23285 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23286 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
23289 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_next_per_commitment_point(uint32_t this_ptr) {
23290 LDKFundingLocked this_ptr_conv;
23291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23292 this_ptr_conv.is_owned = false;
23293 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23294 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23295 memcpy((uint8_t*)(ret_arr + 4), FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
23299 void __attribute__((visibility("default"))) TS_FundingLocked_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
23300 LDKFundingLocked this_ptr_conv;
23301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23302 this_ptr_conv.is_owned = false;
23303 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23304 LDKPublicKey val_ref;
23305 CHECK(*((uint32_t*)val) == 33);
23306 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
23307 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
23310 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
23311 LDKThirtyTwoBytes channel_id_arg_ref;
23312 CHECK(*((uint32_t*)channel_id_arg) == 32);
23313 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
23314 LDKPublicKey next_per_commitment_point_arg_ref;
23315 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
23316 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
23317 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
23318 uint64_t ret_ref = 0;
23319 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23320 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23321 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23322 ret_ref = (uint64_t)ret_var.inner;
23323 if (ret_var.is_owned) {
23329 static inline uint64_t FundingLocked_clone_ptr(LDKFundingLocked *NONNULL_PTR arg) {
23330 LDKFundingLocked ret_var = FundingLocked_clone(arg);
23331 uint64_t ret_ref = 0;
23332 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23333 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23334 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23335 ret_ref = (uint64_t)ret_var.inner;
23336 if (ret_var.is_owned) {
23341 int64_t __attribute__((visibility("default"))) TS_FundingLocked_clone_ptr(uint32_t arg) {
23342 LDKFundingLocked arg_conv;
23343 arg_conv.inner = (void*)(arg & (~1));
23344 arg_conv.is_owned = false;
23345 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23346 int64_t ret_val = FundingLocked_clone_ptr(&arg_conv);
23350 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_clone(uint32_t orig) {
23351 LDKFundingLocked orig_conv;
23352 orig_conv.inner = (void*)(orig & (~1));
23353 orig_conv.is_owned = false;
23354 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23355 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
23356 uint64_t ret_ref = 0;
23357 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23358 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23359 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23360 ret_ref = (uint64_t)ret_var.inner;
23361 if (ret_var.is_owned) {
23367 void __attribute__((visibility("default"))) TS_Shutdown_free(uint32_t this_obj) {
23368 LDKShutdown this_obj_conv;
23369 this_obj_conv.inner = (void*)(this_obj & (~1));
23370 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23371 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23372 Shutdown_free(this_obj_conv);
23375 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
23376 LDKShutdown this_ptr_conv;
23377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23378 this_ptr_conv.is_owned = false;
23379 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23380 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23381 memcpy((uint8_t*)(ret_arr + 4), *Shutdown_get_channel_id(&this_ptr_conv), 32);
23385 void __attribute__((visibility("default"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23386 LDKShutdown this_ptr_conv;
23387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23388 this_ptr_conv.is_owned = false;
23389 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23390 LDKThirtyTwoBytes val_ref;
23391 CHECK(*((uint32_t*)val) == 32);
23392 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23393 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
23396 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
23397 LDKShutdown this_ptr_conv;
23398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23399 this_ptr_conv.is_owned = false;
23400 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23401 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
23402 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23403 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23407 void __attribute__((visibility("default"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
23408 LDKShutdown this_ptr_conv;
23409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23410 this_ptr_conv.is_owned = false;
23411 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23412 LDKCVec_u8Z val_ref;
23413 val_ref.datalen = *((uint32_t*)val);
23414 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
23415 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
23416 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
23419 uint32_t __attribute__((visibility("default"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
23420 LDKThirtyTwoBytes channel_id_arg_ref;
23421 CHECK(*((uint32_t*)channel_id_arg) == 32);
23422 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
23423 LDKCVec_u8Z scriptpubkey_arg_ref;
23424 scriptpubkey_arg_ref.datalen = *((uint32_t*)scriptpubkey_arg);
23425 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
23426 memcpy(scriptpubkey_arg_ref.data, (uint8_t*)(scriptpubkey_arg + 4), scriptpubkey_arg_ref.datalen);
23427 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
23428 uint64_t ret_ref = 0;
23429 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23430 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23431 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23432 ret_ref = (uint64_t)ret_var.inner;
23433 if (ret_var.is_owned) {
23439 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
23440 LDKShutdown ret_var = Shutdown_clone(arg);
23441 uint64_t ret_ref = 0;
23442 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23443 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23444 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23445 ret_ref = (uint64_t)ret_var.inner;
23446 if (ret_var.is_owned) {
23451 int64_t __attribute__((visibility("default"))) TS_Shutdown_clone_ptr(uint32_t arg) {
23452 LDKShutdown arg_conv;
23453 arg_conv.inner = (void*)(arg & (~1));
23454 arg_conv.is_owned = false;
23455 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23456 int64_t ret_val = Shutdown_clone_ptr(&arg_conv);
23460 uint32_t __attribute__((visibility("default"))) TS_Shutdown_clone(uint32_t orig) {
23461 LDKShutdown orig_conv;
23462 orig_conv.inner = (void*)(orig & (~1));
23463 orig_conv.is_owned = false;
23464 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23465 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
23466 uint64_t ret_ref = 0;
23467 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23468 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23469 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23470 ret_ref = (uint64_t)ret_var.inner;
23471 if (ret_var.is_owned) {
23477 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_free(uint32_t this_obj) {
23478 LDKClosingSignedFeeRange this_obj_conv;
23479 this_obj_conv.inner = (void*)(this_obj & (~1));
23480 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23481 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23482 ClosingSignedFeeRange_free(this_obj_conv);
23485 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint32_t this_ptr) {
23486 LDKClosingSignedFeeRange this_ptr_conv;
23487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23488 this_ptr_conv.is_owned = false;
23489 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23490 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
23494 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint32_t this_ptr, int64_t val) {
23495 LDKClosingSignedFeeRange 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 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
23502 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint32_t this_ptr) {
23503 LDKClosingSignedFeeRange this_ptr_conv;
23504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23505 this_ptr_conv.is_owned = false;
23506 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23507 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
23511 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
23512 LDKClosingSignedFeeRange this_ptr_conv;
23513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23514 this_ptr_conv.is_owned = false;
23515 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23516 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
23519 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
23520 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
23521 uint64_t ret_ref = 0;
23522 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23523 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23524 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23525 ret_ref = (uint64_t)ret_var.inner;
23526 if (ret_var.is_owned) {
23532 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
23533 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
23534 uint64_t ret_ref = 0;
23535 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23536 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23537 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23538 ret_ref = (uint64_t)ret_var.inner;
23539 if (ret_var.is_owned) {
23544 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_clone_ptr(uint32_t arg) {
23545 LDKClosingSignedFeeRange arg_conv;
23546 arg_conv.inner = (void*)(arg & (~1));
23547 arg_conv.is_owned = false;
23548 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23549 int64_t ret_val = ClosingSignedFeeRange_clone_ptr(&arg_conv);
23553 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_clone(uint32_t orig) {
23554 LDKClosingSignedFeeRange orig_conv;
23555 orig_conv.inner = (void*)(orig & (~1));
23556 orig_conv.is_owned = false;
23557 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23558 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
23559 uint64_t ret_ref = 0;
23560 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23561 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23562 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23563 ret_ref = (uint64_t)ret_var.inner;
23564 if (ret_var.is_owned) {
23570 void __attribute__((visibility("default"))) TS_ClosingSigned_free(uint32_t this_obj) {
23571 LDKClosingSigned this_obj_conv;
23572 this_obj_conv.inner = (void*)(this_obj & (~1));
23573 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23574 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23575 ClosingSigned_free(this_obj_conv);
23578 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
23579 LDKClosingSigned this_ptr_conv;
23580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23581 this_ptr_conv.is_owned = false;
23582 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23583 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23584 memcpy((uint8_t*)(ret_arr + 4), *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
23588 void __attribute__((visibility("default"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23589 LDKClosingSigned this_ptr_conv;
23590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23591 this_ptr_conv.is_owned = false;
23592 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23593 LDKThirtyTwoBytes val_ref;
23594 CHECK(*((uint32_t*)val) == 32);
23595 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23596 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
23599 int64_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
23600 LDKClosingSigned this_ptr_conv;
23601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23602 this_ptr_conv.is_owned = false;
23603 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23604 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
23608 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
23609 LDKClosingSigned this_ptr_conv;
23610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23611 this_ptr_conv.is_owned = false;
23612 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23613 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
23616 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
23617 LDKClosingSigned this_ptr_conv;
23618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23619 this_ptr_conv.is_owned = false;
23620 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23621 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
23622 memcpy((uint8_t*)(ret_arr + 4), ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
23626 void __attribute__((visibility("default"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
23627 LDKClosingSigned this_ptr_conv;
23628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23629 this_ptr_conv.is_owned = false;
23630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23631 LDKSignature val_ref;
23632 CHECK(*((uint32_t*)val) == 64);
23633 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
23634 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
23637 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_range(uint32_t this_ptr) {
23638 LDKClosingSigned this_ptr_conv;
23639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23640 this_ptr_conv.is_owned = false;
23641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23642 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
23643 uint64_t ret_ref = 0;
23644 if ((uint64_t)ret_var.inner > 4096) {
23645 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23646 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23647 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23648 ret_ref = (uint64_t)ret_var.inner;
23649 if (ret_var.is_owned) {
23656 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_range(uint32_t this_ptr, uint32_t val) {
23657 LDKClosingSigned this_ptr_conv;
23658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23659 this_ptr_conv.is_owned = false;
23660 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23661 LDKClosingSignedFeeRange val_conv;
23662 val_conv.inner = (void*)(val & (~1));
23663 val_conv.is_owned = (val & 1) || (val == 0);
23664 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23665 val_conv = ClosingSignedFeeRange_clone(&val_conv);
23666 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
23669 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) {
23670 LDKThirtyTwoBytes channel_id_arg_ref;
23671 CHECK(*((uint32_t*)channel_id_arg) == 32);
23672 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
23673 LDKSignature signature_arg_ref;
23674 CHECK(*((uint32_t*)signature_arg) == 64);
23675 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
23676 LDKClosingSignedFeeRange fee_range_arg_conv;
23677 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
23678 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
23679 CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
23680 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
23681 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
23682 uint64_t ret_ref = 0;
23683 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23684 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23685 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23686 ret_ref = (uint64_t)ret_var.inner;
23687 if (ret_var.is_owned) {
23693 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
23694 LDKClosingSigned ret_var = ClosingSigned_clone(arg);
23695 uint64_t ret_ref = 0;
23696 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23697 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23698 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23699 ret_ref = (uint64_t)ret_var.inner;
23700 if (ret_var.is_owned) {
23705 int64_t __attribute__((visibility("default"))) TS_ClosingSigned_clone_ptr(uint32_t arg) {
23706 LDKClosingSigned arg_conv;
23707 arg_conv.inner = (void*)(arg & (~1));
23708 arg_conv.is_owned = false;
23709 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23710 int64_t ret_val = ClosingSigned_clone_ptr(&arg_conv);
23714 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_clone(uint32_t orig) {
23715 LDKClosingSigned orig_conv;
23716 orig_conv.inner = (void*)(orig & (~1));
23717 orig_conv.is_owned = false;
23718 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23719 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
23720 uint64_t ret_ref = 0;
23721 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23722 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23723 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23724 ret_ref = (uint64_t)ret_var.inner;
23725 if (ret_var.is_owned) {
23731 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_free(uint32_t this_obj) {
23732 LDKUpdateAddHTLC this_obj_conv;
23733 this_obj_conv.inner = (void*)(this_obj & (~1));
23734 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23735 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23736 UpdateAddHTLC_free(this_obj_conv);
23739 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
23740 LDKUpdateAddHTLC this_ptr_conv;
23741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23742 this_ptr_conv.is_owned = false;
23743 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23744 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23745 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
23749 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23750 LDKUpdateAddHTLC this_ptr_conv;
23751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23752 this_ptr_conv.is_owned = false;
23753 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23754 LDKThirtyTwoBytes val_ref;
23755 CHECK(*((uint32_t*)val) == 32);
23756 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23757 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
23760 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
23761 LDKUpdateAddHTLC this_ptr_conv;
23762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23763 this_ptr_conv.is_owned = false;
23764 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23765 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
23769 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
23770 LDKUpdateAddHTLC this_ptr_conv;
23771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23772 this_ptr_conv.is_owned = false;
23773 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23774 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
23777 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
23778 LDKUpdateAddHTLC this_ptr_conv;
23779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23780 this_ptr_conv.is_owned = false;
23781 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23782 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
23786 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
23787 LDKUpdateAddHTLC this_ptr_conv;
23788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23789 this_ptr_conv.is_owned = false;
23790 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23791 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
23794 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
23795 LDKUpdateAddHTLC this_ptr_conv;
23796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23797 this_ptr_conv.is_owned = false;
23798 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23799 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23800 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
23804 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
23805 LDKUpdateAddHTLC this_ptr_conv;
23806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23807 this_ptr_conv.is_owned = false;
23808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23809 LDKThirtyTwoBytes val_ref;
23810 CHECK(*((uint32_t*)val) == 32);
23811 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23812 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
23815 int32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
23816 LDKUpdateAddHTLC this_ptr_conv;
23817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23818 this_ptr_conv.is_owned = false;
23819 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23820 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
23824 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
23825 LDKUpdateAddHTLC this_ptr_conv;
23826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23827 this_ptr_conv.is_owned = false;
23828 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23829 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
23832 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
23833 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
23834 uint64_t ret_ref = 0;
23835 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23836 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23837 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23838 ret_ref = (uint64_t)ret_var.inner;
23839 if (ret_var.is_owned) {
23844 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_clone_ptr(uint32_t arg) {
23845 LDKUpdateAddHTLC arg_conv;
23846 arg_conv.inner = (void*)(arg & (~1));
23847 arg_conv.is_owned = false;
23848 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23849 int64_t ret_val = UpdateAddHTLC_clone_ptr(&arg_conv);
23853 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
23854 LDKUpdateAddHTLC orig_conv;
23855 orig_conv.inner = (void*)(orig & (~1));
23856 orig_conv.is_owned = false;
23857 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23858 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
23859 uint64_t ret_ref = 0;
23860 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23861 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23862 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23863 ret_ref = (uint64_t)ret_var.inner;
23864 if (ret_var.is_owned) {
23870 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_free(uint32_t this_obj) {
23871 LDKUpdateFulfillHTLC this_obj_conv;
23872 this_obj_conv.inner = (void*)(this_obj & (~1));
23873 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23874 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23875 UpdateFulfillHTLC_free(this_obj_conv);
23878 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
23879 LDKUpdateFulfillHTLC this_ptr_conv;
23880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23881 this_ptr_conv.is_owned = false;
23882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23883 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23884 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
23888 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23889 LDKUpdateFulfillHTLC this_ptr_conv;
23890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23891 this_ptr_conv.is_owned = false;
23892 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23893 LDKThirtyTwoBytes val_ref;
23894 CHECK(*((uint32_t*)val) == 32);
23895 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23896 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
23899 int64_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
23900 LDKUpdateFulfillHTLC this_ptr_conv;
23901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23902 this_ptr_conv.is_owned = false;
23903 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23904 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
23908 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
23909 LDKUpdateFulfillHTLC this_ptr_conv;
23910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23911 this_ptr_conv.is_owned = false;
23912 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23913 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
23916 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
23917 LDKUpdateFulfillHTLC this_ptr_conv;
23918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23919 this_ptr_conv.is_owned = false;
23920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23921 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23922 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
23926 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
23927 LDKUpdateFulfillHTLC this_ptr_conv;
23928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23929 this_ptr_conv.is_owned = false;
23930 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23931 LDKThirtyTwoBytes val_ref;
23932 CHECK(*((uint32_t*)val) == 32);
23933 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23934 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
23937 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
23938 LDKThirtyTwoBytes channel_id_arg_ref;
23939 CHECK(*((uint32_t*)channel_id_arg) == 32);
23940 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
23941 LDKThirtyTwoBytes payment_preimage_arg_ref;
23942 CHECK(*((uint32_t*)payment_preimage_arg) == 32);
23943 memcpy(payment_preimage_arg_ref.data, (uint8_t*)(payment_preimage_arg + 4), 32);
23944 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
23945 uint64_t ret_ref = 0;
23946 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23947 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23948 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23949 ret_ref = (uint64_t)ret_var.inner;
23950 if (ret_var.is_owned) {
23956 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
23957 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
23958 uint64_t ret_ref = 0;
23959 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23960 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23961 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23962 ret_ref = (uint64_t)ret_var.inner;
23963 if (ret_var.is_owned) {
23968 int64_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_clone_ptr(uint32_t arg) {
23969 LDKUpdateFulfillHTLC arg_conv;
23970 arg_conv.inner = (void*)(arg & (~1));
23971 arg_conv.is_owned = false;
23972 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23973 int64_t ret_val = UpdateFulfillHTLC_clone_ptr(&arg_conv);
23977 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
23978 LDKUpdateFulfillHTLC orig_conv;
23979 orig_conv.inner = (void*)(orig & (~1));
23980 orig_conv.is_owned = false;
23981 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23982 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
23983 uint64_t ret_ref = 0;
23984 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23985 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23986 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23987 ret_ref = (uint64_t)ret_var.inner;
23988 if (ret_var.is_owned) {
23994 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_free(uint32_t this_obj) {
23995 LDKUpdateFailHTLC this_obj_conv;
23996 this_obj_conv.inner = (void*)(this_obj & (~1));
23997 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23999 UpdateFailHTLC_free(this_obj_conv);
24002 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
24003 LDKUpdateFailHTLC this_ptr_conv;
24004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24005 this_ptr_conv.is_owned = false;
24006 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24007 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24008 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
24012 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24013 LDKUpdateFailHTLC this_ptr_conv;
24014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24015 this_ptr_conv.is_owned = false;
24016 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24017 LDKThirtyTwoBytes val_ref;
24018 CHECK(*((uint32_t*)val) == 32);
24019 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24020 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
24023 int64_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
24024 LDKUpdateFailHTLC this_ptr_conv;
24025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24026 this_ptr_conv.is_owned = false;
24027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24028 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
24032 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
24033 LDKUpdateFailHTLC this_ptr_conv;
24034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24035 this_ptr_conv.is_owned = false;
24036 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24037 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
24040 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
24041 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
24042 uint64_t ret_ref = 0;
24043 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24044 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24045 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24046 ret_ref = (uint64_t)ret_var.inner;
24047 if (ret_var.is_owned) {
24052 int64_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_clone_ptr(uint32_t arg) {
24053 LDKUpdateFailHTLC arg_conv;
24054 arg_conv.inner = (void*)(arg & (~1));
24055 arg_conv.is_owned = false;
24056 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24057 int64_t ret_val = UpdateFailHTLC_clone_ptr(&arg_conv);
24061 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
24062 LDKUpdateFailHTLC orig_conv;
24063 orig_conv.inner = (void*)(orig & (~1));
24064 orig_conv.is_owned = false;
24065 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24066 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
24067 uint64_t ret_ref = 0;
24068 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24069 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24070 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24071 ret_ref = (uint64_t)ret_var.inner;
24072 if (ret_var.is_owned) {
24078 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_obj) {
24079 LDKUpdateFailMalformedHTLC this_obj_conv;
24080 this_obj_conv.inner = (void*)(this_obj & (~1));
24081 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24082 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24083 UpdateFailMalformedHTLC_free(this_obj_conv);
24086 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
24087 LDKUpdateFailMalformedHTLC this_ptr_conv;
24088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24089 this_ptr_conv.is_owned = false;
24090 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24091 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24092 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
24096 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24097 LDKUpdateFailMalformedHTLC 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 LDKThirtyTwoBytes val_ref;
24102 CHECK(*((uint32_t*)val) == 32);
24103 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24104 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
24107 int64_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
24108 LDKUpdateFailMalformedHTLC this_ptr_conv;
24109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24110 this_ptr_conv.is_owned = false;
24111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24112 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
24116 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
24117 LDKUpdateFailMalformedHTLC this_ptr_conv;
24118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24119 this_ptr_conv.is_owned = false;
24120 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24121 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
24124 int16_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
24125 LDKUpdateFailMalformedHTLC this_ptr_conv;
24126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24127 this_ptr_conv.is_owned = false;
24128 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24129 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
24133 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
24134 LDKUpdateFailMalformedHTLC this_ptr_conv;
24135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24136 this_ptr_conv.is_owned = false;
24137 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24138 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
24141 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
24142 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
24143 uint64_t ret_ref = 0;
24144 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24145 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24146 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24147 ret_ref = (uint64_t)ret_var.inner;
24148 if (ret_var.is_owned) {
24153 int64_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint32_t arg) {
24154 LDKUpdateFailMalformedHTLC arg_conv;
24155 arg_conv.inner = (void*)(arg & (~1));
24156 arg_conv.is_owned = false;
24157 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24158 int64_t ret_val = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
24162 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
24163 LDKUpdateFailMalformedHTLC orig_conv;
24164 orig_conv.inner = (void*)(orig & (~1));
24165 orig_conv.is_owned = false;
24166 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24167 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
24168 uint64_t ret_ref = 0;
24169 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24170 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24171 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24172 ret_ref = (uint64_t)ret_var.inner;
24173 if (ret_var.is_owned) {
24179 void __attribute__((visibility("default"))) TS_CommitmentSigned_free(uint32_t this_obj) {
24180 LDKCommitmentSigned this_obj_conv;
24181 this_obj_conv.inner = (void*)(this_obj & (~1));
24182 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24183 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24184 CommitmentSigned_free(this_obj_conv);
24187 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
24188 LDKCommitmentSigned this_ptr_conv;
24189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24190 this_ptr_conv.is_owned = false;
24191 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24192 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24193 memcpy((uint8_t*)(ret_arr + 4), *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
24197 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24198 LDKCommitmentSigned this_ptr_conv;
24199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24200 this_ptr_conv.is_owned = false;
24201 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24202 LDKThirtyTwoBytes val_ref;
24203 CHECK(*((uint32_t*)val) == 32);
24204 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24205 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
24208 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
24209 LDKCommitmentSigned this_ptr_conv;
24210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24211 this_ptr_conv.is_owned = false;
24212 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24213 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
24214 memcpy((uint8_t*)(ret_arr + 4), CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
24218 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
24219 LDKCommitmentSigned this_ptr_conv;
24220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24221 this_ptr_conv.is_owned = false;
24222 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24223 LDKSignature val_ref;
24224 CHECK(*((uint32_t*)val) == 64);
24225 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
24226 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
24229 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
24230 LDKCommitmentSigned this_ptr_conv;
24231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24232 this_ptr_conv.is_owned = false;
24233 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24234 LDKCVec_SignatureZ val_constr;
24235 val_constr.datalen = *((uint32_t*)val);
24236 if (val_constr.datalen > 0)
24237 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
24239 val_constr.data = NULL;
24240 int8_tArray* val_vals = (int8_tArray*)(val + 4);
24241 for (size_t m = 0; m < val_constr.datalen; m++) {
24242 int8_tArray val_conv_12 = val_vals[m];
24243 LDKSignature val_conv_12_ref;
24244 CHECK(*((uint32_t*)val_conv_12) == 64);
24245 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
24246 val_constr.data[m] = val_conv_12_ref;
24248 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
24251 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
24252 LDKThirtyTwoBytes channel_id_arg_ref;
24253 CHECK(*((uint32_t*)channel_id_arg) == 32);
24254 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
24255 LDKSignature signature_arg_ref;
24256 CHECK(*((uint32_t*)signature_arg) == 64);
24257 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
24258 LDKCVec_SignatureZ htlc_signatures_arg_constr;
24259 htlc_signatures_arg_constr.datalen = *((uint32_t*)htlc_signatures_arg);
24260 if (htlc_signatures_arg_constr.datalen > 0)
24261 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
24263 htlc_signatures_arg_constr.data = NULL;
24264 int8_tArray* htlc_signatures_arg_vals = (int8_tArray*)(htlc_signatures_arg + 4);
24265 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
24266 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
24267 LDKSignature htlc_signatures_arg_conv_12_ref;
24268 CHECK(*((uint32_t*)htlc_signatures_arg_conv_12) == 64);
24269 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, (uint8_t*)(htlc_signatures_arg_conv_12 + 4), 64);
24270 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
24272 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
24273 uint64_t ret_ref = 0;
24274 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24275 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24276 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24277 ret_ref = (uint64_t)ret_var.inner;
24278 if (ret_var.is_owned) {
24284 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
24285 LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
24286 uint64_t ret_ref = 0;
24287 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24288 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24289 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24290 ret_ref = (uint64_t)ret_var.inner;
24291 if (ret_var.is_owned) {
24296 int64_t __attribute__((visibility("default"))) TS_CommitmentSigned_clone_ptr(uint32_t arg) {
24297 LDKCommitmentSigned arg_conv;
24298 arg_conv.inner = (void*)(arg & (~1));
24299 arg_conv.is_owned = false;
24300 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24301 int64_t ret_val = CommitmentSigned_clone_ptr(&arg_conv);
24305 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_clone(uint32_t orig) {
24306 LDKCommitmentSigned orig_conv;
24307 orig_conv.inner = (void*)(orig & (~1));
24308 orig_conv.is_owned = false;
24309 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24310 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
24311 uint64_t ret_ref = 0;
24312 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24313 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24314 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24315 ret_ref = (uint64_t)ret_var.inner;
24316 if (ret_var.is_owned) {
24322 void __attribute__((visibility("default"))) TS_RevokeAndACK_free(uint32_t this_obj) {
24323 LDKRevokeAndACK this_obj_conv;
24324 this_obj_conv.inner = (void*)(this_obj & (~1));
24325 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24326 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24327 RevokeAndACK_free(this_obj_conv);
24330 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
24331 LDKRevokeAndACK this_ptr_conv;
24332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24333 this_ptr_conv.is_owned = false;
24334 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24335 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24336 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
24340 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24341 LDKRevokeAndACK this_ptr_conv;
24342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24343 this_ptr_conv.is_owned = false;
24344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24345 LDKThirtyTwoBytes val_ref;
24346 CHECK(*((uint32_t*)val) == 32);
24347 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24348 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
24351 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
24352 LDKRevokeAndACK this_ptr_conv;
24353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24354 this_ptr_conv.is_owned = false;
24355 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24356 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24357 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
24361 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
24362 LDKRevokeAndACK this_ptr_conv;
24363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24364 this_ptr_conv.is_owned = false;
24365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24366 LDKThirtyTwoBytes val_ref;
24367 CHECK(*((uint32_t*)val) == 32);
24368 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24369 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
24372 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
24373 LDKRevokeAndACK this_ptr_conv;
24374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24375 this_ptr_conv.is_owned = false;
24376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24377 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
24378 memcpy((uint8_t*)(ret_arr + 4), RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
24382 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
24383 LDKRevokeAndACK this_ptr_conv;
24384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24385 this_ptr_conv.is_owned = false;
24386 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24387 LDKPublicKey val_ref;
24388 CHECK(*((uint32_t*)val) == 33);
24389 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
24390 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
24393 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) {
24394 LDKThirtyTwoBytes channel_id_arg_ref;
24395 CHECK(*((uint32_t*)channel_id_arg) == 32);
24396 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
24397 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
24398 CHECK(*((uint32_t*)per_commitment_secret_arg) == 32);
24399 memcpy(per_commitment_secret_arg_ref.data, (uint8_t*)(per_commitment_secret_arg + 4), 32);
24400 LDKPublicKey next_per_commitment_point_arg_ref;
24401 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
24402 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
24403 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
24404 uint64_t ret_ref = 0;
24405 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24406 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24407 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24408 ret_ref = (uint64_t)ret_var.inner;
24409 if (ret_var.is_owned) {
24415 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
24416 LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
24417 uint64_t ret_ref = 0;
24418 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24419 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24420 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24421 ret_ref = (uint64_t)ret_var.inner;
24422 if (ret_var.is_owned) {
24427 int64_t __attribute__((visibility("default"))) TS_RevokeAndACK_clone_ptr(uint32_t arg) {
24428 LDKRevokeAndACK arg_conv;
24429 arg_conv.inner = (void*)(arg & (~1));
24430 arg_conv.is_owned = false;
24431 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24432 int64_t ret_val = RevokeAndACK_clone_ptr(&arg_conv);
24436 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_clone(uint32_t orig) {
24437 LDKRevokeAndACK orig_conv;
24438 orig_conv.inner = (void*)(orig & (~1));
24439 orig_conv.is_owned = false;
24440 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24441 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
24442 uint64_t ret_ref = 0;
24443 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24444 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24445 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24446 ret_ref = (uint64_t)ret_var.inner;
24447 if (ret_var.is_owned) {
24453 void __attribute__((visibility("default"))) TS_UpdateFee_free(uint32_t this_obj) {
24454 LDKUpdateFee this_obj_conv;
24455 this_obj_conv.inner = (void*)(this_obj & (~1));
24456 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24457 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24458 UpdateFee_free(this_obj_conv);
24461 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
24462 LDKUpdateFee this_ptr_conv;
24463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24464 this_ptr_conv.is_owned = false;
24465 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24466 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24467 memcpy((uint8_t*)(ret_arr + 4), *UpdateFee_get_channel_id(&this_ptr_conv), 32);
24471 void __attribute__((visibility("default"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24472 LDKUpdateFee this_ptr_conv;
24473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24474 this_ptr_conv.is_owned = false;
24475 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24476 LDKThirtyTwoBytes val_ref;
24477 CHECK(*((uint32_t*)val) == 32);
24478 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24479 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
24482 int32_t __attribute__((visibility("default"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
24483 LDKUpdateFee this_ptr_conv;
24484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24485 this_ptr_conv.is_owned = false;
24486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24487 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
24491 void __attribute__((visibility("default"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
24492 LDKUpdateFee this_ptr_conv;
24493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24494 this_ptr_conv.is_owned = false;
24495 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24496 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
24499 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
24500 LDKThirtyTwoBytes channel_id_arg_ref;
24501 CHECK(*((uint32_t*)channel_id_arg) == 32);
24502 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
24503 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
24504 uint64_t ret_ref = 0;
24505 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24506 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24507 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24508 ret_ref = (uint64_t)ret_var.inner;
24509 if (ret_var.is_owned) {
24515 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
24516 LDKUpdateFee ret_var = UpdateFee_clone(arg);
24517 uint64_t ret_ref = 0;
24518 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24519 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24520 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24521 ret_ref = (uint64_t)ret_var.inner;
24522 if (ret_var.is_owned) {
24527 int64_t __attribute__((visibility("default"))) TS_UpdateFee_clone_ptr(uint32_t arg) {
24528 LDKUpdateFee arg_conv;
24529 arg_conv.inner = (void*)(arg & (~1));
24530 arg_conv.is_owned = false;
24531 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24532 int64_t ret_val = UpdateFee_clone_ptr(&arg_conv);
24536 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_clone(uint32_t orig) {
24537 LDKUpdateFee orig_conv;
24538 orig_conv.inner = (void*)(orig & (~1));
24539 orig_conv.is_owned = false;
24540 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24541 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
24542 uint64_t ret_ref = 0;
24543 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24544 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24545 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24546 ret_ref = (uint64_t)ret_var.inner;
24547 if (ret_var.is_owned) {
24553 void __attribute__((visibility("default"))) TS_DataLossProtect_free(uint32_t this_obj) {
24554 LDKDataLossProtect this_obj_conv;
24555 this_obj_conv.inner = (void*)(this_obj & (~1));
24556 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24557 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24558 DataLossProtect_free(this_obj_conv);
24561 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_your_last_per_commitment_secret(uint32_t this_ptr) {
24562 LDKDataLossProtect this_ptr_conv;
24563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24564 this_ptr_conv.is_owned = false;
24565 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24566 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24567 memcpy((uint8_t*)(ret_arr + 4), *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
24571 void __attribute__((visibility("default"))) TS_DataLossProtect_set_your_last_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
24572 LDKDataLossProtect this_ptr_conv;
24573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24574 this_ptr_conv.is_owned = false;
24575 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24576 LDKThirtyTwoBytes val_ref;
24577 CHECK(*((uint32_t*)val) == 32);
24578 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24579 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
24582 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_my_current_per_commitment_point(uint32_t this_ptr) {
24583 LDKDataLossProtect this_ptr_conv;
24584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24585 this_ptr_conv.is_owned = false;
24586 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24587 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
24588 memcpy((uint8_t*)(ret_arr + 4), DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
24592 void __attribute__((visibility("default"))) TS_DataLossProtect_set_my_current_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
24593 LDKDataLossProtect this_ptr_conv;
24594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24595 this_ptr_conv.is_owned = false;
24596 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24597 LDKPublicKey val_ref;
24598 CHECK(*((uint32_t*)val) == 33);
24599 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
24600 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
24603 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_new(int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
24604 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
24605 CHECK(*((uint32_t*)your_last_per_commitment_secret_arg) == 32);
24606 memcpy(your_last_per_commitment_secret_arg_ref.data, (uint8_t*)(your_last_per_commitment_secret_arg + 4), 32);
24607 LDKPublicKey my_current_per_commitment_point_arg_ref;
24608 CHECK(*((uint32_t*)my_current_per_commitment_point_arg) == 33);
24609 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(my_current_per_commitment_point_arg + 4), 33);
24610 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
24611 uint64_t ret_ref = 0;
24612 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24613 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24614 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24615 ret_ref = (uint64_t)ret_var.inner;
24616 if (ret_var.is_owned) {
24622 static inline uint64_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
24623 LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
24624 uint64_t ret_ref = 0;
24625 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24626 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24627 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24628 ret_ref = (uint64_t)ret_var.inner;
24629 if (ret_var.is_owned) {
24634 int64_t __attribute__((visibility("default"))) TS_DataLossProtect_clone_ptr(uint32_t arg) {
24635 LDKDataLossProtect arg_conv;
24636 arg_conv.inner = (void*)(arg & (~1));
24637 arg_conv.is_owned = false;
24638 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24639 int64_t ret_val = DataLossProtect_clone_ptr(&arg_conv);
24643 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_clone(uint32_t orig) {
24644 LDKDataLossProtect orig_conv;
24645 orig_conv.inner = (void*)(orig & (~1));
24646 orig_conv.is_owned = false;
24647 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24648 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
24649 uint64_t ret_ref = 0;
24650 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24651 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24652 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24653 ret_ref = (uint64_t)ret_var.inner;
24654 if (ret_var.is_owned) {
24660 void __attribute__((visibility("default"))) TS_ChannelReestablish_free(uint32_t this_obj) {
24661 LDKChannelReestablish this_obj_conv;
24662 this_obj_conv.inner = (void*)(this_obj & (~1));
24663 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24664 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24665 ChannelReestablish_free(this_obj_conv);
24668 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
24669 LDKChannelReestablish this_ptr_conv;
24670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24671 this_ptr_conv.is_owned = false;
24672 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24673 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24674 memcpy((uint8_t*)(ret_arr + 4), *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
24678 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24679 LDKChannelReestablish this_ptr_conv;
24680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24681 this_ptr_conv.is_owned = false;
24682 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24683 LDKThirtyTwoBytes val_ref;
24684 CHECK(*((uint32_t*)val) == 32);
24685 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24686 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
24689 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
24690 LDKChannelReestablish this_ptr_conv;
24691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24692 this_ptr_conv.is_owned = false;
24693 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24694 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
24698 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_local_commitment_number(uint32_t this_ptr, int64_t val) {
24699 LDKChannelReestablish this_ptr_conv;
24700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24701 this_ptr_conv.is_owned = false;
24702 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24703 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
24706 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
24707 LDKChannelReestablish this_ptr_conv;
24708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24709 this_ptr_conv.is_owned = false;
24710 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24711 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
24715 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_remote_commitment_number(uint32_t this_ptr, int64_t val) {
24716 LDKChannelReestablish this_ptr_conv;
24717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24718 this_ptr_conv.is_owned = false;
24719 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24720 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
24723 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
24724 LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
24725 uint64_t ret_ref = 0;
24726 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24727 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24728 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24729 ret_ref = (uint64_t)ret_var.inner;
24730 if (ret_var.is_owned) {
24735 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_clone_ptr(uint32_t arg) {
24736 LDKChannelReestablish arg_conv;
24737 arg_conv.inner = (void*)(arg & (~1));
24738 arg_conv.is_owned = false;
24739 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24740 int64_t ret_val = ChannelReestablish_clone_ptr(&arg_conv);
24744 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_clone(uint32_t orig) {
24745 LDKChannelReestablish orig_conv;
24746 orig_conv.inner = (void*)(orig & (~1));
24747 orig_conv.is_owned = false;
24748 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24749 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
24750 uint64_t ret_ref = 0;
24751 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24752 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24753 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24754 ret_ref = (uint64_t)ret_var.inner;
24755 if (ret_var.is_owned) {
24761 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_free(uint32_t this_obj) {
24762 LDKAnnouncementSignatures this_obj_conv;
24763 this_obj_conv.inner = (void*)(this_obj & (~1));
24764 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24765 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24766 AnnouncementSignatures_free(this_obj_conv);
24769 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
24770 LDKAnnouncementSignatures this_ptr_conv;
24771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24772 this_ptr_conv.is_owned = false;
24773 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24774 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24775 memcpy((uint8_t*)(ret_arr + 4), *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
24779 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24780 LDKAnnouncementSignatures this_ptr_conv;
24781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24782 this_ptr_conv.is_owned = false;
24783 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24784 LDKThirtyTwoBytes val_ref;
24785 CHECK(*((uint32_t*)val) == 32);
24786 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24787 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
24790 int64_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
24791 LDKAnnouncementSignatures this_ptr_conv;
24792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24793 this_ptr_conv.is_owned = false;
24794 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24795 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
24799 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
24800 LDKAnnouncementSignatures this_ptr_conv;
24801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24802 this_ptr_conv.is_owned = false;
24803 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24804 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
24807 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
24808 LDKAnnouncementSignatures this_ptr_conv;
24809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24810 this_ptr_conv.is_owned = false;
24811 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24812 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
24813 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
24817 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
24818 LDKAnnouncementSignatures this_ptr_conv;
24819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24820 this_ptr_conv.is_owned = false;
24821 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24822 LDKSignature val_ref;
24823 CHECK(*((uint32_t*)val) == 64);
24824 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
24825 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
24828 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
24829 LDKAnnouncementSignatures this_ptr_conv;
24830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24831 this_ptr_conv.is_owned = false;
24832 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24833 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
24834 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
24838 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
24839 LDKAnnouncementSignatures this_ptr_conv;
24840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24841 this_ptr_conv.is_owned = false;
24842 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24843 LDKSignature val_ref;
24844 CHECK(*((uint32_t*)val) == 64);
24845 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
24846 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
24849 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) {
24850 LDKThirtyTwoBytes channel_id_arg_ref;
24851 CHECK(*((uint32_t*)channel_id_arg) == 32);
24852 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
24853 LDKSignature node_signature_arg_ref;
24854 CHECK(*((uint32_t*)node_signature_arg) == 64);
24855 memcpy(node_signature_arg_ref.compact_form, (uint8_t*)(node_signature_arg + 4), 64);
24856 LDKSignature bitcoin_signature_arg_ref;
24857 CHECK(*((uint32_t*)bitcoin_signature_arg) == 64);
24858 memcpy(bitcoin_signature_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_arg + 4), 64);
24859 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
24860 uint64_t ret_ref = 0;
24861 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24862 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24863 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24864 ret_ref = (uint64_t)ret_var.inner;
24865 if (ret_var.is_owned) {
24871 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
24872 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
24873 uint64_t ret_ref = 0;
24874 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24875 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24876 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24877 ret_ref = (uint64_t)ret_var.inner;
24878 if (ret_var.is_owned) {
24883 int64_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_clone_ptr(uint32_t arg) {
24884 LDKAnnouncementSignatures arg_conv;
24885 arg_conv.inner = (void*)(arg & (~1));
24886 arg_conv.is_owned = false;
24887 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24888 int64_t ret_val = AnnouncementSignatures_clone_ptr(&arg_conv);
24892 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
24893 LDKAnnouncementSignatures orig_conv;
24894 orig_conv.inner = (void*)(orig & (~1));
24895 orig_conv.is_owned = false;
24896 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24897 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
24898 uint64_t ret_ref = 0;
24899 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24900 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24901 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24902 ret_ref = (uint64_t)ret_var.inner;
24903 if (ret_var.is_owned) {
24909 void __attribute__((visibility("default"))) TS_NetAddress_free(uint32_t this_ptr) {
24910 if ((this_ptr & 1) != 0) return;
24911 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
24912 CHECK_ACCESS(this_ptr_ptr);
24913 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
24914 FREE((void*)this_ptr);
24915 NetAddress_free(this_ptr_conv);
24918 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
24919 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
24920 *ret_copy = NetAddress_clone(arg);
24921 uint64_t ret_ref = (uint64_t)ret_copy;
24924 int64_t __attribute__((visibility("default"))) TS_NetAddress_clone_ptr(uint32_t arg) {
24925 LDKNetAddress* arg_conv = (LDKNetAddress*)arg;
24926 int64_t ret_val = NetAddress_clone_ptr(arg_conv);
24930 uint32_t __attribute__((visibility("default"))) TS_NetAddress_clone(uint32_t orig) {
24931 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
24932 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
24933 *ret_copy = NetAddress_clone(orig_conv);
24934 uint64_t ret_ref = (uint64_t)ret_copy;
24938 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
24939 LDKFourBytes addr_ref;
24940 CHECK(*((uint32_t*)addr) == 4);
24941 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 4);
24942 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
24943 *ret_copy = NetAddress_ipv4(addr_ref, port);
24944 uint64_t ret_ref = (uint64_t)ret_copy;
24948 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
24949 LDKSixteenBytes addr_ref;
24950 CHECK(*((uint32_t*)addr) == 16);
24951 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 16);
24952 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
24953 *ret_copy = NetAddress_ipv6(addr_ref, port);
24954 uint64_t ret_ref = (uint64_t)ret_copy;
24958 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v2(int8_tArray addr, int16_t port) {
24959 LDKTenBytes addr_ref;
24960 CHECK(*((uint32_t*)addr) == 10);
24961 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 10);
24962 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
24963 *ret_copy = NetAddress_onion_v2(addr_ref, port);
24964 uint64_t ret_ref = (uint64_t)ret_copy;
24968 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v3(int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
24969 LDKThirtyTwoBytes ed25519_pubkey_ref;
24970 CHECK(*((uint32_t*)ed25519_pubkey) == 32);
24971 memcpy(ed25519_pubkey_ref.data, (uint8_t*)(ed25519_pubkey + 4), 32);
24972 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
24973 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
24974 uint64_t ret_ref = (uint64_t)ret_copy;
24978 int8_tArray __attribute__((visibility("default"))) TS_NetAddress_write(uint32_t obj) {
24979 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
24980 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
24981 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24982 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24983 CVec_u8Z_free(ret_var);
24987 uint32_t __attribute__((visibility("default"))) TS_NetAddress_read(int8_tArray ser) {
24988 LDKu8slice ser_ref;
24989 ser_ref.datalen = *((uint32_t*)ser);
24990 ser_ref.data = (int8_t*)(ser + 4);
24991 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
24992 *ret_conv = NetAddress_read(ser_ref);
24993 return (uint64_t)ret_conv;
24996 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_obj) {
24997 LDKUnsignedNodeAnnouncement this_obj_conv;
24998 this_obj_conv.inner = (void*)(this_obj & (~1));
24999 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25000 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25001 UnsignedNodeAnnouncement_free(this_obj_conv);
25004 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
25005 LDKUnsignedNodeAnnouncement this_ptr_conv;
25006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25007 this_ptr_conv.is_owned = false;
25008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25009 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
25010 uint64_t ret_ref = 0;
25011 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25012 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25013 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25014 ret_ref = (uint64_t)ret_var.inner;
25015 if (ret_var.is_owned) {
25021 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
25022 LDKUnsignedNodeAnnouncement this_ptr_conv;
25023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25024 this_ptr_conv.is_owned = false;
25025 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25026 LDKNodeFeatures val_conv;
25027 val_conv.inner = (void*)(val & (~1));
25028 val_conv.is_owned = (val & 1) || (val == 0);
25029 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25030 val_conv = NodeFeatures_clone(&val_conv);
25031 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
25034 int32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
25035 LDKUnsignedNodeAnnouncement this_ptr_conv;
25036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25037 this_ptr_conv.is_owned = false;
25038 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25039 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
25043 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
25044 LDKUnsignedNodeAnnouncement this_ptr_conv;
25045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25046 this_ptr_conv.is_owned = false;
25047 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25048 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
25051 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
25052 LDKUnsignedNodeAnnouncement this_ptr_conv;
25053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25054 this_ptr_conv.is_owned = false;
25055 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25056 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
25057 memcpy((uint8_t*)(ret_arr + 4), UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
25061 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
25062 LDKUnsignedNodeAnnouncement this_ptr_conv;
25063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25064 this_ptr_conv.is_owned = false;
25065 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25066 LDKPublicKey val_ref;
25067 CHECK(*((uint32_t*)val) == 33);
25068 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
25069 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
25072 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
25073 LDKUnsignedNodeAnnouncement 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(3, sizeof(uint8_t), "Native int8_tArray Bytes");
25078 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
25082 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
25083 LDKUnsignedNodeAnnouncement 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 LDKThreeBytes val_ref;
25088 CHECK(*((uint32_t*)val) == 3);
25089 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
25090 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
25093 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
25094 LDKUnsignedNodeAnnouncement 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 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
25099 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
25103 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
25104 LDKUnsignedNodeAnnouncement this_ptr_conv;
25105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25106 this_ptr_conv.is_owned = false;
25107 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25108 LDKThirtyTwoBytes val_ref;
25109 CHECK(*((uint32_t*)val) == 32);
25110 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
25111 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
25114 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
25115 LDKUnsignedNodeAnnouncement this_ptr_conv;
25116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25117 this_ptr_conv.is_owned = false;
25118 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25119 LDKCVec_NetAddressZ val_constr;
25120 val_constr.datalen = *((uint32_t*)val);
25121 if (val_constr.datalen > 0)
25122 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
25124 val_constr.data = NULL;
25125 uint32_t* val_vals = (uint32_t*)(val + 4);
25126 for (size_t m = 0; m < val_constr.datalen; m++) {
25127 uint32_t val_conv_12 = val_vals[m];
25128 void* val_conv_12_ptr = (void*)(((uint64_t)val_conv_12) & ~1);
25129 CHECK_ACCESS(val_conv_12_ptr);
25130 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
25131 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
25132 val_constr.data[m] = val_conv_12_conv;
25134 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
25137 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
25138 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
25139 uint64_t ret_ref = 0;
25140 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25141 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25142 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25143 ret_ref = (uint64_t)ret_var.inner;
25144 if (ret_var.is_owned) {
25149 int64_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint32_t arg) {
25150 LDKUnsignedNodeAnnouncement arg_conv;
25151 arg_conv.inner = (void*)(arg & (~1));
25152 arg_conv.is_owned = false;
25153 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25154 int64_t ret_val = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
25158 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
25159 LDKUnsignedNodeAnnouncement orig_conv;
25160 orig_conv.inner = (void*)(orig & (~1));
25161 orig_conv.is_owned = false;
25162 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25163 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
25164 uint64_t ret_ref = 0;
25165 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25166 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25167 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25168 ret_ref = (uint64_t)ret_var.inner;
25169 if (ret_var.is_owned) {
25175 void __attribute__((visibility("default"))) TS_NodeAnnouncement_free(uint32_t this_obj) {
25176 LDKNodeAnnouncement this_obj_conv;
25177 this_obj_conv.inner = (void*)(this_obj & (~1));
25178 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25180 NodeAnnouncement_free(this_obj_conv);
25183 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
25184 LDKNodeAnnouncement this_ptr_conv;
25185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25186 this_ptr_conv.is_owned = false;
25187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25188 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
25189 memcpy((uint8_t*)(ret_arr + 4), NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
25193 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
25194 LDKNodeAnnouncement 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 LDKSignature val_ref;
25199 CHECK(*((uint32_t*)val) == 64);
25200 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
25201 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
25204 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
25205 LDKNodeAnnouncement this_ptr_conv;
25206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25207 this_ptr_conv.is_owned = false;
25208 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25209 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
25210 uint64_t ret_ref = 0;
25211 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25212 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25213 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25214 ret_ref = (uint64_t)ret_var.inner;
25215 if (ret_var.is_owned) {
25221 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
25222 LDKNodeAnnouncement this_ptr_conv;
25223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25224 this_ptr_conv.is_owned = false;
25225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25226 LDKUnsignedNodeAnnouncement val_conv;
25227 val_conv.inner = (void*)(val & (~1));
25228 val_conv.is_owned = (val & 1) || (val == 0);
25229 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25230 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
25231 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
25234 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
25235 LDKSignature signature_arg_ref;
25236 CHECK(*((uint32_t*)signature_arg) == 64);
25237 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
25238 LDKUnsignedNodeAnnouncement contents_arg_conv;
25239 contents_arg_conv.inner = (void*)(contents_arg & (~1));
25240 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
25241 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
25242 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
25243 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
25244 uint64_t ret_ref = 0;
25245 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25246 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25247 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25248 ret_ref = (uint64_t)ret_var.inner;
25249 if (ret_var.is_owned) {
25255 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
25256 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
25257 uint64_t ret_ref = 0;
25258 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25259 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25260 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25261 ret_ref = (uint64_t)ret_var.inner;
25262 if (ret_var.is_owned) {
25267 int64_t __attribute__((visibility("default"))) TS_NodeAnnouncement_clone_ptr(uint32_t arg) {
25268 LDKNodeAnnouncement arg_conv;
25269 arg_conv.inner = (void*)(arg & (~1));
25270 arg_conv.is_owned = false;
25271 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25272 int64_t ret_val = NodeAnnouncement_clone_ptr(&arg_conv);
25276 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_clone(uint32_t orig) {
25277 LDKNodeAnnouncement orig_conv;
25278 orig_conv.inner = (void*)(orig & (~1));
25279 orig_conv.is_owned = false;
25280 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25281 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
25282 uint64_t ret_ref = 0;
25283 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25284 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25285 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25286 ret_ref = (uint64_t)ret_var.inner;
25287 if (ret_var.is_owned) {
25293 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_obj) {
25294 LDKUnsignedChannelAnnouncement this_obj_conv;
25295 this_obj_conv.inner = (void*)(this_obj & (~1));
25296 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25297 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25298 UnsignedChannelAnnouncement_free(this_obj_conv);
25301 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
25302 LDKUnsignedChannelAnnouncement this_ptr_conv;
25303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25304 this_ptr_conv.is_owned = false;
25305 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25306 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
25307 uint64_t ret_ref = 0;
25308 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25309 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25310 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25311 ret_ref = (uint64_t)ret_var.inner;
25312 if (ret_var.is_owned) {
25318 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
25319 LDKUnsignedChannelAnnouncement this_ptr_conv;
25320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25321 this_ptr_conv.is_owned = false;
25322 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25323 LDKChannelFeatures val_conv;
25324 val_conv.inner = (void*)(val & (~1));
25325 val_conv.is_owned = (val & 1) || (val == 0);
25326 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25327 val_conv = ChannelFeatures_clone(&val_conv);
25328 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
25331 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
25332 LDKUnsignedChannelAnnouncement this_ptr_conv;
25333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25334 this_ptr_conv.is_owned = false;
25335 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25336 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
25337 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
25341 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
25342 LDKUnsignedChannelAnnouncement this_ptr_conv;
25343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25344 this_ptr_conv.is_owned = false;
25345 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25346 LDKThirtyTwoBytes val_ref;
25347 CHECK(*((uint32_t*)val) == 32);
25348 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
25349 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
25352 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
25353 LDKUnsignedChannelAnnouncement this_ptr_conv;
25354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25355 this_ptr_conv.is_owned = false;
25356 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25357 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
25361 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
25362 LDKUnsignedChannelAnnouncement this_ptr_conv;
25363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25364 this_ptr_conv.is_owned = false;
25365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25366 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
25369 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
25370 LDKUnsignedChannelAnnouncement this_ptr_conv;
25371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25372 this_ptr_conv.is_owned = false;
25373 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25374 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
25375 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
25379 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
25380 LDKUnsignedChannelAnnouncement this_ptr_conv;
25381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25382 this_ptr_conv.is_owned = false;
25383 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25384 LDKPublicKey val_ref;
25385 CHECK(*((uint32_t*)val) == 33);
25386 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
25387 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
25390 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
25391 LDKUnsignedChannelAnnouncement 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 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
25396 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
25400 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
25401 LDKUnsignedChannelAnnouncement this_ptr_conv;
25402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25403 this_ptr_conv.is_owned = false;
25404 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25405 LDKPublicKey val_ref;
25406 CHECK(*((uint32_t*)val) == 33);
25407 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
25408 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
25411 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
25412 LDKUnsignedChannelAnnouncement this_ptr_conv;
25413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25414 this_ptr_conv.is_owned = false;
25415 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25416 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
25417 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
25421 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
25422 LDKUnsignedChannelAnnouncement this_ptr_conv;
25423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25424 this_ptr_conv.is_owned = false;
25425 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25426 LDKPublicKey val_ref;
25427 CHECK(*((uint32_t*)val) == 33);
25428 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
25429 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
25432 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
25433 LDKUnsignedChannelAnnouncement this_ptr_conv;
25434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25435 this_ptr_conv.is_owned = false;
25436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25437 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
25438 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
25442 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
25443 LDKUnsignedChannelAnnouncement this_ptr_conv;
25444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25445 this_ptr_conv.is_owned = false;
25446 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25447 LDKPublicKey val_ref;
25448 CHECK(*((uint32_t*)val) == 33);
25449 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
25450 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
25453 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
25454 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
25455 uint64_t ret_ref = 0;
25456 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25457 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25458 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25459 ret_ref = (uint64_t)ret_var.inner;
25460 if (ret_var.is_owned) {
25465 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint32_t arg) {
25466 LDKUnsignedChannelAnnouncement arg_conv;
25467 arg_conv.inner = (void*)(arg & (~1));
25468 arg_conv.is_owned = false;
25469 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25470 int64_t ret_val = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
25474 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
25475 LDKUnsignedChannelAnnouncement orig_conv;
25476 orig_conv.inner = (void*)(orig & (~1));
25477 orig_conv.is_owned = false;
25478 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25479 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
25480 uint64_t ret_ref = 0;
25481 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25482 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25483 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25484 ret_ref = (uint64_t)ret_var.inner;
25485 if (ret_var.is_owned) {
25491 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_free(uint32_t this_obj) {
25492 LDKChannelAnnouncement this_obj_conv;
25493 this_obj_conv.inner = (void*)(this_obj & (~1));
25494 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25495 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25496 ChannelAnnouncement_free(this_obj_conv);
25499 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
25500 LDKChannelAnnouncement this_ptr_conv;
25501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25502 this_ptr_conv.is_owned = false;
25503 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25504 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
25505 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
25509 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
25510 LDKChannelAnnouncement this_ptr_conv;
25511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25512 this_ptr_conv.is_owned = false;
25513 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25514 LDKSignature val_ref;
25515 CHECK(*((uint32_t*)val) == 64);
25516 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
25517 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
25520 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
25521 LDKChannelAnnouncement this_ptr_conv;
25522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25523 this_ptr_conv.is_owned = false;
25524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25525 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
25526 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
25530 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
25531 LDKChannelAnnouncement this_ptr_conv;
25532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25533 this_ptr_conv.is_owned = false;
25534 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25535 LDKSignature val_ref;
25536 CHECK(*((uint32_t*)val) == 64);
25537 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
25538 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
25541 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
25542 LDKChannelAnnouncement this_ptr_conv;
25543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25544 this_ptr_conv.is_owned = false;
25545 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25546 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
25547 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
25551 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
25552 LDKChannelAnnouncement this_ptr_conv;
25553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25554 this_ptr_conv.is_owned = false;
25555 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25556 LDKSignature val_ref;
25557 CHECK(*((uint32_t*)val) == 64);
25558 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
25559 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
25562 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
25563 LDKChannelAnnouncement this_ptr_conv;
25564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25565 this_ptr_conv.is_owned = false;
25566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25567 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
25568 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
25572 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
25573 LDKChannelAnnouncement this_ptr_conv;
25574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25575 this_ptr_conv.is_owned = false;
25576 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25577 LDKSignature val_ref;
25578 CHECK(*((uint32_t*)val) == 64);
25579 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
25580 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
25583 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
25584 LDKChannelAnnouncement this_ptr_conv;
25585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25586 this_ptr_conv.is_owned = false;
25587 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25588 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
25589 uint64_t ret_ref = 0;
25590 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25591 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25592 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25593 ret_ref = (uint64_t)ret_var.inner;
25594 if (ret_var.is_owned) {
25600 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
25601 LDKChannelAnnouncement this_ptr_conv;
25602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25603 this_ptr_conv.is_owned = false;
25604 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25605 LDKUnsignedChannelAnnouncement val_conv;
25606 val_conv.inner = (void*)(val & (~1));
25607 val_conv.is_owned = (val & 1) || (val == 0);
25608 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25609 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
25610 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
25613 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) {
25614 LDKSignature node_signature_1_arg_ref;
25615 CHECK(*((uint32_t*)node_signature_1_arg) == 64);
25616 memcpy(node_signature_1_arg_ref.compact_form, (uint8_t*)(node_signature_1_arg + 4), 64);
25617 LDKSignature node_signature_2_arg_ref;
25618 CHECK(*((uint32_t*)node_signature_2_arg) == 64);
25619 memcpy(node_signature_2_arg_ref.compact_form, (uint8_t*)(node_signature_2_arg + 4), 64);
25620 LDKSignature bitcoin_signature_1_arg_ref;
25621 CHECK(*((uint32_t*)bitcoin_signature_1_arg) == 64);
25622 memcpy(bitcoin_signature_1_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_1_arg + 4), 64);
25623 LDKSignature bitcoin_signature_2_arg_ref;
25624 CHECK(*((uint32_t*)bitcoin_signature_2_arg) == 64);
25625 memcpy(bitcoin_signature_2_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_2_arg + 4), 64);
25626 LDKUnsignedChannelAnnouncement contents_arg_conv;
25627 contents_arg_conv.inner = (void*)(contents_arg & (~1));
25628 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
25629 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
25630 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
25631 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);
25632 uint64_t ret_ref = 0;
25633 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25634 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25635 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25636 ret_ref = (uint64_t)ret_var.inner;
25637 if (ret_var.is_owned) {
25643 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
25644 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
25645 uint64_t ret_ref = 0;
25646 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25647 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25648 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25649 ret_ref = (uint64_t)ret_var.inner;
25650 if (ret_var.is_owned) {
25655 int64_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_clone_ptr(uint32_t arg) {
25656 LDKChannelAnnouncement arg_conv;
25657 arg_conv.inner = (void*)(arg & (~1));
25658 arg_conv.is_owned = false;
25659 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25660 int64_t ret_val = ChannelAnnouncement_clone_ptr(&arg_conv);
25664 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
25665 LDKChannelAnnouncement orig_conv;
25666 orig_conv.inner = (void*)(orig & (~1));
25667 orig_conv.is_owned = false;
25668 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25669 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
25670 uint64_t ret_ref = 0;
25671 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25672 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25673 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25674 ret_ref = (uint64_t)ret_var.inner;
25675 if (ret_var.is_owned) {
25681 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_free(uint32_t this_obj) {
25682 LDKUnsignedChannelUpdate this_obj_conv;
25683 this_obj_conv.inner = (void*)(this_obj & (~1));
25684 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25685 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25686 UnsignedChannelUpdate_free(this_obj_conv);
25689 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
25690 LDKUnsignedChannelUpdate this_ptr_conv;
25691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25692 this_ptr_conv.is_owned = false;
25693 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25694 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
25695 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
25699 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
25700 LDKUnsignedChannelUpdate this_ptr_conv;
25701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25702 this_ptr_conv.is_owned = false;
25703 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25704 LDKThirtyTwoBytes val_ref;
25705 CHECK(*((uint32_t*)val) == 32);
25706 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
25707 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
25710 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
25711 LDKUnsignedChannelUpdate this_ptr_conv;
25712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25713 this_ptr_conv.is_owned = false;
25714 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25715 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
25719 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
25720 LDKUnsignedChannelUpdate this_ptr_conv;
25721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25722 this_ptr_conv.is_owned = false;
25723 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25724 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
25727 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
25728 LDKUnsignedChannelUpdate this_ptr_conv;
25729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25730 this_ptr_conv.is_owned = false;
25731 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25732 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
25736 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
25737 LDKUnsignedChannelUpdate this_ptr_conv;
25738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25739 this_ptr_conv.is_owned = false;
25740 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25741 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
25744 int8_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
25745 LDKUnsignedChannelUpdate this_ptr_conv;
25746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25747 this_ptr_conv.is_owned = false;
25748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25749 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
25753 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
25754 LDKUnsignedChannelUpdate this_ptr_conv;
25755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25756 this_ptr_conv.is_owned = false;
25757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25758 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
25761 int16_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
25762 LDKUnsignedChannelUpdate this_ptr_conv;
25763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25764 this_ptr_conv.is_owned = false;
25765 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25766 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
25770 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
25771 LDKUnsignedChannelUpdate this_ptr_conv;
25772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25773 this_ptr_conv.is_owned = false;
25774 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25775 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
25778 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
25779 LDKUnsignedChannelUpdate this_ptr_conv;
25780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25781 this_ptr_conv.is_owned = false;
25782 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25783 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
25787 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
25788 LDKUnsignedChannelUpdate this_ptr_conv;
25789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25790 this_ptr_conv.is_owned = false;
25791 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25792 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
25795 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
25796 LDKUnsignedChannelUpdate this_ptr_conv;
25797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25798 this_ptr_conv.is_owned = false;
25799 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25800 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
25804 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
25805 LDKUnsignedChannelUpdate 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 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
25812 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
25813 LDKUnsignedChannelUpdate this_ptr_conv;
25814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25815 this_ptr_conv.is_owned = false;
25816 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25817 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
25821 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
25822 LDKUnsignedChannelUpdate this_ptr_conv;
25823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25824 this_ptr_conv.is_owned = false;
25825 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25826 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
25829 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
25830 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
25831 uint64_t ret_ref = 0;
25832 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25833 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25834 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25835 ret_ref = (uint64_t)ret_var.inner;
25836 if (ret_var.is_owned) {
25841 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_clone_ptr(uint32_t arg) {
25842 LDKUnsignedChannelUpdate arg_conv;
25843 arg_conv.inner = (void*)(arg & (~1));
25844 arg_conv.is_owned = false;
25845 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25846 int64_t ret_val = UnsignedChannelUpdate_clone_ptr(&arg_conv);
25850 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
25851 LDKUnsignedChannelUpdate orig_conv;
25852 orig_conv.inner = (void*)(orig & (~1));
25853 orig_conv.is_owned = false;
25854 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25855 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
25856 uint64_t ret_ref = 0;
25857 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25858 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25859 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25860 ret_ref = (uint64_t)ret_var.inner;
25861 if (ret_var.is_owned) {
25867 void __attribute__((visibility("default"))) TS_ChannelUpdate_free(uint32_t this_obj) {
25868 LDKChannelUpdate this_obj_conv;
25869 this_obj_conv.inner = (void*)(this_obj & (~1));
25870 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25871 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25872 ChannelUpdate_free(this_obj_conv);
25875 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
25876 LDKChannelUpdate this_ptr_conv;
25877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25878 this_ptr_conv.is_owned = false;
25879 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25880 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
25881 memcpy((uint8_t*)(ret_arr + 4), ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
25885 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
25886 LDKChannelUpdate this_ptr_conv;
25887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25888 this_ptr_conv.is_owned = false;
25889 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25890 LDKSignature val_ref;
25891 CHECK(*((uint32_t*)val) == 64);
25892 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
25893 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
25896 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
25897 LDKChannelUpdate this_ptr_conv;
25898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25899 this_ptr_conv.is_owned = false;
25900 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25901 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
25902 uint64_t ret_ref = 0;
25903 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25904 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25905 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25906 ret_ref = (uint64_t)ret_var.inner;
25907 if (ret_var.is_owned) {
25913 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
25914 LDKChannelUpdate this_ptr_conv;
25915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25916 this_ptr_conv.is_owned = false;
25917 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25918 LDKUnsignedChannelUpdate val_conv;
25919 val_conv.inner = (void*)(val & (~1));
25920 val_conv.is_owned = (val & 1) || (val == 0);
25921 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25922 val_conv = UnsignedChannelUpdate_clone(&val_conv);
25923 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
25926 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
25927 LDKSignature signature_arg_ref;
25928 CHECK(*((uint32_t*)signature_arg) == 64);
25929 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
25930 LDKUnsignedChannelUpdate contents_arg_conv;
25931 contents_arg_conv.inner = (void*)(contents_arg & (~1));
25932 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
25933 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
25934 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
25935 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
25936 uint64_t ret_ref = 0;
25937 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25938 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25939 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25940 ret_ref = (uint64_t)ret_var.inner;
25941 if (ret_var.is_owned) {
25947 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
25948 LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
25949 uint64_t ret_ref = 0;
25950 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25951 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25952 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25953 ret_ref = (uint64_t)ret_var.inner;
25954 if (ret_var.is_owned) {
25959 int64_t __attribute__((visibility("default"))) TS_ChannelUpdate_clone_ptr(uint32_t arg) {
25960 LDKChannelUpdate arg_conv;
25961 arg_conv.inner = (void*)(arg & (~1));
25962 arg_conv.is_owned = false;
25963 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25964 int64_t ret_val = ChannelUpdate_clone_ptr(&arg_conv);
25968 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_clone(uint32_t orig) {
25969 LDKChannelUpdate orig_conv;
25970 orig_conv.inner = (void*)(orig & (~1));
25971 orig_conv.is_owned = false;
25972 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25973 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
25974 uint64_t ret_ref = 0;
25975 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25976 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25977 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25978 ret_ref = (uint64_t)ret_var.inner;
25979 if (ret_var.is_owned) {
25985 void __attribute__((visibility("default"))) TS_QueryChannelRange_free(uint32_t this_obj) {
25986 LDKQueryChannelRange this_obj_conv;
25987 this_obj_conv.inner = (void*)(this_obj & (~1));
25988 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25990 QueryChannelRange_free(this_obj_conv);
25993 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
25994 LDKQueryChannelRange this_ptr_conv;
25995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25996 this_ptr_conv.is_owned = false;
25997 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25998 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
25999 memcpy((uint8_t*)(ret_arr + 4), *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
26003 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26004 LDKQueryChannelRange this_ptr_conv;
26005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26006 this_ptr_conv.is_owned = false;
26007 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26008 LDKThirtyTwoBytes val_ref;
26009 CHECK(*((uint32_t*)val) == 32);
26010 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
26011 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
26014 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
26015 LDKQueryChannelRange this_ptr_conv;
26016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26017 this_ptr_conv.is_owned = false;
26018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26019 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
26023 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
26024 LDKQueryChannelRange this_ptr_conv;
26025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26026 this_ptr_conv.is_owned = false;
26027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26028 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
26031 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
26032 LDKQueryChannelRange this_ptr_conv;
26033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26034 this_ptr_conv.is_owned = false;
26035 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26036 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
26040 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
26041 LDKQueryChannelRange this_ptr_conv;
26042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26043 this_ptr_conv.is_owned = false;
26044 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26045 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
26048 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
26049 LDKThirtyTwoBytes chain_hash_arg_ref;
26050 CHECK(*((uint32_t*)chain_hash_arg) == 32);
26051 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
26052 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
26053 uint64_t ret_ref = 0;
26054 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26055 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26056 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26057 ret_ref = (uint64_t)ret_var.inner;
26058 if (ret_var.is_owned) {
26064 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
26065 LDKQueryChannelRange ret_var = QueryChannelRange_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_QueryChannelRange_clone_ptr(uint32_t arg) {
26077 LDKQueryChannelRange 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 = QueryChannelRange_clone_ptr(&arg_conv);
26085 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_clone(uint32_t orig) {
26086 LDKQueryChannelRange 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 LDKQueryChannelRange ret_var = QueryChannelRange_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_ReplyChannelRange_free(uint32_t this_obj) {
26103 LDKReplyChannelRange 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 ReplyChannelRange_free(this_obj_conv);
26110 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
26111 LDKReplyChannelRange 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(32, sizeof(uint8_t), "Native int8_tArray Bytes");
26116 memcpy((uint8_t*)(ret_arr + 4), *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
26120 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26121 LDKReplyChannelRange 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 LDKThirtyTwoBytes val_ref;
26126 CHECK(*((uint32_t*)val) == 32);
26127 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
26128 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
26131 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
26132 LDKReplyChannelRange 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 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
26140 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
26141 LDKReplyChannelRange this_ptr_conv;
26142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26143 this_ptr_conv.is_owned = false;
26144 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26145 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
26148 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
26149 LDKReplyChannelRange this_ptr_conv;
26150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26151 this_ptr_conv.is_owned = false;
26152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26153 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
26157 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
26158 LDKReplyChannelRange this_ptr_conv;
26159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26160 this_ptr_conv.is_owned = false;
26161 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26162 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
26165 jboolean __attribute__((visibility("default"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
26166 LDKReplyChannelRange this_ptr_conv;
26167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26168 this_ptr_conv.is_owned = false;
26169 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26170 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
26174 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
26175 LDKReplyChannelRange this_ptr_conv;
26176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26177 this_ptr_conv.is_owned = false;
26178 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26179 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
26182 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
26183 LDKReplyChannelRange this_ptr_conv;
26184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26185 this_ptr_conv.is_owned = false;
26186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26187 LDKCVec_u64Z val_constr;
26188 val_constr.datalen = *((uint32_t*)val);
26189 if (val_constr.datalen > 0)
26190 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26192 val_constr.data = NULL;
26193 int64_t* val_vals = (int64_t*)(val + 4);
26194 for (size_t i = 0; i < val_constr.datalen; i++) {
26195 int64_t val_conv_8 = val_vals[i];
26196 val_constr.data[i] = val_conv_8;
26198 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
26201 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) {
26202 LDKThirtyTwoBytes chain_hash_arg_ref;
26203 CHECK(*((uint32_t*)chain_hash_arg) == 32);
26204 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
26205 LDKCVec_u64Z short_channel_ids_arg_constr;
26206 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
26207 if (short_channel_ids_arg_constr.datalen > 0)
26208 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26210 short_channel_ids_arg_constr.data = NULL;
26211 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
26212 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
26213 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
26214 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
26216 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
26217 uint64_t ret_ref = 0;
26218 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26219 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26220 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26221 ret_ref = (uint64_t)ret_var.inner;
26222 if (ret_var.is_owned) {
26228 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
26229 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
26230 uint64_t ret_ref = 0;
26231 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26232 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26233 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26234 ret_ref = (uint64_t)ret_var.inner;
26235 if (ret_var.is_owned) {
26240 int64_t __attribute__((visibility("default"))) TS_ReplyChannelRange_clone_ptr(uint32_t arg) {
26241 LDKReplyChannelRange arg_conv;
26242 arg_conv.inner = (void*)(arg & (~1));
26243 arg_conv.is_owned = false;
26244 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26245 int64_t ret_val = ReplyChannelRange_clone_ptr(&arg_conv);
26249 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_clone(uint32_t orig) {
26250 LDKReplyChannelRange orig_conv;
26251 orig_conv.inner = (void*)(orig & (~1));
26252 orig_conv.is_owned = false;
26253 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26254 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
26255 uint64_t ret_ref = 0;
26256 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26257 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26258 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26259 ret_ref = (uint64_t)ret_var.inner;
26260 if (ret_var.is_owned) {
26266 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_free(uint32_t this_obj) {
26267 LDKQueryShortChannelIds this_obj_conv;
26268 this_obj_conv.inner = (void*)(this_obj & (~1));
26269 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26270 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26271 QueryShortChannelIds_free(this_obj_conv);
26274 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
26275 LDKQueryShortChannelIds this_ptr_conv;
26276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26277 this_ptr_conv.is_owned = false;
26278 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26279 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
26280 memcpy((uint8_t*)(ret_arr + 4), *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
26284 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26285 LDKQueryShortChannelIds this_ptr_conv;
26286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26287 this_ptr_conv.is_owned = false;
26288 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26289 LDKThirtyTwoBytes val_ref;
26290 CHECK(*((uint32_t*)val) == 32);
26291 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
26292 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
26295 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
26296 LDKQueryShortChannelIds this_ptr_conv;
26297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26298 this_ptr_conv.is_owned = false;
26299 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26300 LDKCVec_u64Z val_constr;
26301 val_constr.datalen = *((uint32_t*)val);
26302 if (val_constr.datalen > 0)
26303 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26305 val_constr.data = NULL;
26306 int64_t* val_vals = (int64_t*)(val + 4);
26307 for (size_t i = 0; i < val_constr.datalen; i++) {
26308 int64_t val_conv_8 = val_vals[i];
26309 val_constr.data[i] = val_conv_8;
26311 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
26314 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
26315 LDKThirtyTwoBytes chain_hash_arg_ref;
26316 CHECK(*((uint32_t*)chain_hash_arg) == 32);
26317 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
26318 LDKCVec_u64Z short_channel_ids_arg_constr;
26319 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
26320 if (short_channel_ids_arg_constr.datalen > 0)
26321 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26323 short_channel_ids_arg_constr.data = NULL;
26324 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
26325 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
26326 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
26327 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
26329 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
26330 uint64_t ret_ref = 0;
26331 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26332 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26333 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26334 ret_ref = (uint64_t)ret_var.inner;
26335 if (ret_var.is_owned) {
26341 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
26342 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
26343 uint64_t ret_ref = 0;
26344 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26345 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26346 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26347 ret_ref = (uint64_t)ret_var.inner;
26348 if (ret_var.is_owned) {
26353 int64_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_clone_ptr(uint32_t arg) {
26354 LDKQueryShortChannelIds arg_conv;
26355 arg_conv.inner = (void*)(arg & (~1));
26356 arg_conv.is_owned = false;
26357 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26358 int64_t ret_val = QueryShortChannelIds_clone_ptr(&arg_conv);
26362 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
26363 LDKQueryShortChannelIds orig_conv;
26364 orig_conv.inner = (void*)(orig & (~1));
26365 orig_conv.is_owned = false;
26366 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26367 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
26368 uint64_t ret_ref = 0;
26369 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26370 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26371 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26372 ret_ref = (uint64_t)ret_var.inner;
26373 if (ret_var.is_owned) {
26379 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_obj) {
26380 LDKReplyShortChannelIdsEnd this_obj_conv;
26381 this_obj_conv.inner = (void*)(this_obj & (~1));
26382 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26383 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26384 ReplyShortChannelIdsEnd_free(this_obj_conv);
26387 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
26388 LDKReplyShortChannelIdsEnd this_ptr_conv;
26389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26390 this_ptr_conv.is_owned = false;
26391 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26392 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
26393 memcpy((uint8_t*)(ret_arr + 4), *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
26397 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26398 LDKReplyShortChannelIdsEnd this_ptr_conv;
26399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26400 this_ptr_conv.is_owned = false;
26401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26402 LDKThirtyTwoBytes val_ref;
26403 CHECK(*((uint32_t*)val) == 32);
26404 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
26405 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
26408 jboolean __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
26409 LDKReplyShortChannelIdsEnd this_ptr_conv;
26410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26411 this_ptr_conv.is_owned = false;
26412 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26413 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
26417 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
26418 LDKReplyShortChannelIdsEnd this_ptr_conv;
26419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26420 this_ptr_conv.is_owned = false;
26421 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26422 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
26425 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
26426 LDKThirtyTwoBytes chain_hash_arg_ref;
26427 CHECK(*((uint32_t*)chain_hash_arg) == 32);
26428 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
26429 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
26430 uint64_t ret_ref = 0;
26431 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26432 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26433 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26434 ret_ref = (uint64_t)ret_var.inner;
26435 if (ret_var.is_owned) {
26441 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
26442 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
26443 uint64_t ret_ref = 0;
26444 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26445 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26446 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26447 ret_ref = (uint64_t)ret_var.inner;
26448 if (ret_var.is_owned) {
26453 int64_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint32_t arg) {
26454 LDKReplyShortChannelIdsEnd arg_conv;
26455 arg_conv.inner = (void*)(arg & (~1));
26456 arg_conv.is_owned = false;
26457 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26458 int64_t ret_val = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
26462 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
26463 LDKReplyShortChannelIdsEnd orig_conv;
26464 orig_conv.inner = (void*)(orig & (~1));
26465 orig_conv.is_owned = false;
26466 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26467 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
26468 uint64_t ret_ref = 0;
26469 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26470 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26471 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26472 ret_ref = (uint64_t)ret_var.inner;
26473 if (ret_var.is_owned) {
26479 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_free(uint32_t this_obj) {
26480 LDKGossipTimestampFilter this_obj_conv;
26481 this_obj_conv.inner = (void*)(this_obj & (~1));
26482 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26483 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26484 GossipTimestampFilter_free(this_obj_conv);
26487 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
26488 LDKGossipTimestampFilter this_ptr_conv;
26489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26490 this_ptr_conv.is_owned = false;
26491 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26492 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
26493 memcpy((uint8_t*)(ret_arr + 4), *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
26497 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26498 LDKGossipTimestampFilter this_ptr_conv;
26499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26500 this_ptr_conv.is_owned = false;
26501 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26502 LDKThirtyTwoBytes val_ref;
26503 CHECK(*((uint32_t*)val) == 32);
26504 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
26505 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
26508 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
26509 LDKGossipTimestampFilter this_ptr_conv;
26510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26511 this_ptr_conv.is_owned = false;
26512 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26513 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
26517 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
26518 LDKGossipTimestampFilter this_ptr_conv;
26519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26520 this_ptr_conv.is_owned = false;
26521 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26522 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
26525 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
26526 LDKGossipTimestampFilter this_ptr_conv;
26527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26528 this_ptr_conv.is_owned = false;
26529 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26530 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
26534 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
26535 LDKGossipTimestampFilter this_ptr_conv;
26536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26537 this_ptr_conv.is_owned = false;
26538 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26539 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
26542 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
26543 LDKThirtyTwoBytes chain_hash_arg_ref;
26544 CHECK(*((uint32_t*)chain_hash_arg) == 32);
26545 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
26546 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
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 GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
26559 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_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_GossipTimestampFilter_clone_ptr(uint32_t arg) {
26571 LDKGossipTimestampFilter 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 = GossipTimestampFilter_clone_ptr(&arg_conv);
26579 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
26580 LDKGossipTimestampFilter 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 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_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_ErrorAction_free(uint32_t this_ptr) {
26597 if ((this_ptr & 1) != 0) return;
26598 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
26599 CHECK_ACCESS(this_ptr_ptr);
26600 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
26601 FREE((void*)this_ptr);
26602 ErrorAction_free(this_ptr_conv);
26605 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
26606 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26607 *ret_copy = ErrorAction_clone(arg);
26608 uint64_t ret_ref = (uint64_t)ret_copy;
26611 int64_t __attribute__((visibility("default"))) TS_ErrorAction_clone_ptr(uint32_t arg) {
26612 LDKErrorAction* arg_conv = (LDKErrorAction*)arg;
26613 int64_t ret_val = ErrorAction_clone_ptr(arg_conv);
26617 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_clone(uint32_t orig) {
26618 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
26619 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26620 *ret_copy = ErrorAction_clone(orig_conv);
26621 uint64_t ret_ref = (uint64_t)ret_copy;
26625 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_disconnect_peer(uint32_t msg) {
26626 LDKErrorMessage msg_conv;
26627 msg_conv.inner = (void*)(msg & (~1));
26628 msg_conv.is_owned = (msg & 1) || (msg == 0);
26629 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
26630 msg_conv = ErrorMessage_clone(&msg_conv);
26631 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26632 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
26633 uint64_t ret_ref = (uint64_t)ret_copy;
26637 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_error() {
26638 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26639 *ret_copy = ErrorAction_ignore_error();
26640 uint64_t ret_ref = (uint64_t)ret_copy;
26644 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
26645 LDKLevel a_conv = LDKLevel_from_js(a);
26646 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26647 *ret_copy = ErrorAction_ignore_and_log(a_conv);
26648 uint64_t ret_ref = (uint64_t)ret_copy;
26652 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_send_error_message(uint32_t msg) {
26653 LDKErrorMessage msg_conv;
26654 msg_conv.inner = (void*)(msg & (~1));
26655 msg_conv.is_owned = (msg & 1) || (msg == 0);
26656 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
26657 msg_conv = ErrorMessage_clone(&msg_conv);
26658 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26659 *ret_copy = ErrorAction_send_error_message(msg_conv);
26660 uint64_t ret_ref = (uint64_t)ret_copy;
26664 void __attribute__((visibility("default"))) TS_LightningError_free(uint32_t this_obj) {
26665 LDKLightningError this_obj_conv;
26666 this_obj_conv.inner = (void*)(this_obj & (~1));
26667 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26668 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26669 LightningError_free(this_obj_conv);
26672 jstring __attribute__((visibility("default"))) TS_LightningError_get_err(uint32_t this_ptr) {
26673 LDKLightningError this_ptr_conv;
26674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26675 this_ptr_conv.is_owned = false;
26676 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26677 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
26678 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26683 void __attribute__((visibility("default"))) TS_LightningError_set_err(uint32_t this_ptr, jstring val) {
26684 LDKLightningError this_ptr_conv;
26685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26686 this_ptr_conv.is_owned = false;
26687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26688 LDKStr val_conv = str_ref_to_owned_c(val);
26689 LightningError_set_err(&this_ptr_conv, val_conv);
26692 uint32_t __attribute__((visibility("default"))) TS_LightningError_get_action(uint32_t this_ptr) {
26693 LDKLightningError this_ptr_conv;
26694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26695 this_ptr_conv.is_owned = false;
26696 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26697 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26698 *ret_copy = LightningError_get_action(&this_ptr_conv);
26699 uint64_t ret_ref = (uint64_t)ret_copy;
26703 void __attribute__((visibility("default"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
26704 LDKLightningError this_ptr_conv;
26705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26706 this_ptr_conv.is_owned = false;
26707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26708 void* val_ptr = (void*)(((uint64_t)val) & ~1);
26709 CHECK_ACCESS(val_ptr);
26710 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
26711 val_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)val) & ~1));
26712 LightningError_set_action(&this_ptr_conv, val_conv);
26715 uint32_t __attribute__((visibility("default"))) TS_LightningError_new(jstring err_arg, uint32_t action_arg) {
26716 LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
26717 void* action_arg_ptr = (void*)(((uint64_t)action_arg) & ~1);
26718 CHECK_ACCESS(action_arg_ptr);
26719 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
26720 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action_arg) & ~1));
26721 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
26722 uint64_t ret_ref = 0;
26723 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26724 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26725 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26726 ret_ref = (uint64_t)ret_var.inner;
26727 if (ret_var.is_owned) {
26733 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
26734 LDKLightningError ret_var = LightningError_clone(arg);
26735 uint64_t ret_ref = 0;
26736 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26737 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26738 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26739 ret_ref = (uint64_t)ret_var.inner;
26740 if (ret_var.is_owned) {
26745 int64_t __attribute__((visibility("default"))) TS_LightningError_clone_ptr(uint32_t arg) {
26746 LDKLightningError arg_conv;
26747 arg_conv.inner = (void*)(arg & (~1));
26748 arg_conv.is_owned = false;
26749 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26750 int64_t ret_val = LightningError_clone_ptr(&arg_conv);
26754 uint32_t __attribute__((visibility("default"))) TS_LightningError_clone(uint32_t orig) {
26755 LDKLightningError orig_conv;
26756 orig_conv.inner = (void*)(orig & (~1));
26757 orig_conv.is_owned = false;
26758 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26759 LDKLightningError ret_var = LightningError_clone(&orig_conv);
26760 uint64_t ret_ref = 0;
26761 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26762 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26763 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26764 ret_ref = (uint64_t)ret_var.inner;
26765 if (ret_var.is_owned) {
26771 void __attribute__((visibility("default"))) TS_CommitmentUpdate_free(uint32_t this_obj) {
26772 LDKCommitmentUpdate this_obj_conv;
26773 this_obj_conv.inner = (void*)(this_obj & (~1));
26774 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26775 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26776 CommitmentUpdate_free(this_obj_conv);
26779 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_add_htlcs(uint32_t this_ptr) {
26780 LDKCommitmentUpdate this_ptr_conv;
26781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26782 this_ptr_conv.is_owned = false;
26783 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26784 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
26785 uint32_tArray ret_arr = NULL;
26786 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
26787 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
26788 for (size_t p = 0; p < ret_var.datalen; p++) {
26789 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
26790 uint64_t ret_conv_15_ref = 0;
26791 CHECK((((uint64_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26792 CHECK((((uint64_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26793 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
26794 ret_conv_15_ref = (uint64_t)ret_conv_15_var.inner;
26795 if (ret_conv_15_var.is_owned) {
26796 ret_conv_15_ref |= 1;
26798 ret_arr_ptr[p] = ret_conv_15_ref;
26801 FREE(ret_var.data);
26805 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
26806 LDKCommitmentUpdate this_ptr_conv;
26807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26808 this_ptr_conv.is_owned = false;
26809 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26810 LDKCVec_UpdateAddHTLCZ val_constr;
26811 val_constr.datalen = *((uint32_t*)val);
26812 if (val_constr.datalen > 0)
26813 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
26815 val_constr.data = NULL;
26816 uint32_t* val_vals = (uint32_t*)(val + 4);
26817 for (size_t p = 0; p < val_constr.datalen; p++) {
26818 uint32_t val_conv_15 = val_vals[p];
26819 LDKUpdateAddHTLC val_conv_15_conv;
26820 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
26821 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
26822 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
26823 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
26824 val_constr.data[p] = val_conv_15_conv;
26826 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
26829 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint32_t this_ptr) {
26830 LDKCommitmentUpdate this_ptr_conv;
26831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26832 this_ptr_conv.is_owned = false;
26833 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26834 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
26835 uint32_tArray ret_arr = NULL;
26836 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
26837 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
26838 for (size_t t = 0; t < ret_var.datalen; t++) {
26839 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
26840 uint64_t ret_conv_19_ref = 0;
26841 CHECK((((uint64_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26842 CHECK((((uint64_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26843 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
26844 ret_conv_19_ref = (uint64_t)ret_conv_19_var.inner;
26845 if (ret_conv_19_var.is_owned) {
26846 ret_conv_19_ref |= 1;
26848 ret_arr_ptr[t] = ret_conv_19_ref;
26851 FREE(ret_var.data);
26855 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
26856 LDKCommitmentUpdate this_ptr_conv;
26857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26858 this_ptr_conv.is_owned = false;
26859 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26860 LDKCVec_UpdateFulfillHTLCZ val_constr;
26861 val_constr.datalen = *((uint32_t*)val);
26862 if (val_constr.datalen > 0)
26863 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
26865 val_constr.data = NULL;
26866 uint32_t* val_vals = (uint32_t*)(val + 4);
26867 for (size_t t = 0; t < val_constr.datalen; t++) {
26868 uint32_t val_conv_19 = val_vals[t];
26869 LDKUpdateFulfillHTLC val_conv_19_conv;
26870 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
26871 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
26872 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
26873 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
26874 val_constr.data[t] = val_conv_19_conv;
26876 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
26879 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint32_t this_ptr) {
26880 LDKCommitmentUpdate this_ptr_conv;
26881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26882 this_ptr_conv.is_owned = false;
26883 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26884 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
26885 uint32_tArray ret_arr = NULL;
26886 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
26887 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
26888 for (size_t q = 0; q < ret_var.datalen; q++) {
26889 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
26890 uint64_t ret_conv_16_ref = 0;
26891 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26892 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26893 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
26894 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
26895 if (ret_conv_16_var.is_owned) {
26896 ret_conv_16_ref |= 1;
26898 ret_arr_ptr[q] = ret_conv_16_ref;
26901 FREE(ret_var.data);
26905 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
26906 LDKCommitmentUpdate this_ptr_conv;
26907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26908 this_ptr_conv.is_owned = false;
26909 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26910 LDKCVec_UpdateFailHTLCZ val_constr;
26911 val_constr.datalen = *((uint32_t*)val);
26912 if (val_constr.datalen > 0)
26913 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
26915 val_constr.data = NULL;
26916 uint32_t* val_vals = (uint32_t*)(val + 4);
26917 for (size_t q = 0; q < val_constr.datalen; q++) {
26918 uint32_t val_conv_16 = val_vals[q];
26919 LDKUpdateFailHTLC val_conv_16_conv;
26920 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
26921 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
26922 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
26923 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
26924 val_constr.data[q] = val_conv_16_conv;
26926 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
26929 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint32_t this_ptr) {
26930 LDKCommitmentUpdate this_ptr_conv;
26931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26932 this_ptr_conv.is_owned = false;
26933 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26934 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
26935 uint32_tArray ret_arr = NULL;
26936 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
26937 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
26938 for (size_t z = 0; z < ret_var.datalen; z++) {
26939 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
26940 uint64_t ret_conv_25_ref = 0;
26941 CHECK((((uint64_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26942 CHECK((((uint64_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26943 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
26944 ret_conv_25_ref = (uint64_t)ret_conv_25_var.inner;
26945 if (ret_conv_25_var.is_owned) {
26946 ret_conv_25_ref |= 1;
26948 ret_arr_ptr[z] = ret_conv_25_ref;
26951 FREE(ret_var.data);
26955 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_malformed_htlcs(uint32_t this_ptr, uint32_tArray val) {
26956 LDKCommitmentUpdate this_ptr_conv;
26957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26958 this_ptr_conv.is_owned = false;
26959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26960 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
26961 val_constr.datalen = *((uint32_t*)val);
26962 if (val_constr.datalen > 0)
26963 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
26965 val_constr.data = NULL;
26966 uint32_t* val_vals = (uint32_t*)(val + 4);
26967 for (size_t z = 0; z < val_constr.datalen; z++) {
26968 uint32_t val_conv_25 = val_vals[z];
26969 LDKUpdateFailMalformedHTLC val_conv_25_conv;
26970 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
26971 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
26972 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
26973 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
26974 val_constr.data[z] = val_conv_25_conv;
26976 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
26979 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
26980 LDKCommitmentUpdate this_ptr_conv;
26981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26982 this_ptr_conv.is_owned = false;
26983 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26984 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
26985 uint64_t ret_ref = 0;
26986 if ((uint64_t)ret_var.inner > 4096) {
26987 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26988 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26989 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26990 ret_ref = (uint64_t)ret_var.inner;
26991 if (ret_var.is_owned) {
26998 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
26999 LDKCommitmentUpdate 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 LDKUpdateFee val_conv;
27004 val_conv.inner = (void*)(val & (~1));
27005 val_conv.is_owned = (val & 1) || (val == 0);
27006 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27007 val_conv = UpdateFee_clone(&val_conv);
27008 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
27011 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
27012 LDKCommitmentUpdate this_ptr_conv;
27013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27014 this_ptr_conv.is_owned = false;
27015 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27016 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
27017 uint64_t ret_ref = 0;
27018 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27019 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27020 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27021 ret_ref = (uint64_t)ret_var.inner;
27022 if (ret_var.is_owned) {
27028 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
27029 LDKCommitmentUpdate 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 LDKCommitmentSigned val_conv;
27034 val_conv.inner = (void*)(val & (~1));
27035 val_conv.is_owned = (val & 1) || (val == 0);
27036 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27037 val_conv = CommitmentSigned_clone(&val_conv);
27038 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
27041 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) {
27042 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
27043 update_add_htlcs_arg_constr.datalen = *((uint32_t*)update_add_htlcs_arg);
27044 if (update_add_htlcs_arg_constr.datalen > 0)
27045 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
27047 update_add_htlcs_arg_constr.data = NULL;
27048 uint32_t* update_add_htlcs_arg_vals = (uint32_t*)(update_add_htlcs_arg + 4);
27049 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
27050 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
27051 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
27052 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
27053 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
27054 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
27055 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
27056 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
27058 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
27059 update_fulfill_htlcs_arg_constr.datalen = *((uint32_t*)update_fulfill_htlcs_arg);
27060 if (update_fulfill_htlcs_arg_constr.datalen > 0)
27061 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
27063 update_fulfill_htlcs_arg_constr.data = NULL;
27064 uint32_t* update_fulfill_htlcs_arg_vals = (uint32_t*)(update_fulfill_htlcs_arg + 4);
27065 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
27066 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
27067 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
27068 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
27069 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
27070 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
27071 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
27072 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
27074 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
27075 update_fail_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_htlcs_arg);
27076 if (update_fail_htlcs_arg_constr.datalen > 0)
27077 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
27079 update_fail_htlcs_arg_constr.data = NULL;
27080 uint32_t* update_fail_htlcs_arg_vals = (uint32_t*)(update_fail_htlcs_arg + 4);
27081 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
27082 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
27083 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
27084 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
27085 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
27086 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
27087 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
27088 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
27090 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
27091 update_fail_malformed_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_malformed_htlcs_arg);
27092 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
27093 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
27095 update_fail_malformed_htlcs_arg_constr.data = NULL;
27096 uint32_t* update_fail_malformed_htlcs_arg_vals = (uint32_t*)(update_fail_malformed_htlcs_arg + 4);
27097 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
27098 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
27099 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
27100 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
27101 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);
27102 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
27103 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
27104 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
27106 LDKUpdateFee update_fee_arg_conv;
27107 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
27108 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
27109 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
27110 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
27111 LDKCommitmentSigned commitment_signed_arg_conv;
27112 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
27113 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
27114 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
27115 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
27116 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);
27117 uint64_t ret_ref = 0;
27118 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27119 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27120 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27121 ret_ref = (uint64_t)ret_var.inner;
27122 if (ret_var.is_owned) {
27128 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
27129 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
27130 uint64_t ret_ref = 0;
27131 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27132 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27133 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27134 ret_ref = (uint64_t)ret_var.inner;
27135 if (ret_var.is_owned) {
27140 int64_t __attribute__((visibility("default"))) TS_CommitmentUpdate_clone_ptr(uint32_t arg) {
27141 LDKCommitmentUpdate arg_conv;
27142 arg_conv.inner = (void*)(arg & (~1));
27143 arg_conv.is_owned = false;
27144 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27145 int64_t ret_val = CommitmentUpdate_clone_ptr(&arg_conv);
27149 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_clone(uint32_t orig) {
27150 LDKCommitmentUpdate orig_conv;
27151 orig_conv.inner = (void*)(orig & (~1));
27152 orig_conv.is_owned = false;
27153 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27154 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
27155 uint64_t ret_ref = 0;
27156 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27157 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27158 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27159 ret_ref = (uint64_t)ret_var.inner;
27160 if (ret_var.is_owned) {
27166 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
27167 if ((this_ptr & 1) != 0) return;
27168 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
27169 CHECK_ACCESS(this_ptr_ptr);
27170 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
27171 FREE((void*)this_ptr);
27172 ChannelMessageHandler_free(this_ptr_conv);
27175 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
27176 if ((this_ptr & 1) != 0) return;
27177 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
27178 CHECK_ACCESS(this_ptr_ptr);
27179 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
27180 FREE((void*)this_ptr);
27181 RoutingMessageHandler_free(this_ptr_conv);
27184 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_write(uint32_t obj) {
27185 LDKAcceptChannel obj_conv;
27186 obj_conv.inner = (void*)(obj & (~1));
27187 obj_conv.is_owned = false;
27188 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27189 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
27190 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27191 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27192 CVec_u8Z_free(ret_var);
27196 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_read(int8_tArray ser) {
27197 LDKu8slice ser_ref;
27198 ser_ref.datalen = *((uint32_t*)ser);
27199 ser_ref.data = (int8_t*)(ser + 4);
27200 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
27201 *ret_conv = AcceptChannel_read(ser_ref);
27202 return (uint64_t)ret_conv;
27205 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_write(uint32_t obj) {
27206 LDKAnnouncementSignatures obj_conv;
27207 obj_conv.inner = (void*)(obj & (~1));
27208 obj_conv.is_owned = false;
27209 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27210 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
27211 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27212 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27213 CVec_u8Z_free(ret_var);
27217 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
27218 LDKu8slice ser_ref;
27219 ser_ref.datalen = *((uint32_t*)ser);
27220 ser_ref.data = (int8_t*)(ser + 4);
27221 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
27222 *ret_conv = AnnouncementSignatures_read(ser_ref);
27223 return (uint64_t)ret_conv;
27226 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_write(uint32_t obj) {
27227 LDKChannelReestablish obj_conv;
27228 obj_conv.inner = (void*)(obj & (~1));
27229 obj_conv.is_owned = false;
27230 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27231 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
27232 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27233 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27234 CVec_u8Z_free(ret_var);
27238 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_read(int8_tArray ser) {
27239 LDKu8slice ser_ref;
27240 ser_ref.datalen = *((uint32_t*)ser);
27241 ser_ref.data = (int8_t*)(ser + 4);
27242 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
27243 *ret_conv = ChannelReestablish_read(ser_ref);
27244 return (uint64_t)ret_conv;
27247 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_write(uint32_t obj) {
27248 LDKClosingSigned obj_conv;
27249 obj_conv.inner = (void*)(obj & (~1));
27250 obj_conv.is_owned = false;
27251 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27252 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
27253 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27254 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27255 CVec_u8Z_free(ret_var);
27259 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_read(int8_tArray ser) {
27260 LDKu8slice ser_ref;
27261 ser_ref.datalen = *((uint32_t*)ser);
27262 ser_ref.data = (int8_t*)(ser + 4);
27263 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
27264 *ret_conv = ClosingSigned_read(ser_ref);
27265 return (uint64_t)ret_conv;
27268 int8_tArray __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_write(uint32_t obj) {
27269 LDKClosingSignedFeeRange obj_conv;
27270 obj_conv.inner = (void*)(obj & (~1));
27271 obj_conv.is_owned = false;
27272 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27273 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
27274 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27275 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27276 CVec_u8Z_free(ret_var);
27280 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
27281 LDKu8slice ser_ref;
27282 ser_ref.datalen = *((uint32_t*)ser);
27283 ser_ref.data = (int8_t*)(ser + 4);
27284 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
27285 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
27286 return (uint64_t)ret_conv;
27289 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_write(uint32_t obj) {
27290 LDKCommitmentSigned obj_conv;
27291 obj_conv.inner = (void*)(obj & (~1));
27292 obj_conv.is_owned = false;
27293 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27294 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
27295 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27296 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27297 CVec_u8Z_free(ret_var);
27301 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_read(int8_tArray ser) {
27302 LDKu8slice ser_ref;
27303 ser_ref.datalen = *((uint32_t*)ser);
27304 ser_ref.data = (int8_t*)(ser + 4);
27305 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
27306 *ret_conv = CommitmentSigned_read(ser_ref);
27307 return (uint64_t)ret_conv;
27310 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_write(uint32_t obj) {
27311 LDKFundingCreated obj_conv;
27312 obj_conv.inner = (void*)(obj & (~1));
27313 obj_conv.is_owned = false;
27314 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27315 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
27316 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27317 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27318 CVec_u8Z_free(ret_var);
27322 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_read(int8_tArray ser) {
27323 LDKu8slice ser_ref;
27324 ser_ref.datalen = *((uint32_t*)ser);
27325 ser_ref.data = (int8_t*)(ser + 4);
27326 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
27327 *ret_conv = FundingCreated_read(ser_ref);
27328 return (uint64_t)ret_conv;
27331 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_write(uint32_t obj) {
27332 LDKFundingSigned obj_conv;
27333 obj_conv.inner = (void*)(obj & (~1));
27334 obj_conv.is_owned = false;
27335 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27336 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
27337 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27338 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27339 CVec_u8Z_free(ret_var);
27343 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_read(int8_tArray ser) {
27344 LDKu8slice ser_ref;
27345 ser_ref.datalen = *((uint32_t*)ser);
27346 ser_ref.data = (int8_t*)(ser + 4);
27347 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
27348 *ret_conv = FundingSigned_read(ser_ref);
27349 return (uint64_t)ret_conv;
27352 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_write(uint32_t obj) {
27353 LDKFundingLocked obj_conv;
27354 obj_conv.inner = (void*)(obj & (~1));
27355 obj_conv.is_owned = false;
27356 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27357 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
27358 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27359 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27360 CVec_u8Z_free(ret_var);
27364 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_read(int8_tArray ser) {
27365 LDKu8slice ser_ref;
27366 ser_ref.datalen = *((uint32_t*)ser);
27367 ser_ref.data = (int8_t*)(ser + 4);
27368 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
27369 *ret_conv = FundingLocked_read(ser_ref);
27370 return (uint64_t)ret_conv;
27373 int8_tArray __attribute__((visibility("default"))) TS_Init_write(uint32_t obj) {
27375 obj_conv.inner = (void*)(obj & (~1));
27376 obj_conv.is_owned = false;
27377 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27378 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
27379 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27380 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27381 CVec_u8Z_free(ret_var);
27385 uint32_t __attribute__((visibility("default"))) TS_Init_read(int8_tArray ser) {
27386 LDKu8slice ser_ref;
27387 ser_ref.datalen = *((uint32_t*)ser);
27388 ser_ref.data = (int8_t*)(ser + 4);
27389 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
27390 *ret_conv = Init_read(ser_ref);
27391 return (uint64_t)ret_conv;
27394 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_write(uint32_t obj) {
27395 LDKOpenChannel obj_conv;
27396 obj_conv.inner = (void*)(obj & (~1));
27397 obj_conv.is_owned = false;
27398 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27399 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
27400 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27401 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27402 CVec_u8Z_free(ret_var);
27406 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_read(int8_tArray ser) {
27407 LDKu8slice ser_ref;
27408 ser_ref.datalen = *((uint32_t*)ser);
27409 ser_ref.data = (int8_t*)(ser + 4);
27410 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
27411 *ret_conv = OpenChannel_read(ser_ref);
27412 return (uint64_t)ret_conv;
27415 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_write(uint32_t obj) {
27416 LDKRevokeAndACK obj_conv;
27417 obj_conv.inner = (void*)(obj & (~1));
27418 obj_conv.is_owned = false;
27419 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27420 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
27421 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27422 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27423 CVec_u8Z_free(ret_var);
27427 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_read(int8_tArray ser) {
27428 LDKu8slice ser_ref;
27429 ser_ref.datalen = *((uint32_t*)ser);
27430 ser_ref.data = (int8_t*)(ser + 4);
27431 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
27432 *ret_conv = RevokeAndACK_read(ser_ref);
27433 return (uint64_t)ret_conv;
27436 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_write(uint32_t obj) {
27437 LDKShutdown obj_conv;
27438 obj_conv.inner = (void*)(obj & (~1));
27439 obj_conv.is_owned = false;
27440 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27441 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
27442 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27443 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27444 CVec_u8Z_free(ret_var);
27448 uint32_t __attribute__((visibility("default"))) TS_Shutdown_read(int8_tArray ser) {
27449 LDKu8slice ser_ref;
27450 ser_ref.datalen = *((uint32_t*)ser);
27451 ser_ref.data = (int8_t*)(ser + 4);
27452 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
27453 *ret_conv = Shutdown_read(ser_ref);
27454 return (uint64_t)ret_conv;
27457 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_write(uint32_t obj) {
27458 LDKUpdateFailHTLC obj_conv;
27459 obj_conv.inner = (void*)(obj & (~1));
27460 obj_conv.is_owned = false;
27461 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27462 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
27463 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27464 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27465 CVec_u8Z_free(ret_var);
27469 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
27470 LDKu8slice ser_ref;
27471 ser_ref.datalen = *((uint32_t*)ser);
27472 ser_ref.data = (int8_t*)(ser + 4);
27473 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
27474 *ret_conv = UpdateFailHTLC_read(ser_ref);
27475 return (uint64_t)ret_conv;
27478 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
27479 LDKUpdateFailMalformedHTLC obj_conv;
27480 obj_conv.inner = (void*)(obj & (~1));
27481 obj_conv.is_owned = false;
27482 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27483 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
27484 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27485 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27486 CVec_u8Z_free(ret_var);
27490 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
27491 LDKu8slice ser_ref;
27492 ser_ref.datalen = *((uint32_t*)ser);
27493 ser_ref.data = (int8_t*)(ser + 4);
27494 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
27495 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
27496 return (uint64_t)ret_conv;
27499 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_write(uint32_t obj) {
27500 LDKUpdateFee obj_conv;
27501 obj_conv.inner = (void*)(obj & (~1));
27502 obj_conv.is_owned = false;
27503 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27504 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
27505 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27506 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27507 CVec_u8Z_free(ret_var);
27511 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_read(int8_tArray ser) {
27512 LDKu8slice ser_ref;
27513 ser_ref.datalen = *((uint32_t*)ser);
27514 ser_ref.data = (int8_t*)(ser + 4);
27515 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
27516 *ret_conv = UpdateFee_read(ser_ref);
27517 return (uint64_t)ret_conv;
27520 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
27521 LDKUpdateFulfillHTLC obj_conv;
27522 obj_conv.inner = (void*)(obj & (~1));
27523 obj_conv.is_owned = false;
27524 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27525 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
27526 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27527 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27528 CVec_u8Z_free(ret_var);
27532 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
27533 LDKu8slice ser_ref;
27534 ser_ref.datalen = *((uint32_t*)ser);
27535 ser_ref.data = (int8_t*)(ser + 4);
27536 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
27537 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
27538 return (uint64_t)ret_conv;
27541 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_write(uint32_t obj) {
27542 LDKUpdateAddHTLC obj_conv;
27543 obj_conv.inner = (void*)(obj & (~1));
27544 obj_conv.is_owned = false;
27545 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27546 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
27547 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27548 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27549 CVec_u8Z_free(ret_var);
27553 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
27554 LDKu8slice ser_ref;
27555 ser_ref.datalen = *((uint32_t*)ser);
27556 ser_ref.data = (int8_t*)(ser + 4);
27557 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
27558 *ret_conv = UpdateAddHTLC_read(ser_ref);
27559 return (uint64_t)ret_conv;
27562 int8_tArray __attribute__((visibility("default"))) TS_Ping_write(uint32_t obj) {
27564 obj_conv.inner = (void*)(obj & (~1));
27565 obj_conv.is_owned = false;
27566 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27567 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
27568 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27569 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27570 CVec_u8Z_free(ret_var);
27574 uint32_t __attribute__((visibility("default"))) TS_Ping_read(int8_tArray ser) {
27575 LDKu8slice ser_ref;
27576 ser_ref.datalen = *((uint32_t*)ser);
27577 ser_ref.data = (int8_t*)(ser + 4);
27578 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
27579 *ret_conv = Ping_read(ser_ref);
27580 return (uint64_t)ret_conv;
27583 int8_tArray __attribute__((visibility("default"))) TS_Pong_write(uint32_t obj) {
27585 obj_conv.inner = (void*)(obj & (~1));
27586 obj_conv.is_owned = false;
27587 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27588 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
27589 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27590 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27591 CVec_u8Z_free(ret_var);
27595 uint32_t __attribute__((visibility("default"))) TS_Pong_read(int8_tArray ser) {
27596 LDKu8slice ser_ref;
27597 ser_ref.datalen = *((uint32_t*)ser);
27598 ser_ref.data = (int8_t*)(ser + 4);
27599 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
27600 *ret_conv = Pong_read(ser_ref);
27601 return (uint64_t)ret_conv;
27604 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
27605 LDKUnsignedChannelAnnouncement obj_conv;
27606 obj_conv.inner = (void*)(obj & (~1));
27607 obj_conv.is_owned = false;
27608 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27609 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
27610 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27611 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27612 CVec_u8Z_free(ret_var);
27616 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
27617 LDKu8slice ser_ref;
27618 ser_ref.datalen = *((uint32_t*)ser);
27619 ser_ref.data = (int8_t*)(ser + 4);
27620 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
27621 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
27622 return (uint64_t)ret_conv;
27625 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_write(uint32_t obj) {
27626 LDKChannelAnnouncement obj_conv;
27627 obj_conv.inner = (void*)(obj & (~1));
27628 obj_conv.is_owned = false;
27629 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27630 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
27631 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27632 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27633 CVec_u8Z_free(ret_var);
27637 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
27638 LDKu8slice ser_ref;
27639 ser_ref.datalen = *((uint32_t*)ser);
27640 ser_ref.data = (int8_t*)(ser + 4);
27641 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
27642 *ret_conv = ChannelAnnouncement_read(ser_ref);
27643 return (uint64_t)ret_conv;
27646 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
27647 LDKUnsignedChannelUpdate obj_conv;
27648 obj_conv.inner = (void*)(obj & (~1));
27649 obj_conv.is_owned = false;
27650 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27651 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
27652 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27653 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27654 CVec_u8Z_free(ret_var);
27658 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
27659 LDKu8slice ser_ref;
27660 ser_ref.datalen = *((uint32_t*)ser);
27661 ser_ref.data = (int8_t*)(ser + 4);
27662 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
27663 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
27664 return (uint64_t)ret_conv;
27667 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_write(uint32_t obj) {
27668 LDKChannelUpdate obj_conv;
27669 obj_conv.inner = (void*)(obj & (~1));
27670 obj_conv.is_owned = false;
27671 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27672 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
27673 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27674 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27675 CVec_u8Z_free(ret_var);
27679 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_read(int8_tArray ser) {
27680 LDKu8slice ser_ref;
27681 ser_ref.datalen = *((uint32_t*)ser);
27682 ser_ref.data = (int8_t*)(ser + 4);
27683 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
27684 *ret_conv = ChannelUpdate_read(ser_ref);
27685 return (uint64_t)ret_conv;
27688 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_write(uint32_t obj) {
27689 LDKErrorMessage obj_conv;
27690 obj_conv.inner = (void*)(obj & (~1));
27691 obj_conv.is_owned = false;
27692 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27693 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
27694 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27695 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27696 CVec_u8Z_free(ret_var);
27700 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_read(int8_tArray ser) {
27701 LDKu8slice ser_ref;
27702 ser_ref.datalen = *((uint32_t*)ser);
27703 ser_ref.data = (int8_t*)(ser + 4);
27704 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
27705 *ret_conv = ErrorMessage_read(ser_ref);
27706 return (uint64_t)ret_conv;
27709 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
27710 LDKUnsignedNodeAnnouncement obj_conv;
27711 obj_conv.inner = (void*)(obj & (~1));
27712 obj_conv.is_owned = false;
27713 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27714 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
27715 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27716 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27717 CVec_u8Z_free(ret_var);
27721 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
27722 LDKu8slice ser_ref;
27723 ser_ref.datalen = *((uint32_t*)ser);
27724 ser_ref.data = (int8_t*)(ser + 4);
27725 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
27726 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
27727 return (uint64_t)ret_conv;
27730 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_write(uint32_t obj) {
27731 LDKNodeAnnouncement obj_conv;
27732 obj_conv.inner = (void*)(obj & (~1));
27733 obj_conv.is_owned = false;
27734 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27735 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
27736 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27737 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27738 CVec_u8Z_free(ret_var);
27742 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_read(int8_tArray ser) {
27743 LDKu8slice ser_ref;
27744 ser_ref.datalen = *((uint32_t*)ser);
27745 ser_ref.data = (int8_t*)(ser + 4);
27746 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
27747 *ret_conv = NodeAnnouncement_read(ser_ref);
27748 return (uint64_t)ret_conv;
27751 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
27752 LDKu8slice ser_ref;
27753 ser_ref.datalen = *((uint32_t*)ser);
27754 ser_ref.data = (int8_t*)(ser + 4);
27755 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
27756 *ret_conv = QueryShortChannelIds_read(ser_ref);
27757 return (uint64_t)ret_conv;
27760 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_write(uint32_t obj) {
27761 LDKQueryShortChannelIds obj_conv;
27762 obj_conv.inner = (void*)(obj & (~1));
27763 obj_conv.is_owned = false;
27764 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27765 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
27766 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27767 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27768 CVec_u8Z_free(ret_var);
27772 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
27773 LDKReplyShortChannelIdsEnd obj_conv;
27774 obj_conv.inner = (void*)(obj & (~1));
27775 obj_conv.is_owned = false;
27776 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27777 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
27778 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27779 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27780 CVec_u8Z_free(ret_var);
27784 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
27785 LDKu8slice ser_ref;
27786 ser_ref.datalen = *((uint32_t*)ser);
27787 ser_ref.data = (int8_t*)(ser + 4);
27788 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
27789 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
27790 return (uint64_t)ret_conv;
27793 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
27794 LDKQueryChannelRange this_arg_conv;
27795 this_arg_conv.inner = (void*)(this_arg & (~1));
27796 this_arg_conv.is_owned = false;
27797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27798 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
27802 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_write(uint32_t obj) {
27803 LDKQueryChannelRange 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 = QueryChannelRange_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_QueryChannelRange_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_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
27819 *ret_conv = QueryChannelRange_read(ser_ref);
27820 return (uint64_t)ret_conv;
27823 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_read(int8_tArray ser) {
27824 LDKu8slice ser_ref;
27825 ser_ref.datalen = *((uint32_t*)ser);
27826 ser_ref.data = (int8_t*)(ser + 4);
27827 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
27828 *ret_conv = ReplyChannelRange_read(ser_ref);
27829 return (uint64_t)ret_conv;
27832 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_write(uint32_t obj) {
27833 LDKReplyChannelRange obj_conv;
27834 obj_conv.inner = (void*)(obj & (~1));
27835 obj_conv.is_owned = false;
27836 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27837 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
27838 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27839 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27840 CVec_u8Z_free(ret_var);
27844 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_write(uint32_t obj) {
27845 LDKGossipTimestampFilter 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 = GossipTimestampFilter_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_GossipTimestampFilter_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_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
27861 *ret_conv = GossipTimestampFilter_read(ser_ref);
27862 return (uint64_t)ret_conv;
27865 void __attribute__((visibility("default"))) TS_CustomMessageHandler_free(uint32_t this_ptr) {
27866 if ((this_ptr & 1) != 0) return;
27867 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
27868 CHECK_ACCESS(this_ptr_ptr);
27869 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
27870 FREE((void*)this_ptr);
27871 CustomMessageHandler_free(this_ptr_conv);
27874 void __attribute__((visibility("default"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
27875 LDKIgnoringMessageHandler this_obj_conv;
27876 this_obj_conv.inner = (void*)(this_obj & (~1));
27877 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27878 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27879 IgnoringMessageHandler_free(this_obj_conv);
27882 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_new() {
27883 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
27884 uint64_t ret_ref = 0;
27885 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27886 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27887 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27888 ret_ref = (uint64_t)ret_var.inner;
27889 if (ret_var.is_owned) {
27895 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
27896 LDKIgnoringMessageHandler this_arg_conv;
27897 this_arg_conv.inner = (void*)(this_arg & (~1));
27898 this_arg_conv.is_owned = false;
27899 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27900 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
27901 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
27902 return (uint64_t)ret_ret;
27905 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
27906 LDKIgnoringMessageHandler this_arg_conv;
27907 this_arg_conv.inner = (void*)(this_arg & (~1));
27908 this_arg_conv.is_owned = false;
27909 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27910 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
27911 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
27912 return (uint64_t)ret_ret;
27915 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint32_t this_arg) {
27916 LDKIgnoringMessageHandler this_arg_conv;
27917 this_arg_conv.inner = (void*)(this_arg & (~1));
27918 this_arg_conv.is_owned = false;
27919 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27920 LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
27921 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
27922 return (uint64_t)ret_ret;
27925 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint32_t this_arg) {
27926 LDKIgnoringMessageHandler this_arg_conv;
27927 this_arg_conv.inner = (void*)(this_arg & (~1));
27928 this_arg_conv.is_owned = false;
27929 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27930 LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
27931 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
27932 return (uint64_t)ret_ret;
27935 void __attribute__((visibility("default"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
27936 LDKErroringMessageHandler this_obj_conv;
27937 this_obj_conv.inner = (void*)(this_obj & (~1));
27938 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27940 ErroringMessageHandler_free(this_obj_conv);
27943 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_new() {
27944 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
27945 uint64_t ret_ref = 0;
27946 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27947 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27948 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27949 ret_ref = (uint64_t)ret_var.inner;
27950 if (ret_var.is_owned) {
27956 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
27957 LDKErroringMessageHandler this_arg_conv;
27958 this_arg_conv.inner = (void*)(this_arg & (~1));
27959 this_arg_conv.is_owned = false;
27960 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27961 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
27962 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
27963 return (uint64_t)ret_ret;
27966 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
27967 LDKErroringMessageHandler this_arg_conv;
27968 this_arg_conv.inner = (void*)(this_arg & (~1));
27969 this_arg_conv.is_owned = false;
27970 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27971 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
27972 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
27973 return (uint64_t)ret_ret;
27976 void __attribute__((visibility("default"))) TS_MessageHandler_free(uint32_t this_obj) {
27977 LDKMessageHandler this_obj_conv;
27978 this_obj_conv.inner = (void*)(this_obj & (~1));
27979 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27981 MessageHandler_free(this_obj_conv);
27984 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
27985 LDKMessageHandler this_ptr_conv;
27986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27987 this_ptr_conv.is_owned = false;
27988 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27989 // WARNING: This object doesn't live past this scope, needs clone!
27990 uint64_t ret_ret = ((uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv)) | 1;
27994 void __attribute__((visibility("default"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
27995 LDKMessageHandler this_ptr_conv;
27996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27997 this_ptr_conv.is_owned = false;
27998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27999 void* val_ptr = (void*)(((uint64_t)val) & ~1);
28000 CHECK_ACCESS(val_ptr);
28001 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
28002 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
28005 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
28006 LDKMessageHandler this_ptr_conv;
28007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28008 this_ptr_conv.is_owned = false;
28009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28010 // WARNING: This object doesn't live past this scope, needs clone!
28011 uint64_t ret_ret = ((uint64_t)MessageHandler_get_route_handler(&this_ptr_conv)) | 1;
28015 void __attribute__((visibility("default"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
28016 LDKMessageHandler this_ptr_conv;
28017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28018 this_ptr_conv.is_owned = false;
28019 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28020 void* val_ptr = (void*)(((uint64_t)val) & ~1);
28021 CHECK_ACCESS(val_ptr);
28022 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
28023 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
28026 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
28027 void* chan_handler_arg_ptr = (void*)(((uint64_t)chan_handler_arg) & ~1);
28028 CHECK_ACCESS(chan_handler_arg_ptr);
28029 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
28030 void* route_handler_arg_ptr = (void*)(((uint64_t)route_handler_arg) & ~1);
28031 CHECK_ACCESS(route_handler_arg_ptr);
28032 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
28033 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
28034 uint64_t ret_ref = 0;
28035 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28036 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28037 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28038 ret_ref = (uint64_t)ret_var.inner;
28039 if (ret_var.is_owned) {
28045 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
28046 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
28047 *ret_ret = SocketDescriptor_clone(arg);
28048 return (uint64_t)ret_ret;
28050 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone_ptr(uint32_t arg) {
28051 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
28052 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
28053 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
28054 int64_t ret_val = SocketDescriptor_clone_ptr(arg_conv);
28058 uint32_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone(uint32_t orig) {
28059 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
28060 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
28061 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
28062 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
28063 *ret_ret = SocketDescriptor_clone(orig_conv);
28064 return (uint64_t)ret_ret;
28067 void __attribute__((visibility("default"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
28068 if ((this_ptr & 1) != 0) return;
28069 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
28070 CHECK_ACCESS(this_ptr_ptr);
28071 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
28072 FREE((void*)this_ptr);
28073 SocketDescriptor_free(this_ptr_conv);
28076 void __attribute__((visibility("default"))) TS_PeerHandleError_free(uint32_t this_obj) {
28077 LDKPeerHandleError this_obj_conv;
28078 this_obj_conv.inner = (void*)(this_obj & (~1));
28079 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28080 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28081 PeerHandleError_free(this_obj_conv);
28084 jboolean __attribute__((visibility("default"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
28085 LDKPeerHandleError this_ptr_conv;
28086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28087 this_ptr_conv.is_owned = false;
28088 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28089 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
28093 void __attribute__((visibility("default"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
28094 LDKPeerHandleError this_ptr_conv;
28095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28096 this_ptr_conv.is_owned = false;
28097 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28098 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
28101 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
28102 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
28103 uint64_t ret_ref = 0;
28104 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28105 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28106 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28107 ret_ref = (uint64_t)ret_var.inner;
28108 if (ret_var.is_owned) {
28114 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
28115 LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
28116 uint64_t ret_ref = 0;
28117 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28118 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28119 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28120 ret_ref = (uint64_t)ret_var.inner;
28121 if (ret_var.is_owned) {
28126 int64_t __attribute__((visibility("default"))) TS_PeerHandleError_clone_ptr(uint32_t arg) {
28127 LDKPeerHandleError arg_conv;
28128 arg_conv.inner = (void*)(arg & (~1));
28129 arg_conv.is_owned = false;
28130 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28131 int64_t ret_val = PeerHandleError_clone_ptr(&arg_conv);
28135 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_clone(uint32_t orig) {
28136 LDKPeerHandleError orig_conv;
28137 orig_conv.inner = (void*)(orig & (~1));
28138 orig_conv.is_owned = false;
28139 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28140 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
28141 uint64_t ret_ref = 0;
28142 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28143 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28144 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28145 ret_ref = (uint64_t)ret_var.inner;
28146 if (ret_var.is_owned) {
28152 void __attribute__((visibility("default"))) TS_PeerManager_free(uint32_t this_obj) {
28153 LDKPeerManager this_obj_conv;
28154 this_obj_conv.inner = (void*)(this_obj & (~1));
28155 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28157 PeerManager_free(this_obj_conv);
28160 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) {
28161 LDKMessageHandler message_handler_conv;
28162 message_handler_conv.inner = (void*)(message_handler & (~1));
28163 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
28164 CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
28165 // Warning: we need a move here but no clone is available for LDKMessageHandler
28166 LDKSecretKey our_node_secret_ref;
28167 CHECK(*((uint32_t*)our_node_secret) == 32);
28168 memcpy(our_node_secret_ref.bytes, (uint8_t*)(our_node_secret + 4), 32);
28169 unsigned char ephemeral_random_data_arr[32];
28170 CHECK(*((uint32_t*)ephemeral_random_data) == 32);
28171 memcpy(ephemeral_random_data_arr, (uint8_t*)(ephemeral_random_data + 4), 32);
28172 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
28173 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
28174 CHECK_ACCESS(logger_ptr);
28175 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28176 void* custom_message_handler_ptr = (void*)(((uint64_t)custom_message_handler) & ~1);
28177 CHECK_ACCESS(custom_message_handler_ptr);
28178 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
28179 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
28180 uint64_t ret_ref = 0;
28181 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28182 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28183 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28184 ret_ref = (uint64_t)ret_var.inner;
28185 if (ret_var.is_owned) {
28191 ptrArray __attribute__((visibility("default"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
28192 LDKPeerManager this_arg_conv;
28193 this_arg_conv.inner = (void*)(this_arg & (~1));
28194 this_arg_conv.is_owned = false;
28195 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28196 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
28197 ptrArray ret_arr = NULL;
28198 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
28199 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
28200 for (size_t m = 0; m < ret_var.datalen; m++) {
28201 int8_tArray ret_conv_12_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
28202 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].compressed_form, 33);
28203 ret_arr_ptr[m] = ret_conv_12_arr;
28206 FREE(ret_var.data);
28210 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_outbound_connection(uint32_t this_arg, int8_tArray their_node_id, uint32_t descriptor) {
28211 LDKPeerManager this_arg_conv;
28212 this_arg_conv.inner = (void*)(this_arg & (~1));
28213 this_arg_conv.is_owned = false;
28214 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28215 LDKPublicKey their_node_id_ref;
28216 CHECK(*((uint32_t*)their_node_id) == 33);
28217 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
28218 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28219 CHECK_ACCESS(descriptor_ptr);
28220 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
28221 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
28222 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
28223 return (uint64_t)ret_conv;
28226 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_inbound_connection(uint32_t this_arg, uint32_t descriptor) {
28227 LDKPeerManager this_arg_conv;
28228 this_arg_conv.inner = (void*)(this_arg & (~1));
28229 this_arg_conv.is_owned = false;
28230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28231 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28232 CHECK_ACCESS(descriptor_ptr);
28233 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
28234 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
28235 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
28236 return (uint64_t)ret_conv;
28239 uint32_t __attribute__((visibility("default"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
28240 LDKPeerManager this_arg_conv;
28241 this_arg_conv.inner = (void*)(this_arg & (~1));
28242 this_arg_conv.is_owned = false;
28243 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28244 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28245 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
28246 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
28247 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
28248 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
28249 return (uint64_t)ret_conv;
28252 uint32_t __attribute__((visibility("default"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
28253 LDKPeerManager this_arg_conv;
28254 this_arg_conv.inner = (void*)(this_arg & (~1));
28255 this_arg_conv.is_owned = false;
28256 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28257 void* peer_descriptor_ptr = (void*)(((uint64_t)peer_descriptor) & ~1);
28258 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
28259 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
28260 LDKu8slice data_ref;
28261 data_ref.datalen = *((uint32_t*)data);
28262 data_ref.data = (int8_t*)(data + 4);
28263 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
28264 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
28265 return (uint64_t)ret_conv;
28268 void __attribute__((visibility("default"))) TS_PeerManager_process_events(uint32_t this_arg) {
28269 LDKPeerManager this_arg_conv;
28270 this_arg_conv.inner = (void*)(this_arg & (~1));
28271 this_arg_conv.is_owned = false;
28272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28273 PeerManager_process_events(&this_arg_conv);
28276 void __attribute__((visibility("default"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
28277 LDKPeerManager this_arg_conv;
28278 this_arg_conv.inner = (void*)(this_arg & (~1));
28279 this_arg_conv.is_owned = false;
28280 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28281 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28282 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
28283 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
28284 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
28287 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_by_node_id(uint32_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
28288 LDKPeerManager this_arg_conv;
28289 this_arg_conv.inner = (void*)(this_arg & (~1));
28290 this_arg_conv.is_owned = false;
28291 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28292 LDKPublicKey node_id_ref;
28293 CHECK(*((uint32_t*)node_id) == 33);
28294 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
28295 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
28298 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_all_peers(uint32_t this_arg) {
28299 LDKPeerManager this_arg_conv;
28300 this_arg_conv.inner = (void*)(this_arg & (~1));
28301 this_arg_conv.is_owned = false;
28302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28303 PeerManager_disconnect_all_peers(&this_arg_conv);
28306 void __attribute__((visibility("default"))) TS_PeerManager_timer_tick_occurred(uint32_t this_arg) {
28307 LDKPeerManager this_arg_conv;
28308 this_arg_conv.inner = (void*)(this_arg & (~1));
28309 this_arg_conv.is_owned = false;
28310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28311 PeerManager_timer_tick_occurred(&this_arg_conv);
28314 int8_tArray __attribute__((visibility("default"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
28315 unsigned char commitment_seed_arr[32];
28316 CHECK(*((uint32_t*)commitment_seed) == 32);
28317 memcpy(commitment_seed_arr, (uint8_t*)(commitment_seed + 4), 32);
28318 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
28319 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
28320 memcpy((uint8_t*)(ret_arr + 4), build_commitment_secret(commitment_seed_ref, idx).data, 32);
28324 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) {
28325 LDKCVec_u8Z to_holder_script_ref;
28326 to_holder_script_ref.datalen = *((uint32_t*)to_holder_script);
28327 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
28328 memcpy(to_holder_script_ref.data, (uint8_t*)(to_holder_script + 4), to_holder_script_ref.datalen);
28329 LDKCVec_u8Z to_counterparty_script_ref;
28330 to_counterparty_script_ref.datalen = *((uint32_t*)to_counterparty_script);
28331 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
28332 memcpy(to_counterparty_script_ref.data, (uint8_t*)(to_counterparty_script + 4), to_counterparty_script_ref.datalen);
28333 LDKOutPoint funding_outpoint_conv;
28334 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
28335 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
28336 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
28337 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
28338 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);
28339 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28340 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28341 Transaction_free(ret_var);
28345 uint32_t __attribute__((visibility("default"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
28346 LDKPublicKey per_commitment_point_ref;
28347 CHECK(*((uint32_t*)per_commitment_point) == 33);
28348 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
28349 unsigned char base_secret_arr[32];
28350 CHECK(*((uint32_t*)base_secret) == 32);
28351 memcpy(base_secret_arr, (uint8_t*)(base_secret + 4), 32);
28352 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
28353 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
28354 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
28355 return (uint64_t)ret_conv;
28358 uint32_t __attribute__((visibility("default"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
28359 LDKPublicKey per_commitment_point_ref;
28360 CHECK(*((uint32_t*)per_commitment_point) == 33);
28361 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
28362 LDKPublicKey base_point_ref;
28363 CHECK(*((uint32_t*)base_point) == 33);
28364 memcpy(base_point_ref.compressed_form, (uint8_t*)(base_point + 4), 33);
28365 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
28366 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
28367 return (uint64_t)ret_conv;
28370 uint32_t __attribute__((visibility("default"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
28371 unsigned char per_commitment_secret_arr[32];
28372 CHECK(*((uint32_t*)per_commitment_secret) == 32);
28373 memcpy(per_commitment_secret_arr, (uint8_t*)(per_commitment_secret + 4), 32);
28374 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
28375 unsigned char countersignatory_revocation_base_secret_arr[32];
28376 CHECK(*((uint32_t*)countersignatory_revocation_base_secret) == 32);
28377 memcpy(countersignatory_revocation_base_secret_arr, (uint8_t*)(countersignatory_revocation_base_secret + 4), 32);
28378 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
28379 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
28380 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
28381 return (uint64_t)ret_conv;
28384 uint32_t __attribute__((visibility("default"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
28385 LDKPublicKey per_commitment_point_ref;
28386 CHECK(*((uint32_t*)per_commitment_point) == 33);
28387 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
28388 LDKPublicKey countersignatory_revocation_base_point_ref;
28389 CHECK(*((uint32_t*)countersignatory_revocation_base_point) == 33);
28390 memcpy(countersignatory_revocation_base_point_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base_point + 4), 33);
28391 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
28392 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
28393 return (uint64_t)ret_conv;
28396 void __attribute__((visibility("default"))) TS_TxCreationKeys_free(uint32_t this_obj) {
28397 LDKTxCreationKeys this_obj_conv;
28398 this_obj_conv.inner = (void*)(this_obj & (~1));
28399 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28400 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28401 TxCreationKeys_free(this_obj_conv);
28404 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
28405 LDKTxCreationKeys this_ptr_conv;
28406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28407 this_ptr_conv.is_owned = false;
28408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28409 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
28410 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
28414 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
28415 LDKTxCreationKeys this_ptr_conv;
28416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28417 this_ptr_conv.is_owned = false;
28418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28419 LDKPublicKey val_ref;
28420 CHECK(*((uint32_t*)val) == 33);
28421 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
28422 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
28425 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
28426 LDKTxCreationKeys this_ptr_conv;
28427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28428 this_ptr_conv.is_owned = false;
28429 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28430 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
28431 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
28435 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
28436 LDKTxCreationKeys this_ptr_conv;
28437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28438 this_ptr_conv.is_owned = false;
28439 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28440 LDKPublicKey val_ref;
28441 CHECK(*((uint32_t*)val) == 33);
28442 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
28443 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
28446 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
28447 LDKTxCreationKeys this_ptr_conv;
28448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28449 this_ptr_conv.is_owned = false;
28450 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28451 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
28452 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
28456 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
28457 LDKTxCreationKeys this_ptr_conv;
28458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28459 this_ptr_conv.is_owned = false;
28460 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28461 LDKPublicKey val_ref;
28462 CHECK(*((uint32_t*)val) == 33);
28463 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
28464 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
28467 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
28468 LDKTxCreationKeys this_ptr_conv;
28469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28470 this_ptr_conv.is_owned = false;
28471 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28472 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
28473 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
28477 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
28478 LDKTxCreationKeys this_ptr_conv;
28479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28480 this_ptr_conv.is_owned = false;
28481 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28482 LDKPublicKey val_ref;
28483 CHECK(*((uint32_t*)val) == 33);
28484 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
28485 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
28488 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
28489 LDKTxCreationKeys this_ptr_conv;
28490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28491 this_ptr_conv.is_owned = false;
28492 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28493 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
28494 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
28498 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint32_t this_ptr, int8_tArray val) {
28499 LDKTxCreationKeys this_ptr_conv;
28500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28501 this_ptr_conv.is_owned = false;
28502 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28503 LDKPublicKey val_ref;
28504 CHECK(*((uint32_t*)val) == 33);
28505 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
28506 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
28509 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) {
28510 LDKPublicKey per_commitment_point_arg_ref;
28511 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
28512 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
28513 LDKPublicKey revocation_key_arg_ref;
28514 CHECK(*((uint32_t*)revocation_key_arg) == 33);
28515 memcpy(revocation_key_arg_ref.compressed_form, (uint8_t*)(revocation_key_arg + 4), 33);
28516 LDKPublicKey broadcaster_htlc_key_arg_ref;
28517 CHECK(*((uint32_t*)broadcaster_htlc_key_arg) == 33);
28518 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_htlc_key_arg + 4), 33);
28519 LDKPublicKey countersignatory_htlc_key_arg_ref;
28520 CHECK(*((uint32_t*)countersignatory_htlc_key_arg) == 33);
28521 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, (uint8_t*)(countersignatory_htlc_key_arg + 4), 33);
28522 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
28523 CHECK(*((uint32_t*)broadcaster_delayed_payment_key_arg) == 33);
28524 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key_arg + 4), 33);
28525 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);
28526 uint64_t ret_ref = 0;
28527 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28528 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28529 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28530 ret_ref = (uint64_t)ret_var.inner;
28531 if (ret_var.is_owned) {
28537 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
28538 LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
28539 uint64_t ret_ref = 0;
28540 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28541 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28542 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28543 ret_ref = (uint64_t)ret_var.inner;
28544 if (ret_var.is_owned) {
28549 int64_t __attribute__((visibility("default"))) TS_TxCreationKeys_clone_ptr(uint32_t arg) {
28550 LDKTxCreationKeys arg_conv;
28551 arg_conv.inner = (void*)(arg & (~1));
28552 arg_conv.is_owned = false;
28553 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28554 int64_t ret_val = TxCreationKeys_clone_ptr(&arg_conv);
28558 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_clone(uint32_t orig) {
28559 LDKTxCreationKeys orig_conv;
28560 orig_conv.inner = (void*)(orig & (~1));
28561 orig_conv.is_owned = false;
28562 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28563 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
28564 uint64_t ret_ref = 0;
28565 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28566 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28567 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28568 ret_ref = (uint64_t)ret_var.inner;
28569 if (ret_var.is_owned) {
28575 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_write(uint32_t obj) {
28576 LDKTxCreationKeys obj_conv;
28577 obj_conv.inner = (void*)(obj & (~1));
28578 obj_conv.is_owned = false;
28579 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28580 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
28581 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28582 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28583 CVec_u8Z_free(ret_var);
28587 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_read(int8_tArray ser) {
28588 LDKu8slice ser_ref;
28589 ser_ref.datalen = *((uint32_t*)ser);
28590 ser_ref.data = (int8_t*)(ser + 4);
28591 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
28592 *ret_conv = TxCreationKeys_read(ser_ref);
28593 return (uint64_t)ret_conv;
28596 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_free(uint32_t this_obj) {
28597 LDKChannelPublicKeys this_obj_conv;
28598 this_obj_conv.inner = (void*)(this_obj & (~1));
28599 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28600 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28601 ChannelPublicKeys_free(this_obj_conv);
28604 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
28605 LDKChannelPublicKeys this_ptr_conv;
28606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28607 this_ptr_conv.is_owned = false;
28608 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28609 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
28610 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
28614 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
28615 LDKChannelPublicKeys this_ptr_conv;
28616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28617 this_ptr_conv.is_owned = false;
28618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28619 LDKPublicKey val_ref;
28620 CHECK(*((uint32_t*)val) == 33);
28621 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
28622 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
28625 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
28626 LDKChannelPublicKeys this_ptr_conv;
28627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28628 this_ptr_conv.is_owned = false;
28629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28630 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
28631 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
28635 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
28636 LDKChannelPublicKeys this_ptr_conv;
28637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28638 this_ptr_conv.is_owned = false;
28639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28640 LDKPublicKey val_ref;
28641 CHECK(*((uint32_t*)val) == 33);
28642 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
28643 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
28646 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
28647 LDKChannelPublicKeys this_ptr_conv;
28648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28649 this_ptr_conv.is_owned = false;
28650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28651 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
28652 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
28656 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
28657 LDKChannelPublicKeys this_ptr_conv;
28658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28659 this_ptr_conv.is_owned = false;
28660 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28661 LDKPublicKey val_ref;
28662 CHECK(*((uint32_t*)val) == 33);
28663 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
28664 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
28667 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
28668 LDKChannelPublicKeys this_ptr_conv;
28669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28670 this_ptr_conv.is_owned = false;
28671 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28672 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
28673 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
28677 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
28678 LDKChannelPublicKeys this_ptr_conv;
28679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28680 this_ptr_conv.is_owned = false;
28681 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28682 LDKPublicKey val_ref;
28683 CHECK(*((uint32_t*)val) == 33);
28684 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
28685 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
28688 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
28689 LDKChannelPublicKeys this_ptr_conv;
28690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28691 this_ptr_conv.is_owned = false;
28692 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28693 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
28694 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
28698 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
28699 LDKChannelPublicKeys this_ptr_conv;
28700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28701 this_ptr_conv.is_owned = false;
28702 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28703 LDKPublicKey val_ref;
28704 CHECK(*((uint32_t*)val) == 33);
28705 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
28706 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
28709 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) {
28710 LDKPublicKey funding_pubkey_arg_ref;
28711 CHECK(*((uint32_t*)funding_pubkey_arg) == 33);
28712 memcpy(funding_pubkey_arg_ref.compressed_form, (uint8_t*)(funding_pubkey_arg + 4), 33);
28713 LDKPublicKey revocation_basepoint_arg_ref;
28714 CHECK(*((uint32_t*)revocation_basepoint_arg) == 33);
28715 memcpy(revocation_basepoint_arg_ref.compressed_form, (uint8_t*)(revocation_basepoint_arg + 4), 33);
28716 LDKPublicKey payment_point_arg_ref;
28717 CHECK(*((uint32_t*)payment_point_arg) == 33);
28718 memcpy(payment_point_arg_ref.compressed_form, (uint8_t*)(payment_point_arg + 4), 33);
28719 LDKPublicKey delayed_payment_basepoint_arg_ref;
28720 CHECK(*((uint32_t*)delayed_payment_basepoint_arg) == 33);
28721 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, (uint8_t*)(delayed_payment_basepoint_arg + 4), 33);
28722 LDKPublicKey htlc_basepoint_arg_ref;
28723 CHECK(*((uint32_t*)htlc_basepoint_arg) == 33);
28724 memcpy(htlc_basepoint_arg_ref.compressed_form, (uint8_t*)(htlc_basepoint_arg + 4), 33);
28725 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);
28726 uint64_t ret_ref = 0;
28727 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28728 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28729 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28730 ret_ref = (uint64_t)ret_var.inner;
28731 if (ret_var.is_owned) {
28737 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
28738 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
28739 uint64_t ret_ref = 0;
28740 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28741 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28742 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28743 ret_ref = (uint64_t)ret_var.inner;
28744 if (ret_var.is_owned) {
28749 int64_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_clone_ptr(uint32_t arg) {
28750 LDKChannelPublicKeys arg_conv;
28751 arg_conv.inner = (void*)(arg & (~1));
28752 arg_conv.is_owned = false;
28753 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28754 int64_t ret_val = ChannelPublicKeys_clone_ptr(&arg_conv);
28758 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
28759 LDKChannelPublicKeys orig_conv;
28760 orig_conv.inner = (void*)(orig & (~1));
28761 orig_conv.is_owned = false;
28762 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28763 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
28764 uint64_t ret_ref = 0;
28765 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28766 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28767 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28768 ret_ref = (uint64_t)ret_var.inner;
28769 if (ret_var.is_owned) {
28775 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_write(uint32_t obj) {
28776 LDKChannelPublicKeys obj_conv;
28777 obj_conv.inner = (void*)(obj & (~1));
28778 obj_conv.is_owned = false;
28779 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28780 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
28781 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28782 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28783 CVec_u8Z_free(ret_var);
28787 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
28788 LDKu8slice ser_ref;
28789 ser_ref.datalen = *((uint32_t*)ser);
28790 ser_ref.data = (int8_t*)(ser + 4);
28791 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
28792 *ret_conv = ChannelPublicKeys_read(ser_ref);
28793 return (uint64_t)ret_conv;
28796 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) {
28797 LDKPublicKey per_commitment_point_ref;
28798 CHECK(*((uint32_t*)per_commitment_point) == 33);
28799 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
28800 LDKPublicKey broadcaster_delayed_payment_base_ref;
28801 CHECK(*((uint32_t*)broadcaster_delayed_payment_base) == 33);
28802 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_base + 4), 33);
28803 LDKPublicKey broadcaster_htlc_base_ref;
28804 CHECK(*((uint32_t*)broadcaster_htlc_base) == 33);
28805 memcpy(broadcaster_htlc_base_ref.compressed_form, (uint8_t*)(broadcaster_htlc_base + 4), 33);
28806 LDKPublicKey countersignatory_revocation_base_ref;
28807 CHECK(*((uint32_t*)countersignatory_revocation_base) == 33);
28808 memcpy(countersignatory_revocation_base_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base + 4), 33);
28809 LDKPublicKey countersignatory_htlc_base_ref;
28810 CHECK(*((uint32_t*)countersignatory_htlc_base) == 33);
28811 memcpy(countersignatory_htlc_base_ref.compressed_form, (uint8_t*)(countersignatory_htlc_base + 4), 33);
28812 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
28813 *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);
28814 return (uint64_t)ret_conv;
28817 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
28818 LDKPublicKey per_commitment_point_ref;
28819 CHECK(*((uint32_t*)per_commitment_point) == 33);
28820 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
28821 LDKChannelPublicKeys broadcaster_keys_conv;
28822 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
28823 broadcaster_keys_conv.is_owned = false;
28824 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
28825 LDKChannelPublicKeys countersignatory_keys_conv;
28826 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
28827 countersignatory_keys_conv.is_owned = false;
28828 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
28829 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
28830 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
28831 return (uint64_t)ret_conv;
28834 int8_tArray __attribute__((visibility("default"))) TS_get_revokeable_redeemscript(int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
28835 LDKPublicKey revocation_key_ref;
28836 CHECK(*((uint32_t*)revocation_key) == 33);
28837 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
28838 LDKPublicKey broadcaster_delayed_payment_key_ref;
28839 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
28840 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
28841 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
28842 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28843 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28844 CVec_u8Z_free(ret_var);
28848 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_free(uint32_t this_obj) {
28849 LDKHTLCOutputInCommitment this_obj_conv;
28850 this_obj_conv.inner = (void*)(this_obj & (~1));
28851 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28852 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28853 HTLCOutputInCommitment_free(this_obj_conv);
28856 jboolean __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
28857 LDKHTLCOutputInCommitment this_ptr_conv;
28858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28859 this_ptr_conv.is_owned = false;
28860 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28861 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
28865 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
28866 LDKHTLCOutputInCommitment this_ptr_conv;
28867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28868 this_ptr_conv.is_owned = false;
28869 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28870 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
28873 int64_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
28874 LDKHTLCOutputInCommitment this_ptr_conv;
28875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28876 this_ptr_conv.is_owned = false;
28877 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28878 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
28882 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
28883 LDKHTLCOutputInCommitment this_ptr_conv;
28884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28885 this_ptr_conv.is_owned = false;
28886 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28887 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
28890 int32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
28891 LDKHTLCOutputInCommitment this_ptr_conv;
28892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28893 this_ptr_conv.is_owned = false;
28894 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28895 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
28899 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
28900 LDKHTLCOutputInCommitment this_ptr_conv;
28901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28902 this_ptr_conv.is_owned = false;
28903 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28904 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
28907 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
28908 LDKHTLCOutputInCommitment this_ptr_conv;
28909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28910 this_ptr_conv.is_owned = false;
28911 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28912 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
28913 memcpy((uint8_t*)(ret_arr + 4), *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
28917 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
28918 LDKHTLCOutputInCommitment this_ptr_conv;
28919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28920 this_ptr_conv.is_owned = false;
28921 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28922 LDKThirtyTwoBytes val_ref;
28923 CHECK(*((uint32_t*)val) == 32);
28924 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
28925 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
28928 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint32_t this_ptr) {
28929 LDKHTLCOutputInCommitment this_ptr_conv;
28930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28931 this_ptr_conv.is_owned = false;
28932 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28933 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
28934 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
28935 uint64_t ret_ref = (uint64_t)ret_copy;
28939 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint32_t this_ptr, uint32_t val) {
28940 LDKHTLCOutputInCommitment this_ptr_conv;
28941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28942 this_ptr_conv.is_owned = false;
28943 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28944 void* val_ptr = (void*)(((uint64_t)val) & ~1);
28945 CHECK_ACCESS(val_ptr);
28946 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
28947 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
28948 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
28951 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) {
28952 LDKThirtyTwoBytes payment_hash_arg_ref;
28953 CHECK(*((uint32_t*)payment_hash_arg) == 32);
28954 memcpy(payment_hash_arg_ref.data, (uint8_t*)(payment_hash_arg + 4), 32);
28955 void* transaction_output_index_arg_ptr = (void*)(((uint64_t)transaction_output_index_arg) & ~1);
28956 CHECK_ACCESS(transaction_output_index_arg_ptr);
28957 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
28958 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1));
28959 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
28960 uint64_t ret_ref = 0;
28961 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28962 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28963 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28964 ret_ref = (uint64_t)ret_var.inner;
28965 if (ret_var.is_owned) {
28971 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
28972 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
28973 uint64_t ret_ref = 0;
28974 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28975 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28976 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28977 ret_ref = (uint64_t)ret_var.inner;
28978 if (ret_var.is_owned) {
28983 int64_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_clone_ptr(uint32_t arg) {
28984 LDKHTLCOutputInCommitment arg_conv;
28985 arg_conv.inner = (void*)(arg & (~1));
28986 arg_conv.is_owned = false;
28987 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28988 int64_t ret_val = HTLCOutputInCommitment_clone_ptr(&arg_conv);
28992 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
28993 LDKHTLCOutputInCommitment orig_conv;
28994 orig_conv.inner = (void*)(orig & (~1));
28995 orig_conv.is_owned = false;
28996 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28997 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
28998 uint64_t ret_ref = 0;
28999 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29000 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29001 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29002 ret_ref = (uint64_t)ret_var.inner;
29003 if (ret_var.is_owned) {
29009 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
29010 LDKHTLCOutputInCommitment obj_conv;
29011 obj_conv.inner = (void*)(obj & (~1));
29012 obj_conv.is_owned = false;
29013 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29014 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
29015 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
29016 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
29017 CVec_u8Z_free(ret_var);
29021 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
29022 LDKu8slice ser_ref;
29023 ser_ref.datalen = *((uint32_t*)ser);
29024 ser_ref.data = (int8_t*)(ser + 4);
29025 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
29026 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
29027 return (uint64_t)ret_conv;
29030 int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uint32_t htlc, uint32_t keys) {
29031 LDKHTLCOutputInCommitment htlc_conv;
29032 htlc_conv.inner = (void*)(htlc & (~1));
29033 htlc_conv.is_owned = false;
29034 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
29035 LDKTxCreationKeys keys_conv;
29036 keys_conv.inner = (void*)(keys & (~1));
29037 keys_conv.is_owned = false;
29038 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
29039 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
29040 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
29041 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
29042 CVec_u8Z_free(ret_var);
29046 int8_tArray __attribute__((visibility("default"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
29047 LDKPublicKey broadcaster_ref;
29048 CHECK(*((uint32_t*)broadcaster) == 33);
29049 memcpy(broadcaster_ref.compressed_form, (uint8_t*)(broadcaster + 4), 33);
29050 LDKPublicKey countersignatory_ref;
29051 CHECK(*((uint32_t*)countersignatory) == 33);
29052 memcpy(countersignatory_ref.compressed_form, (uint8_t*)(countersignatory + 4), 33);
29053 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
29054 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
29055 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
29056 CVec_u8Z_free(ret_var);
29060 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, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
29061 unsigned char commitment_txid_arr[32];
29062 CHECK(*((uint32_t*)commitment_txid) == 32);
29063 memcpy(commitment_txid_arr, (uint8_t*)(commitment_txid + 4), 32);
29064 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
29065 LDKHTLCOutputInCommitment htlc_conv;
29066 htlc_conv.inner = (void*)(htlc & (~1));
29067 htlc_conv.is_owned = false;
29068 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
29069 LDKPublicKey broadcaster_delayed_payment_key_ref;
29070 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
29071 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
29072 LDKPublicKey revocation_key_ref;
29073 CHECK(*((uint32_t*)revocation_key) == 33);
29074 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
29075 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
29076 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
29077 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
29078 Transaction_free(ret_var);
29082 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) {
29083 LDKChannelTransactionParameters this_obj_conv;
29084 this_obj_conv.inner = (void*)(this_obj & (~1));
29085 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29086 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29087 ChannelTransactionParameters_free(this_obj_conv);
29090 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
29091 LDKChannelTransactionParameters this_ptr_conv;
29092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29093 this_ptr_conv.is_owned = false;
29094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29095 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
29096 uint64_t ret_ref = 0;
29097 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29098 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29099 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29100 ret_ref = (uint64_t)ret_var.inner;
29101 if (ret_var.is_owned) {
29107 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
29108 LDKChannelTransactionParameters this_ptr_conv;
29109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29110 this_ptr_conv.is_owned = false;
29111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29112 LDKChannelPublicKeys val_conv;
29113 val_conv.inner = (void*)(val & (~1));
29114 val_conv.is_owned = (val & 1) || (val == 0);
29115 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29116 val_conv = ChannelPublicKeys_clone(&val_conv);
29117 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
29120 int16_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
29121 LDKChannelTransactionParameters this_ptr_conv;
29122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29123 this_ptr_conv.is_owned = false;
29124 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29125 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
29129 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_selected_contest_delay(uint32_t this_ptr, int16_t val) {
29130 LDKChannelTransactionParameters this_ptr_conv;
29131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29132 this_ptr_conv.is_owned = false;
29133 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29134 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
29137 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
29138 LDKChannelTransactionParameters this_ptr_conv;
29139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29140 this_ptr_conv.is_owned = false;
29141 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29142 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
29146 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
29147 LDKChannelTransactionParameters this_ptr_conv;
29148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29149 this_ptr_conv.is_owned = false;
29150 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29151 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
29154 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
29155 LDKChannelTransactionParameters this_ptr_conv;
29156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29157 this_ptr_conv.is_owned = false;
29158 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29159 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
29160 uint64_t ret_ref = 0;
29161 if ((uint64_t)ret_var.inner > 4096) {
29162 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29163 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29164 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29165 ret_ref = (uint64_t)ret_var.inner;
29166 if (ret_var.is_owned) {
29173 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
29174 LDKChannelTransactionParameters this_ptr_conv;
29175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29176 this_ptr_conv.is_owned = false;
29177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29178 LDKCounterpartyChannelTransactionParameters val_conv;
29179 val_conv.inner = (void*)(val & (~1));
29180 val_conv.is_owned = (val & 1) || (val == 0);
29181 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29182 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
29183 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
29186 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
29187 LDKChannelTransactionParameters this_ptr_conv;
29188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29189 this_ptr_conv.is_owned = false;
29190 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29191 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
29192 uint64_t ret_ref = 0;
29193 if ((uint64_t)ret_var.inner > 4096) {
29194 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29195 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29196 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29197 ret_ref = (uint64_t)ret_var.inner;
29198 if (ret_var.is_owned) {
29205 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
29206 LDKChannelTransactionParameters this_ptr_conv;
29207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29208 this_ptr_conv.is_owned = false;
29209 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29210 LDKOutPoint val_conv;
29211 val_conv.inner = (void*)(val & (~1));
29212 val_conv.is_owned = (val & 1) || (val == 0);
29213 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29214 val_conv = OutPoint_clone(&val_conv);
29215 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
29218 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) {
29219 LDKChannelPublicKeys holder_pubkeys_arg_conv;
29220 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
29221 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
29222 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
29223 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
29224 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
29225 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
29226 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
29227 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
29228 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
29229 LDKOutPoint funding_outpoint_arg_conv;
29230 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
29231 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
29232 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
29233 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
29234 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);
29235 uint64_t ret_ref = 0;
29236 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29237 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29238 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29239 ret_ref = (uint64_t)ret_var.inner;
29240 if (ret_var.is_owned) {
29246 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
29247 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
29248 uint64_t ret_ref = 0;
29249 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29250 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29251 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29252 ret_ref = (uint64_t)ret_var.inner;
29253 if (ret_var.is_owned) {
29258 int64_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_clone_ptr(uint32_t arg) {
29259 LDKChannelTransactionParameters arg_conv;
29260 arg_conv.inner = (void*)(arg & (~1));
29261 arg_conv.is_owned = false;
29262 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29263 int64_t ret_val = ChannelTransactionParameters_clone_ptr(&arg_conv);
29267 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
29268 LDKChannelTransactionParameters orig_conv;
29269 orig_conv.inner = (void*)(orig & (~1));
29270 orig_conv.is_owned = false;
29271 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29272 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
29273 uint64_t ret_ref = 0;
29274 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29275 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29276 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29277 ret_ref = (uint64_t)ret_var.inner;
29278 if (ret_var.is_owned) {
29284 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_obj) {
29285 LDKCounterpartyChannelTransactionParameters this_obj_conv;
29286 this_obj_conv.inner = (void*)(this_obj & (~1));
29287 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29288 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29289 CounterpartyChannelTransactionParameters_free(this_obj_conv);
29292 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
29293 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29295 this_ptr_conv.is_owned = false;
29296 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29297 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
29298 uint64_t ret_ref = 0;
29299 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29300 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29301 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29302 ret_ref = (uint64_t)ret_var.inner;
29303 if (ret_var.is_owned) {
29309 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
29310 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29312 this_ptr_conv.is_owned = false;
29313 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29314 LDKChannelPublicKeys val_conv;
29315 val_conv.inner = (void*)(val & (~1));
29316 val_conv.is_owned = (val & 1) || (val == 0);
29317 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29318 val_conv = ChannelPublicKeys_clone(&val_conv);
29319 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
29322 int16_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
29323 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29325 this_ptr_conv.is_owned = false;
29326 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29327 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
29331 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
29332 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29334 this_ptr_conv.is_owned = false;
29335 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29336 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
29339 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
29340 LDKChannelPublicKeys pubkeys_arg_conv;
29341 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
29342 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
29343 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
29344 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
29345 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
29346 uint64_t ret_ref = 0;
29347 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29348 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29349 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29350 ret_ref = (uint64_t)ret_var.inner;
29351 if (ret_var.is_owned) {
29357 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
29358 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
29359 uint64_t ret_ref = 0;
29360 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29361 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29362 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29363 ret_ref = (uint64_t)ret_var.inner;
29364 if (ret_var.is_owned) {
29369 int64_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint32_t arg) {
29370 LDKCounterpartyChannelTransactionParameters arg_conv;
29371 arg_conv.inner = (void*)(arg & (~1));
29372 arg_conv.is_owned = false;
29373 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29374 int64_t ret_val = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
29378 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
29379 LDKCounterpartyChannelTransactionParameters orig_conv;
29380 orig_conv.inner = (void*)(orig & (~1));
29381 orig_conv.is_owned = false;
29382 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29383 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
29384 uint64_t ret_ref = 0;
29385 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29386 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29387 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29388 ret_ref = (uint64_t)ret_var.inner;
29389 if (ret_var.is_owned) {
29395 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
29396 LDKChannelTransactionParameters this_arg_conv;
29397 this_arg_conv.inner = (void*)(this_arg & (~1));
29398 this_arg_conv.is_owned = false;
29399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29400 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
29404 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
29405 LDKChannelTransactionParameters this_arg_conv;
29406 this_arg_conv.inner = (void*)(this_arg & (~1));
29407 this_arg_conv.is_owned = false;
29408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29409 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
29410 uint64_t ret_ref = 0;
29411 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29412 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29413 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29414 ret_ref = (uint64_t)ret_var.inner;
29415 if (ret_var.is_owned) {
29421 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
29422 LDKChannelTransactionParameters this_arg_conv;
29423 this_arg_conv.inner = (void*)(this_arg & (~1));
29424 this_arg_conv.is_owned = false;
29425 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29426 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
29427 uint64_t ret_ref = 0;
29428 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29429 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29430 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29431 ret_ref = (uint64_t)ret_var.inner;
29432 if (ret_var.is_owned) {
29438 int8_tArray __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
29439 LDKCounterpartyChannelTransactionParameters obj_conv;
29440 obj_conv.inner = (void*)(obj & (~1));
29441 obj_conv.is_owned = false;
29442 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29443 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
29444 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
29445 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
29446 CVec_u8Z_free(ret_var);
29450 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
29451 LDKu8slice ser_ref;
29452 ser_ref.datalen = *((uint32_t*)ser);
29453 ser_ref.data = (int8_t*)(ser + 4);
29454 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
29455 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
29456 return (uint64_t)ret_conv;
29459 int8_tArray __attribute__((visibility("default"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
29460 LDKChannelTransactionParameters obj_conv;
29461 obj_conv.inner = (void*)(obj & (~1));
29462 obj_conv.is_owned = false;
29463 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29464 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
29465 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
29466 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
29467 CVec_u8Z_free(ret_var);
29471 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
29472 LDKu8slice ser_ref;
29473 ser_ref.datalen = *((uint32_t*)ser);
29474 ser_ref.data = (int8_t*)(ser + 4);
29475 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
29476 *ret_conv = ChannelTransactionParameters_read(ser_ref);
29477 return (uint64_t)ret_conv;
29480 void __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_obj) {
29481 LDKDirectedChannelTransactionParameters this_obj_conv;
29482 this_obj_conv.inner = (void*)(this_obj & (~1));
29483 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29484 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29485 DirectedChannelTransactionParameters_free(this_obj_conv);
29488 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
29489 LDKDirectedChannelTransactionParameters this_arg_conv;
29490 this_arg_conv.inner = (void*)(this_arg & (~1));
29491 this_arg_conv.is_owned = false;
29492 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29493 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
29494 uint64_t ret_ref = 0;
29495 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29496 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29497 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29498 ret_ref = (uint64_t)ret_var.inner;
29499 if (ret_var.is_owned) {
29505 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
29506 LDKDirectedChannelTransactionParameters this_arg_conv;
29507 this_arg_conv.inner = (void*)(this_arg & (~1));
29508 this_arg_conv.is_owned = false;
29509 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29510 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
29511 uint64_t ret_ref = 0;
29512 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29513 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29514 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29515 ret_ref = (uint64_t)ret_var.inner;
29516 if (ret_var.is_owned) {
29522 int16_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
29523 LDKDirectedChannelTransactionParameters this_arg_conv;
29524 this_arg_conv.inner = (void*)(this_arg & (~1));
29525 this_arg_conv.is_owned = false;
29526 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29527 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
29531 jboolean __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
29532 LDKDirectedChannelTransactionParameters this_arg_conv;
29533 this_arg_conv.inner = (void*)(this_arg & (~1));
29534 this_arg_conv.is_owned = false;
29535 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29536 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
29540 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
29541 LDKDirectedChannelTransactionParameters this_arg_conv;
29542 this_arg_conv.inner = (void*)(this_arg & (~1));
29543 this_arg_conv.is_owned = false;
29544 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29545 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
29546 uint64_t ret_ref = 0;
29547 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29548 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29549 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29550 ret_ref = (uint64_t)ret_var.inner;
29551 if (ret_var.is_owned) {
29557 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) {
29558 LDKHolderCommitmentTransaction this_obj_conv;
29559 this_obj_conv.inner = (void*)(this_obj & (~1));
29560 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29561 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29562 HolderCommitmentTransaction_free(this_obj_conv);
29565 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
29566 LDKHolderCommitmentTransaction this_ptr_conv;
29567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29568 this_ptr_conv.is_owned = false;
29569 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29570 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
29571 memcpy((uint8_t*)(ret_arr + 4), HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
29575 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
29576 LDKHolderCommitmentTransaction this_ptr_conv;
29577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29578 this_ptr_conv.is_owned = false;
29579 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29580 LDKSignature val_ref;
29581 CHECK(*((uint32_t*)val) == 64);
29582 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
29583 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
29586 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
29587 LDKHolderCommitmentTransaction this_ptr_conv;
29588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29589 this_ptr_conv.is_owned = false;
29590 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29591 LDKCVec_SignatureZ val_constr;
29592 val_constr.datalen = *((uint32_t*)val);
29593 if (val_constr.datalen > 0)
29594 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
29596 val_constr.data = NULL;
29597 int8_tArray* val_vals = (int8_tArray*)(val + 4);
29598 for (size_t m = 0; m < val_constr.datalen; m++) {
29599 int8_tArray val_conv_12 = val_vals[m];
29600 LDKSignature val_conv_12_ref;
29601 CHECK(*((uint32_t*)val_conv_12) == 64);
29602 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
29603 val_constr.data[m] = val_conv_12_ref;
29605 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
29608 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
29609 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
29610 uint64_t ret_ref = 0;
29611 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29612 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29613 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29614 ret_ref = (uint64_t)ret_var.inner;
29615 if (ret_var.is_owned) {
29620 int64_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_clone_ptr(uint32_t arg) {
29621 LDKHolderCommitmentTransaction arg_conv;
29622 arg_conv.inner = (void*)(arg & (~1));
29623 arg_conv.is_owned = false;
29624 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29625 int64_t ret_val = HolderCommitmentTransaction_clone_ptr(&arg_conv);
29629 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
29630 LDKHolderCommitmentTransaction orig_conv;
29631 orig_conv.inner = (void*)(orig & (~1));
29632 orig_conv.is_owned = false;
29633 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29634 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
29635 uint64_t ret_ref = 0;
29636 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29637 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29638 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29639 ret_ref = (uint64_t)ret_var.inner;
29640 if (ret_var.is_owned) {
29646 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
29647 LDKHolderCommitmentTransaction obj_conv;
29648 obj_conv.inner = (void*)(obj & (~1));
29649 obj_conv.is_owned = false;
29650 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29651 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
29652 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
29653 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
29654 CVec_u8Z_free(ret_var);
29658 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
29659 LDKu8slice ser_ref;
29660 ser_ref.datalen = *((uint32_t*)ser);
29661 ser_ref.data = (int8_t*)(ser + 4);
29662 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
29663 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
29664 return (uint64_t)ret_conv;
29667 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) {
29668 LDKCommitmentTransaction commitment_tx_conv;
29669 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
29670 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
29671 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
29672 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
29673 LDKSignature counterparty_sig_ref;
29674 CHECK(*((uint32_t*)counterparty_sig) == 64);
29675 memcpy(counterparty_sig_ref.compact_form, (uint8_t*)(counterparty_sig + 4), 64);
29676 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
29677 counterparty_htlc_sigs_constr.datalen = *((uint32_t*)counterparty_htlc_sigs);
29678 if (counterparty_htlc_sigs_constr.datalen > 0)
29679 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
29681 counterparty_htlc_sigs_constr.data = NULL;
29682 int8_tArray* counterparty_htlc_sigs_vals = (int8_tArray*)(counterparty_htlc_sigs + 4);
29683 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
29684 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
29685 LDKSignature counterparty_htlc_sigs_conv_12_ref;
29686 CHECK(*((uint32_t*)counterparty_htlc_sigs_conv_12) == 64);
29687 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, (uint8_t*)(counterparty_htlc_sigs_conv_12 + 4), 64);
29688 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
29690 LDKPublicKey holder_funding_key_ref;
29691 CHECK(*((uint32_t*)holder_funding_key) == 33);
29692 memcpy(holder_funding_key_ref.compressed_form, (uint8_t*)(holder_funding_key + 4), 33);
29693 LDKPublicKey counterparty_funding_key_ref;
29694 CHECK(*((uint32_t*)counterparty_funding_key) == 33);
29695 memcpy(counterparty_funding_key_ref.compressed_form, (uint8_t*)(counterparty_funding_key + 4), 33);
29696 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
29697 uint64_t ret_ref = 0;
29698 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29699 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29700 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29701 ret_ref = (uint64_t)ret_var.inner;
29702 if (ret_var.is_owned) {
29708 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_free(uint32_t this_obj) {
29709 LDKBuiltCommitmentTransaction this_obj_conv;
29710 this_obj_conv.inner = (void*)(this_obj & (~1));
29711 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29712 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29713 BuiltCommitmentTransaction_free(this_obj_conv);
29716 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
29717 LDKBuiltCommitmentTransaction this_ptr_conv;
29718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29719 this_ptr_conv.is_owned = false;
29720 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29721 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
29722 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
29723 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
29724 Transaction_free(ret_var);
29728 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
29729 LDKBuiltCommitmentTransaction this_ptr_conv;
29730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29731 this_ptr_conv.is_owned = false;
29732 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29733 LDKTransaction val_ref;
29734 val_ref.datalen = *((uint32_t*)val);
29735 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
29736 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
29737 val_ref.data_is_owned = true;
29738 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
29741 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
29742 LDKBuiltCommitmentTransaction this_ptr_conv;
29743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29744 this_ptr_conv.is_owned = false;
29745 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29746 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
29747 memcpy((uint8_t*)(ret_arr + 4), *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
29751 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
29752 LDKBuiltCommitmentTransaction this_ptr_conv;
29753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29754 this_ptr_conv.is_owned = false;
29755 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29756 LDKThirtyTwoBytes val_ref;
29757 CHECK(*((uint32_t*)val) == 32);
29758 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
29759 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
29762 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
29763 LDKTransaction transaction_arg_ref;
29764 transaction_arg_ref.datalen = *((uint32_t*)transaction_arg);
29765 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
29766 memcpy(transaction_arg_ref.data, (uint8_t*)(transaction_arg + 4), transaction_arg_ref.datalen);
29767 transaction_arg_ref.data_is_owned = true;
29768 LDKThirtyTwoBytes txid_arg_ref;
29769 CHECK(*((uint32_t*)txid_arg) == 32);
29770 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
29771 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
29772 uint64_t ret_ref = 0;
29773 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29774 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29775 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29776 ret_ref = (uint64_t)ret_var.inner;
29777 if (ret_var.is_owned) {
29783 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
29784 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
29785 uint64_t ret_ref = 0;
29786 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29787 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29788 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29789 ret_ref = (uint64_t)ret_var.inner;
29790 if (ret_var.is_owned) {
29795 int64_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_clone_ptr(uint32_t arg) {
29796 LDKBuiltCommitmentTransaction arg_conv;
29797 arg_conv.inner = (void*)(arg & (~1));
29798 arg_conv.is_owned = false;
29799 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29800 int64_t ret_val = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
29804 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
29805 LDKBuiltCommitmentTransaction orig_conv;
29806 orig_conv.inner = (void*)(orig & (~1));
29807 orig_conv.is_owned = false;
29808 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29809 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
29810 uint64_t ret_ref = 0;
29811 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29812 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29813 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29814 ret_ref = (uint64_t)ret_var.inner;
29815 if (ret_var.is_owned) {
29821 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
29822 LDKBuiltCommitmentTransaction obj_conv;
29823 obj_conv.inner = (void*)(obj & (~1));
29824 obj_conv.is_owned = false;
29825 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29826 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
29827 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
29828 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
29829 CVec_u8Z_free(ret_var);
29833 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
29834 LDKu8slice ser_ref;
29835 ser_ref.datalen = *((uint32_t*)ser);
29836 ser_ref.data = (int8_t*)(ser + 4);
29837 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
29838 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
29839 return (uint64_t)ret_conv;
29842 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
29843 LDKBuiltCommitmentTransaction this_arg_conv;
29844 this_arg_conv.inner = (void*)(this_arg & (~1));
29845 this_arg_conv.is_owned = false;
29846 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29847 LDKu8slice funding_redeemscript_ref;
29848 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
29849 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
29850 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
29851 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
29855 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) {
29856 LDKBuiltCommitmentTransaction this_arg_conv;
29857 this_arg_conv.inner = (void*)(this_arg & (~1));
29858 this_arg_conv.is_owned = false;
29859 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29860 unsigned char funding_key_arr[32];
29861 CHECK(*((uint32_t*)funding_key) == 32);
29862 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
29863 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
29864 LDKu8slice funding_redeemscript_ref;
29865 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
29866 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
29867 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
29868 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
29872 void __attribute__((visibility("default"))) TS_ClosingTransaction_free(uint32_t this_obj) {
29873 LDKClosingTransaction this_obj_conv;
29874 this_obj_conv.inner = (void*)(this_obj & (~1));
29875 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29877 ClosingTransaction_free(this_obj_conv);
29880 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
29881 LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
29882 uint64_t ret_ref = 0;
29883 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29884 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29885 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29886 ret_ref = (uint64_t)ret_var.inner;
29887 if (ret_var.is_owned) {
29892 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_clone_ptr(uint32_t arg) {
29893 LDKClosingTransaction arg_conv;
29894 arg_conv.inner = (void*)(arg & (~1));
29895 arg_conv.is_owned = false;
29896 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29897 int64_t ret_val = ClosingTransaction_clone_ptr(&arg_conv);
29901 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_clone(uint32_t orig) {
29902 LDKClosingTransaction orig_conv;
29903 orig_conv.inner = (void*)(orig & (~1));
29904 orig_conv.is_owned = false;
29905 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29906 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
29907 uint64_t ret_ref = 0;
29908 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29909 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29910 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29911 ret_ref = (uint64_t)ret_var.inner;
29912 if (ret_var.is_owned) {
29918 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_hash(uint32_t o) {
29919 LDKClosingTransaction o_conv;
29920 o_conv.inner = (void*)(o & (~1));
29921 o_conv.is_owned = false;
29922 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29923 int64_t ret_val = ClosingTransaction_hash(&o_conv);
29927 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) {
29928 LDKCVec_u8Z to_holder_script_ref;
29929 to_holder_script_ref.datalen = *((uint32_t*)to_holder_script);
29930 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
29931 memcpy(to_holder_script_ref.data, (uint8_t*)(to_holder_script + 4), to_holder_script_ref.datalen);
29932 LDKCVec_u8Z to_counterparty_script_ref;
29933 to_counterparty_script_ref.datalen = *((uint32_t*)to_counterparty_script);
29934 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
29935 memcpy(to_counterparty_script_ref.data, (uint8_t*)(to_counterparty_script + 4), to_counterparty_script_ref.datalen);
29936 LDKOutPoint funding_outpoint_conv;
29937 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
29938 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
29939 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
29940 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
29941 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
29942 uint64_t ret_ref = 0;
29943 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29944 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29945 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29946 ret_ref = (uint64_t)ret_var.inner;
29947 if (ret_var.is_owned) {
29953 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_trust(uint32_t this_arg) {
29954 LDKClosingTransaction this_arg_conv;
29955 this_arg_conv.inner = (void*)(this_arg & (~1));
29956 this_arg_conv.is_owned = false;
29957 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29958 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
29959 uint64_t ret_ref = 0;
29960 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29961 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29962 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29963 ret_ref = (uint64_t)ret_var.inner;
29964 if (ret_var.is_owned) {
29970 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_verify(uint32_t this_arg, uint32_t funding_outpoint) {
29971 LDKClosingTransaction this_arg_conv;
29972 this_arg_conv.inner = (void*)(this_arg & (~1));
29973 this_arg_conv.is_owned = false;
29974 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29975 LDKOutPoint funding_outpoint_conv;
29976 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
29977 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
29978 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
29979 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
29980 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
29981 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
29982 return (uint64_t)ret_conv;
29985 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_value_sat(uint32_t this_arg) {
29986 LDKClosingTransaction this_arg_conv;
29987 this_arg_conv.inner = (void*)(this_arg & (~1));
29988 this_arg_conv.is_owned = false;
29989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29990 int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
29994 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_value_sat(uint32_t this_arg) {
29995 LDKClosingTransaction this_arg_conv;
29996 this_arg_conv.inner = (void*)(this_arg & (~1));
29997 this_arg_conv.is_owned = false;
29998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29999 int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
30003 int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_script(uint32_t this_arg) {
30004 LDKClosingTransaction this_arg_conv;
30005 this_arg_conv.inner = (void*)(this_arg & (~1));
30006 this_arg_conv.is_owned = false;
30007 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30008 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
30009 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30010 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30014 int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_script(uint32_t this_arg) {
30015 LDKClosingTransaction this_arg_conv;
30016 this_arg_conv.inner = (void*)(this_arg & (~1));
30017 this_arg_conv.is_owned = false;
30018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30019 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
30020 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30021 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30025 void __attribute__((visibility("default"))) TS_TrustedClosingTransaction_free(uint32_t this_obj) {
30026 LDKTrustedClosingTransaction this_obj_conv;
30027 this_obj_conv.inner = (void*)(this_obj & (~1));
30028 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30029 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30030 TrustedClosingTransaction_free(this_obj_conv);
30033 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_built_transaction(uint32_t this_arg) {
30034 LDKTrustedClosingTransaction this_arg_conv;
30035 this_arg_conv.inner = (void*)(this_arg & (~1));
30036 this_arg_conv.is_owned = false;
30037 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30038 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
30039 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30040 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30041 Transaction_free(ret_var);
30045 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
30046 LDKTrustedClosingTransaction this_arg_conv;
30047 this_arg_conv.inner = (void*)(this_arg & (~1));
30048 this_arg_conv.is_owned = false;
30049 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30050 LDKu8slice funding_redeemscript_ref;
30051 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
30052 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
30053 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
30054 memcpy((uint8_t*)(ret_arr + 4), TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
30058 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) {
30059 LDKTrustedClosingTransaction this_arg_conv;
30060 this_arg_conv.inner = (void*)(this_arg & (~1));
30061 this_arg_conv.is_owned = false;
30062 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30063 unsigned char funding_key_arr[32];
30064 CHECK(*((uint32_t*)funding_key) == 32);
30065 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
30066 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
30067 LDKu8slice funding_redeemscript_ref;
30068 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
30069 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
30070 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
30071 memcpy((uint8_t*)(ret_arr + 4), TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
30075 void __attribute__((visibility("default"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
30076 LDKCommitmentTransaction this_obj_conv;
30077 this_obj_conv.inner = (void*)(this_obj & (~1));
30078 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30079 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30080 CommitmentTransaction_free(this_obj_conv);
30083 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
30084 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
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) {
30095 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_clone_ptr(uint32_t arg) {
30096 LDKCommitmentTransaction arg_conv;
30097 arg_conv.inner = (void*)(arg & (~1));
30098 arg_conv.is_owned = false;
30099 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30100 int64_t ret_val = CommitmentTransaction_clone_ptr(&arg_conv);
30104 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_clone(uint32_t orig) {
30105 LDKCommitmentTransaction orig_conv;
30106 orig_conv.inner = (void*)(orig & (~1));
30107 orig_conv.is_owned = false;
30108 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30109 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
30110 uint64_t ret_ref = 0;
30111 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30112 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30113 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30114 ret_ref = (uint64_t)ret_var.inner;
30115 if (ret_var.is_owned) {
30121 int8_tArray __attribute__((visibility("default"))) TS_CommitmentTransaction_write(uint32_t obj) {
30122 LDKCommitmentTransaction obj_conv;
30123 obj_conv.inner = (void*)(obj & (~1));
30124 obj_conv.is_owned = false;
30125 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30126 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
30127 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30128 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30129 CVec_u8Z_free(ret_var);
30133 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_read(int8_tArray ser) {
30134 LDKu8slice ser_ref;
30135 ser_ref.datalen = *((uint32_t*)ser);
30136 ser_ref.data = (int8_t*)(ser + 4);
30137 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
30138 *ret_conv = CommitmentTransaction_read(ser_ref);
30139 return (uint64_t)ret_conv;
30142 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
30143 LDKCommitmentTransaction this_arg_conv;
30144 this_arg_conv.inner = (void*)(this_arg & (~1));
30145 this_arg_conv.is_owned = false;
30146 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30147 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
30151 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
30152 LDKCommitmentTransaction this_arg_conv;
30153 this_arg_conv.inner = (void*)(this_arg & (~1));
30154 this_arg_conv.is_owned = false;
30155 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30156 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
30160 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
30161 LDKCommitmentTransaction this_arg_conv;
30162 this_arg_conv.inner = (void*)(this_arg & (~1));
30163 this_arg_conv.is_owned = false;
30164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30165 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
30169 int32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
30170 LDKCommitmentTransaction this_arg_conv;
30171 this_arg_conv.inner = (void*)(this_arg & (~1));
30172 this_arg_conv.is_owned = false;
30173 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30174 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
30178 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
30179 LDKCommitmentTransaction this_arg_conv;
30180 this_arg_conv.inner = (void*)(this_arg & (~1));
30181 this_arg_conv.is_owned = false;
30182 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30183 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
30184 uint64_t ret_ref = 0;
30185 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30186 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30187 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30188 ret_ref = (uint64_t)ret_var.inner;
30189 if (ret_var.is_owned) {
30195 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_verify(uint32_t this_arg, uint32_t channel_parameters, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
30196 LDKCommitmentTransaction this_arg_conv;
30197 this_arg_conv.inner = (void*)(this_arg & (~1));
30198 this_arg_conv.is_owned = false;
30199 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30200 LDKDirectedChannelTransactionParameters channel_parameters_conv;
30201 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
30202 channel_parameters_conv.is_owned = false;
30203 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
30204 LDKChannelPublicKeys broadcaster_keys_conv;
30205 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
30206 broadcaster_keys_conv.is_owned = false;
30207 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
30208 LDKChannelPublicKeys countersignatory_keys_conv;
30209 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
30210 countersignatory_keys_conv.is_owned = false;
30211 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
30212 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
30213 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
30214 return (uint64_t)ret_conv;
30217 void __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_free(uint32_t this_obj) {
30218 LDKTrustedCommitmentTransaction this_obj_conv;
30219 this_obj_conv.inner = (void*)(this_obj & (~1));
30220 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30221 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30222 TrustedCommitmentTransaction_free(this_obj_conv);
30225 int8_tArray __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
30226 LDKTrustedCommitmentTransaction this_arg_conv;
30227 this_arg_conv.inner = (void*)(this_arg & (~1));
30228 this_arg_conv.is_owned = false;
30229 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30230 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
30231 memcpy((uint8_t*)(ret_arr + 4), TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
30235 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
30236 LDKTrustedCommitmentTransaction this_arg_conv;
30237 this_arg_conv.inner = (void*)(this_arg & (~1));
30238 this_arg_conv.is_owned = false;
30239 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30240 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
30241 uint64_t ret_ref = 0;
30242 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30243 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30244 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30245 ret_ref = (uint64_t)ret_var.inner;
30246 if (ret_var.is_owned) {
30252 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
30253 LDKTrustedCommitmentTransaction this_arg_conv;
30254 this_arg_conv.inner = (void*)(this_arg & (~1));
30255 this_arg_conv.is_owned = false;
30256 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30257 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
30258 uint64_t ret_ref = 0;
30259 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30260 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30261 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30262 ret_ref = (uint64_t)ret_var.inner;
30263 if (ret_var.is_owned) {
30269 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) {
30270 LDKTrustedCommitmentTransaction this_arg_conv;
30271 this_arg_conv.inner = (void*)(this_arg & (~1));
30272 this_arg_conv.is_owned = false;
30273 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30274 unsigned char htlc_base_key_arr[32];
30275 CHECK(*((uint32_t*)htlc_base_key) == 32);
30276 memcpy(htlc_base_key_arr, (uint8_t*)(htlc_base_key + 4), 32);
30277 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
30278 LDKDirectedChannelTransactionParameters channel_parameters_conv;
30279 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
30280 channel_parameters_conv.is_owned = false;
30281 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
30282 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
30283 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
30284 return (uint64_t)ret_conv;
30287 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) {
30288 LDKPublicKey broadcaster_payment_basepoint_ref;
30289 CHECK(*((uint32_t*)broadcaster_payment_basepoint) == 33);
30290 memcpy(broadcaster_payment_basepoint_ref.compressed_form, (uint8_t*)(broadcaster_payment_basepoint + 4), 33);
30291 LDKPublicKey countersignatory_payment_basepoint_ref;
30292 CHECK(*((uint32_t*)countersignatory_payment_basepoint) == 33);
30293 memcpy(countersignatory_payment_basepoint_ref.compressed_form, (uint8_t*)(countersignatory_payment_basepoint + 4), 33);
30294 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
30298 jboolean __attribute__((visibility("default"))) TS_InitFeatures_eq(uint32_t a, uint32_t b) {
30299 LDKInitFeatures a_conv;
30300 a_conv.inner = (void*)(a & (~1));
30301 a_conv.is_owned = false;
30302 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30303 LDKInitFeatures b_conv;
30304 b_conv.inner = (void*)(b & (~1));
30305 b_conv.is_owned = false;
30306 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30307 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
30311 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_eq(uint32_t a, uint32_t b) {
30312 LDKNodeFeatures a_conv;
30313 a_conv.inner = (void*)(a & (~1));
30314 a_conv.is_owned = false;
30315 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30316 LDKNodeFeatures b_conv;
30317 b_conv.inner = (void*)(b & (~1));
30318 b_conv.is_owned = false;
30319 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30320 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
30324 jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_eq(uint32_t a, uint32_t b) {
30325 LDKChannelFeatures a_conv;
30326 a_conv.inner = (void*)(a & (~1));
30327 a_conv.is_owned = false;
30328 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30329 LDKChannelFeatures b_conv;
30330 b_conv.inner = (void*)(b & (~1));
30331 b_conv.is_owned = false;
30332 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30333 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
30337 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_eq(uint32_t a, uint32_t b) {
30338 LDKInvoiceFeatures a_conv;
30339 a_conv.inner = (void*)(a & (~1));
30340 a_conv.is_owned = false;
30341 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30342 LDKInvoiceFeatures b_conv;
30343 b_conv.inner = (void*)(b & (~1));
30344 b_conv.is_owned = false;
30345 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30346 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
30350 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
30351 LDKInitFeatures ret_var = InitFeatures_clone(arg);
30352 uint64_t ret_ref = 0;
30353 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30354 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30355 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30356 ret_ref = (uint64_t)ret_var.inner;
30357 if (ret_var.is_owned) {
30362 int64_t __attribute__((visibility("default"))) TS_InitFeatures_clone_ptr(uint32_t arg) {
30363 LDKInitFeatures arg_conv;
30364 arg_conv.inner = (void*)(arg & (~1));
30365 arg_conv.is_owned = false;
30366 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30367 int64_t ret_val = InitFeatures_clone_ptr(&arg_conv);
30371 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_clone(uint32_t orig) {
30372 LDKInitFeatures orig_conv;
30373 orig_conv.inner = (void*)(orig & (~1));
30374 orig_conv.is_owned = false;
30375 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30376 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
30377 uint64_t ret_ref = 0;
30378 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30379 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30380 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30381 ret_ref = (uint64_t)ret_var.inner;
30382 if (ret_var.is_owned) {
30388 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
30389 LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
30390 uint64_t ret_ref = 0;
30391 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30392 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30393 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30394 ret_ref = (uint64_t)ret_var.inner;
30395 if (ret_var.is_owned) {
30400 int64_t __attribute__((visibility("default"))) TS_NodeFeatures_clone_ptr(uint32_t arg) {
30401 LDKNodeFeatures arg_conv;
30402 arg_conv.inner = (void*)(arg & (~1));
30403 arg_conv.is_owned = false;
30404 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30405 int64_t ret_val = NodeFeatures_clone_ptr(&arg_conv);
30409 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_clone(uint32_t orig) {
30410 LDKNodeFeatures orig_conv;
30411 orig_conv.inner = (void*)(orig & (~1));
30412 orig_conv.is_owned = false;
30413 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30414 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
30415 uint64_t ret_ref = 0;
30416 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30417 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30418 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30419 ret_ref = (uint64_t)ret_var.inner;
30420 if (ret_var.is_owned) {
30426 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
30427 LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
30428 uint64_t ret_ref = 0;
30429 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30430 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30431 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30432 ret_ref = (uint64_t)ret_var.inner;
30433 if (ret_var.is_owned) {
30438 int64_t __attribute__((visibility("default"))) TS_ChannelFeatures_clone_ptr(uint32_t arg) {
30439 LDKChannelFeatures arg_conv;
30440 arg_conv.inner = (void*)(arg & (~1));
30441 arg_conv.is_owned = false;
30442 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30443 int64_t ret_val = ChannelFeatures_clone_ptr(&arg_conv);
30447 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_clone(uint32_t orig) {
30448 LDKChannelFeatures orig_conv;
30449 orig_conv.inner = (void*)(orig & (~1));
30450 orig_conv.is_owned = false;
30451 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30452 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
30453 uint64_t ret_ref = 0;
30454 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30455 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30456 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30457 ret_ref = (uint64_t)ret_var.inner;
30458 if (ret_var.is_owned) {
30464 static inline uint64_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
30465 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
30466 uint64_t ret_ref = 0;
30467 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30468 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30469 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30470 ret_ref = (uint64_t)ret_var.inner;
30471 if (ret_var.is_owned) {
30476 int64_t __attribute__((visibility("default"))) TS_InvoiceFeatures_clone_ptr(uint32_t arg) {
30477 LDKInvoiceFeatures arg_conv;
30478 arg_conv.inner = (void*)(arg & (~1));
30479 arg_conv.is_owned = false;
30480 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30481 int64_t ret_val = InvoiceFeatures_clone_ptr(&arg_conv);
30485 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_clone(uint32_t orig) {
30486 LDKInvoiceFeatures orig_conv;
30487 orig_conv.inner = (void*)(orig & (~1));
30488 orig_conv.is_owned = false;
30489 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30490 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
30491 uint64_t ret_ref = 0;
30492 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30493 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30494 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30495 ret_ref = (uint64_t)ret_var.inner;
30496 if (ret_var.is_owned) {
30502 void __attribute__((visibility("default"))) TS_InitFeatures_free(uint32_t this_obj) {
30503 LDKInitFeatures this_obj_conv;
30504 this_obj_conv.inner = (void*)(this_obj & (~1));
30505 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30506 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30507 InitFeatures_free(this_obj_conv);
30510 void __attribute__((visibility("default"))) TS_NodeFeatures_free(uint32_t this_obj) {
30511 LDKNodeFeatures this_obj_conv;
30512 this_obj_conv.inner = (void*)(this_obj & (~1));
30513 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30514 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30515 NodeFeatures_free(this_obj_conv);
30518 void __attribute__((visibility("default"))) TS_ChannelFeatures_free(uint32_t this_obj) {
30519 LDKChannelFeatures this_obj_conv;
30520 this_obj_conv.inner = (void*)(this_obj & (~1));
30521 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30523 ChannelFeatures_free(this_obj_conv);
30526 void __attribute__((visibility("default"))) TS_InvoiceFeatures_free(uint32_t this_obj) {
30527 LDKInvoiceFeatures this_obj_conv;
30528 this_obj_conv.inner = (void*)(this_obj & (~1));
30529 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30530 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30531 InvoiceFeatures_free(this_obj_conv);
30534 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_empty() {
30535 LDKInitFeatures ret_var = InitFeatures_empty();
30536 uint64_t ret_ref = 0;
30537 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30538 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30539 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30540 ret_ref = (uint64_t)ret_var.inner;
30541 if (ret_var.is_owned) {
30547 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_known() {
30548 LDKInitFeatures ret_var = InitFeatures_known();
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) {
30560 jboolean __attribute__((visibility("default"))) TS_InitFeatures_requires_unknown_bits(uint32_t this_arg) {
30561 LDKInitFeatures this_arg_conv;
30562 this_arg_conv.inner = (void*)(this_arg & (~1));
30563 this_arg_conv.is_owned = false;
30564 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30565 jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
30569 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_empty() {
30570 LDKNodeFeatures ret_var = NodeFeatures_empty();
30571 uint64_t ret_ref = 0;
30572 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30573 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30574 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30575 ret_ref = (uint64_t)ret_var.inner;
30576 if (ret_var.is_owned) {
30582 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_known() {
30583 LDKNodeFeatures ret_var = NodeFeatures_known();
30584 uint64_t ret_ref = 0;
30585 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30586 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30587 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30588 ret_ref = (uint64_t)ret_var.inner;
30589 if (ret_var.is_owned) {
30595 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_requires_unknown_bits(uint32_t this_arg) {
30596 LDKNodeFeatures this_arg_conv;
30597 this_arg_conv.inner = (void*)(this_arg & (~1));
30598 this_arg_conv.is_owned = false;
30599 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30600 jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
30604 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_empty() {
30605 LDKChannelFeatures ret_var = ChannelFeatures_empty();
30606 uint64_t ret_ref = 0;
30607 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30608 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30609 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30610 ret_ref = (uint64_t)ret_var.inner;
30611 if (ret_var.is_owned) {
30617 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_known() {
30618 LDKChannelFeatures ret_var = ChannelFeatures_known();
30619 uint64_t ret_ref = 0;
30620 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30621 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30622 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30623 ret_ref = (uint64_t)ret_var.inner;
30624 if (ret_var.is_owned) {
30630 jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_requires_unknown_bits(uint32_t this_arg) {
30631 LDKChannelFeatures this_arg_conv;
30632 this_arg_conv.inner = (void*)(this_arg & (~1));
30633 this_arg_conv.is_owned = false;
30634 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30635 jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
30639 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_empty() {
30640 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
30641 uint64_t ret_ref = 0;
30642 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30643 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30644 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30645 ret_ref = (uint64_t)ret_var.inner;
30646 if (ret_var.is_owned) {
30652 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_known() {
30653 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
30654 uint64_t ret_ref = 0;
30655 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30656 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30657 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30658 ret_ref = (uint64_t)ret_var.inner;
30659 if (ret_var.is_owned) {
30665 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_requires_unknown_bits(uint32_t this_arg) {
30666 LDKInvoiceFeatures this_arg_conv;
30667 this_arg_conv.inner = (void*)(this_arg & (~1));
30668 this_arg_conv.is_owned = false;
30669 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30670 jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
30674 jboolean __attribute__((visibility("default"))) TS_InitFeatures_supports_payment_secret(uint32_t this_arg) {
30675 LDKInitFeatures this_arg_conv;
30676 this_arg_conv.inner = (void*)(this_arg & (~1));
30677 this_arg_conv.is_owned = false;
30678 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30679 jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv);
30683 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_supports_payment_secret(uint32_t this_arg) {
30684 LDKNodeFeatures this_arg_conv;
30685 this_arg_conv.inner = (void*)(this_arg & (~1));
30686 this_arg_conv.is_owned = false;
30687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30688 jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv);
30692 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_supports_payment_secret(uint32_t this_arg) {
30693 LDKInvoiceFeatures this_arg_conv;
30694 this_arg_conv.inner = (void*)(this_arg & (~1));
30695 this_arg_conv.is_owned = false;
30696 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30697 jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
30701 int8_tArray __attribute__((visibility("default"))) TS_InitFeatures_write(uint32_t obj) {
30702 LDKInitFeatures obj_conv;
30703 obj_conv.inner = (void*)(obj & (~1));
30704 obj_conv.is_owned = false;
30705 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30706 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
30707 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30708 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30709 CVec_u8Z_free(ret_var);
30713 int8_tArray __attribute__((visibility("default"))) TS_NodeFeatures_write(uint32_t obj) {
30714 LDKNodeFeatures obj_conv;
30715 obj_conv.inner = (void*)(obj & (~1));
30716 obj_conv.is_owned = false;
30717 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30718 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
30719 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30720 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30721 CVec_u8Z_free(ret_var);
30725 int8_tArray __attribute__((visibility("default"))) TS_ChannelFeatures_write(uint32_t obj) {
30726 LDKChannelFeatures obj_conv;
30727 obj_conv.inner = (void*)(obj & (~1));
30728 obj_conv.is_owned = false;
30729 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30730 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
30731 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30732 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30733 CVec_u8Z_free(ret_var);
30737 int8_tArray __attribute__((visibility("default"))) TS_InvoiceFeatures_write(uint32_t obj) {
30738 LDKInvoiceFeatures obj_conv;
30739 obj_conv.inner = (void*)(obj & (~1));
30740 obj_conv.is_owned = false;
30741 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30742 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
30743 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30744 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30745 CVec_u8Z_free(ret_var);
30749 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_read(int8_tArray ser) {
30750 LDKu8slice ser_ref;
30751 ser_ref.datalen = *((uint32_t*)ser);
30752 ser_ref.data = (int8_t*)(ser + 4);
30753 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
30754 *ret_conv = InitFeatures_read(ser_ref);
30755 return (uint64_t)ret_conv;
30758 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_read(int8_tArray ser) {
30759 LDKu8slice ser_ref;
30760 ser_ref.datalen = *((uint32_t*)ser);
30761 ser_ref.data = (int8_t*)(ser + 4);
30762 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
30763 *ret_conv = NodeFeatures_read(ser_ref);
30764 return (uint64_t)ret_conv;
30767 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_read(int8_tArray ser) {
30768 LDKu8slice ser_ref;
30769 ser_ref.datalen = *((uint32_t*)ser);
30770 ser_ref.data = (int8_t*)(ser + 4);
30771 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
30772 *ret_conv = ChannelFeatures_read(ser_ref);
30773 return (uint64_t)ret_conv;
30776 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_read(int8_tArray ser) {
30777 LDKu8slice ser_ref;
30778 ser_ref.datalen = *((uint32_t*)ser);
30779 ser_ref.data = (int8_t*)(ser + 4);
30780 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
30781 *ret_conv = InvoiceFeatures_read(ser_ref);
30782 return (uint64_t)ret_conv;
30785 void __attribute__((visibility("default"))) TS_ShutdownScript_free(uint32_t this_obj) {
30786 LDKShutdownScript this_obj_conv;
30787 this_obj_conv.inner = (void*)(this_obj & (~1));
30788 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30790 ShutdownScript_free(this_obj_conv);
30793 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
30794 LDKShutdownScript ret_var = ShutdownScript_clone(arg);
30795 uint64_t ret_ref = 0;
30796 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30797 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30798 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30799 ret_ref = (uint64_t)ret_var.inner;
30800 if (ret_var.is_owned) {
30805 int64_t __attribute__((visibility("default"))) TS_ShutdownScript_clone_ptr(uint32_t arg) {
30806 LDKShutdownScript arg_conv;
30807 arg_conv.inner = (void*)(arg & (~1));
30808 arg_conv.is_owned = false;
30809 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30810 int64_t ret_val = ShutdownScript_clone_ptr(&arg_conv);
30814 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_clone(uint32_t orig) {
30815 LDKShutdownScript orig_conv;
30816 orig_conv.inner = (void*)(orig & (~1));
30817 orig_conv.is_owned = false;
30818 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30819 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
30820 uint64_t ret_ref = 0;
30821 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30822 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30823 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30824 ret_ref = (uint64_t)ret_var.inner;
30825 if (ret_var.is_owned) {
30831 void __attribute__((visibility("default"))) TS_InvalidShutdownScript_free(uint32_t this_obj) {
30832 LDKInvalidShutdownScript this_obj_conv;
30833 this_obj_conv.inner = (void*)(this_obj & (~1));
30834 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30836 InvalidShutdownScript_free(this_obj_conv);
30839 int8_tArray __attribute__((visibility("default"))) TS_InvalidShutdownScript_get_script(uint32_t this_ptr) {
30840 LDKInvalidShutdownScript this_ptr_conv;
30841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30842 this_ptr_conv.is_owned = false;
30843 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30844 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
30845 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30846 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30850 void __attribute__((visibility("default"))) TS_InvalidShutdownScript_set_script(uint32_t this_ptr, int8_tArray val) {
30851 LDKInvalidShutdownScript this_ptr_conv;
30852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30853 this_ptr_conv.is_owned = false;
30854 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30855 LDKCVec_u8Z val_ref;
30856 val_ref.datalen = *((uint32_t*)val);
30857 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
30858 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
30859 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
30862 uint32_t __attribute__((visibility("default"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
30863 LDKCVec_u8Z script_arg_ref;
30864 script_arg_ref.datalen = *((uint32_t*)script_arg);
30865 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
30866 memcpy(script_arg_ref.data, (uint8_t*)(script_arg + 4), script_arg_ref.datalen);
30867 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
30868 uint64_t ret_ref = 0;
30869 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30870 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30871 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30872 ret_ref = (uint64_t)ret_var.inner;
30873 if (ret_var.is_owned) {
30879 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
30880 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
30881 uint64_t ret_ref = 0;
30882 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30883 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30884 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30885 ret_ref = (uint64_t)ret_var.inner;
30886 if (ret_var.is_owned) {
30891 int64_t __attribute__((visibility("default"))) TS_InvalidShutdownScript_clone_ptr(uint32_t arg) {
30892 LDKInvalidShutdownScript arg_conv;
30893 arg_conv.inner = (void*)(arg & (~1));
30894 arg_conv.is_owned = false;
30895 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30896 int64_t ret_val = InvalidShutdownScript_clone_ptr(&arg_conv);
30900 uint32_t __attribute__((visibility("default"))) TS_InvalidShutdownScript_clone(uint32_t orig) {
30901 LDKInvalidShutdownScript orig_conv;
30902 orig_conv.inner = (void*)(orig & (~1));
30903 orig_conv.is_owned = false;
30904 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30905 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
30906 uint64_t ret_ref = 0;
30907 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30908 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30909 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30910 ret_ref = (uint64_t)ret_var.inner;
30911 if (ret_var.is_owned) {
30917 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_write(uint32_t obj) {
30918 LDKShutdownScript obj_conv;
30919 obj_conv.inner = (void*)(obj & (~1));
30920 obj_conv.is_owned = false;
30921 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30922 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
30923 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30924 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30925 CVec_u8Z_free(ret_var);
30929 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_read(int8_tArray ser) {
30930 LDKu8slice ser_ref;
30931 ser_ref.datalen = *((uint32_t*)ser);
30932 ser_ref.data = (int8_t*)(ser + 4);
30933 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
30934 *ret_conv = ShutdownScript_read(ser_ref);
30935 return (uint64_t)ret_conv;
30938 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
30939 unsigned char pubkey_hash_arr[20];
30940 CHECK(*((uint32_t*)pubkey_hash) == 20);
30941 memcpy(pubkey_hash_arr, (uint8_t*)(pubkey_hash + 4), 20);
30942 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
30943 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
30944 uint64_t ret_ref = 0;
30945 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30946 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30947 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30948 ret_ref = (uint64_t)ret_var.inner;
30949 if (ret_var.is_owned) {
30955 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
30956 unsigned char script_hash_arr[32];
30957 CHECK(*((uint32_t*)script_hash) == 32);
30958 memcpy(script_hash_arr, (uint8_t*)(script_hash + 4), 32);
30959 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
30960 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
30961 uint64_t ret_ref = 0;
30962 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30963 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30964 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30965 ret_ref = (uint64_t)ret_var.inner;
30966 if (ret_var.is_owned) {
30972 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
30973 LDKu8slice program_ref;
30974 program_ref.datalen = *((uint32_t*)program);
30975 program_ref.data = (int8_t*)(program + 4);
30976 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
30977 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
30978 return (uint64_t)ret_conv;
30981 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_into_inner(uint32_t this_arg) {
30982 LDKShutdownScript this_arg_conv;
30983 this_arg_conv.inner = (void*)(this_arg & (~1));
30984 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
30985 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30986 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
30987 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
30988 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30989 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30990 CVec_u8Z_free(ret_var);
30994 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_as_legacy_pubkey(uint32_t this_arg) {
30995 LDKShutdownScript this_arg_conv;
30996 this_arg_conv.inner = (void*)(this_arg & (~1));
30997 this_arg_conv.is_owned = false;
30998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30999 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
31000 memcpy((uint8_t*)(ret_arr + 4), ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
31004 jboolean __attribute__((visibility("default"))) TS_ShutdownScript_is_compatible(uint32_t this_arg, uint32_t features) {
31005 LDKShutdownScript this_arg_conv;
31006 this_arg_conv.inner = (void*)(this_arg & (~1));
31007 this_arg_conv.is_owned = false;
31008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31009 LDKInitFeatures features_conv;
31010 features_conv.inner = (void*)(features & (~1));
31011 features_conv.is_owned = false;
31012 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
31013 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
31017 void __attribute__((visibility("default"))) TS_CustomMessageReader_free(uint32_t this_ptr) {
31018 if ((this_ptr & 1) != 0) return;
31019 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
31020 CHECK_ACCESS(this_ptr_ptr);
31021 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
31022 FREE((void*)this_ptr);
31023 CustomMessageReader_free(this_ptr_conv);
31026 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
31027 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
31028 *ret_ret = Type_clone(arg);
31029 return (uint64_t)ret_ret;
31031 int64_t __attribute__((visibility("default"))) TS_Type_clone_ptr(uint32_t arg) {
31032 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
31033 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
31034 LDKType* arg_conv = (LDKType*)arg_ptr;
31035 int64_t ret_val = Type_clone_ptr(arg_conv);
31039 uint32_t __attribute__((visibility("default"))) TS_Type_clone(uint32_t orig) {
31040 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
31041 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
31042 LDKType* orig_conv = (LDKType*)orig_ptr;
31043 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
31044 *ret_ret = Type_clone(orig_conv);
31045 return (uint64_t)ret_ret;
31048 void __attribute__((visibility("default"))) TS_Type_free(uint32_t this_ptr) {
31049 if ((this_ptr & 1) != 0) return;
31050 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
31051 CHECK_ACCESS(this_ptr_ptr);
31052 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
31053 FREE((void*)this_ptr);
31054 Type_free(this_ptr_conv);
31057 void __attribute__((visibility("default"))) TS_Score_free(uint32_t this_ptr) {
31058 if ((this_ptr & 1) != 0) return;
31059 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
31060 CHECK_ACCESS(this_ptr_ptr);
31061 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
31062 FREE((void*)this_ptr);
31063 Score_free(this_ptr_conv);
31066 void __attribute__((visibility("default"))) TS_LockableScore_free(uint32_t this_obj) {
31067 LDKLockableScore this_obj_conv;
31068 this_obj_conv.inner = (void*)(this_obj & (~1));
31069 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31070 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31071 LockableScore_free(this_obj_conv);
31074 uint32_t __attribute__((visibility("default"))) TS_LockableScore_new(uint32_t score) {
31075 void* score_ptr = (void*)(((uint64_t)score) & ~1);
31076 CHECK_ACCESS(score_ptr);
31077 LDKScore score_conv = *(LDKScore*)(score_ptr);
31078 LDKLockableScore ret_var = LockableScore_new(score_conv);
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) {
31090 int8_tArray __attribute__((visibility("default"))) TS_LockableScore_write(uint32_t obj) {
31091 LDKLockableScore obj_conv;
31092 obj_conv.inner = (void*)(obj & (~1));
31093 obj_conv.is_owned = false;
31094 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31095 LDKCVec_u8Z ret_var = LockableScore_write(&obj_conv);
31096 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
31097 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
31098 CVec_u8Z_free(ret_var);
31102 void __attribute__((visibility("default"))) TS_NodeId_free(uint32_t this_obj) {
31103 LDKNodeId this_obj_conv;
31104 this_obj_conv.inner = (void*)(this_obj & (~1));
31105 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31106 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31107 NodeId_free(this_obj_conv);
31110 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
31111 LDKNodeId ret_var = NodeId_clone(arg);
31112 uint64_t ret_ref = 0;
31113 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31114 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31115 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31116 ret_ref = (uint64_t)ret_var.inner;
31117 if (ret_var.is_owned) {
31122 int64_t __attribute__((visibility("default"))) TS_NodeId_clone_ptr(uint32_t arg) {
31123 LDKNodeId arg_conv;
31124 arg_conv.inner = (void*)(arg & (~1));
31125 arg_conv.is_owned = false;
31126 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31127 int64_t ret_val = NodeId_clone_ptr(&arg_conv);
31131 uint32_t __attribute__((visibility("default"))) TS_NodeId_clone(uint32_t orig) {
31132 LDKNodeId orig_conv;
31133 orig_conv.inner = (void*)(orig & (~1));
31134 orig_conv.is_owned = false;
31135 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31136 LDKNodeId ret_var = NodeId_clone(&orig_conv);
31137 uint64_t ret_ref = 0;
31138 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31139 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31140 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31141 ret_ref = (uint64_t)ret_var.inner;
31142 if (ret_var.is_owned) {
31148 uint32_t __attribute__((visibility("default"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
31149 LDKPublicKey pubkey_ref;
31150 CHECK(*((uint32_t*)pubkey) == 33);
31151 memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33);
31152 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
31153 uint64_t ret_ref = 0;
31154 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31155 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31156 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31157 ret_ref = (uint64_t)ret_var.inner;
31158 if (ret_var.is_owned) {
31164 int8_tArray __attribute__((visibility("default"))) TS_NodeId_as_slice(uint32_t this_arg) {
31165 LDKNodeId this_arg_conv;
31166 this_arg_conv.inner = (void*)(this_arg & (~1));
31167 this_arg_conv.is_owned = false;
31168 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31169 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
31170 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
31171 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
31175 int64_t __attribute__((visibility("default"))) TS_NodeId_hash(uint32_t o) {
31177 o_conv.inner = (void*)(o & (~1));
31178 o_conv.is_owned = false;
31179 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31180 int64_t ret_val = NodeId_hash(&o_conv);
31184 int8_tArray __attribute__((visibility("default"))) TS_NodeId_write(uint32_t obj) {
31185 LDKNodeId obj_conv;
31186 obj_conv.inner = (void*)(obj & (~1));
31187 obj_conv.is_owned = false;
31188 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31189 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
31190 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
31191 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
31192 CVec_u8Z_free(ret_var);
31196 uint32_t __attribute__((visibility("default"))) TS_NodeId_read(int8_tArray ser) {
31197 LDKu8slice ser_ref;
31198 ser_ref.datalen = *((uint32_t*)ser);
31199 ser_ref.data = (int8_t*)(ser + 4);
31200 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
31201 *ret_conv = NodeId_read(ser_ref);
31202 return (uint64_t)ret_conv;
31205 void __attribute__((visibility("default"))) TS_NetworkGraph_free(uint32_t this_obj) {
31206 LDKNetworkGraph this_obj_conv;
31207 this_obj_conv.inner = (void*)(this_obj & (~1));
31208 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31209 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31210 NetworkGraph_free(this_obj_conv);
31213 static inline uint64_t NetworkGraph_clone_ptr(LDKNetworkGraph *NONNULL_PTR arg) {
31214 LDKNetworkGraph ret_var = NetworkGraph_clone(arg);
31215 uint64_t ret_ref = 0;
31216 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31217 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31218 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31219 ret_ref = (uint64_t)ret_var.inner;
31220 if (ret_var.is_owned) {
31225 int64_t __attribute__((visibility("default"))) TS_NetworkGraph_clone_ptr(uint32_t arg) {
31226 LDKNetworkGraph arg_conv;
31227 arg_conv.inner = (void*)(arg & (~1));
31228 arg_conv.is_owned = false;
31229 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31230 int64_t ret_val = NetworkGraph_clone_ptr(&arg_conv);
31234 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_clone(uint32_t orig) {
31235 LDKNetworkGraph orig_conv;
31236 orig_conv.inner = (void*)(orig & (~1));
31237 orig_conv.is_owned = false;
31238 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31239 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
31240 uint64_t ret_ref = 0;
31241 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31242 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31243 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31244 ret_ref = (uint64_t)ret_var.inner;
31245 if (ret_var.is_owned) {
31251 void __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_free(uint32_t this_obj) {
31252 LDKReadOnlyNetworkGraph this_obj_conv;
31253 this_obj_conv.inner = (void*)(this_obj & (~1));
31254 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31255 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31256 ReadOnlyNetworkGraph_free(this_obj_conv);
31259 void __attribute__((visibility("default"))) TS_NetworkUpdate_free(uint32_t this_ptr) {
31260 if ((this_ptr & 1) != 0) return;
31261 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
31262 CHECK_ACCESS(this_ptr_ptr);
31263 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
31264 FREE((void*)this_ptr);
31265 NetworkUpdate_free(this_ptr_conv);
31268 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
31269 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31270 *ret_copy = NetworkUpdate_clone(arg);
31271 uint64_t ret_ref = (uint64_t)ret_copy;
31274 int64_t __attribute__((visibility("default"))) TS_NetworkUpdate_clone_ptr(uint32_t arg) {
31275 LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)arg;
31276 int64_t ret_val = NetworkUpdate_clone_ptr(arg_conv);
31280 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_clone(uint32_t orig) {
31281 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
31282 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31283 *ret_copy = NetworkUpdate_clone(orig_conv);
31284 uint64_t ret_ref = (uint64_t)ret_copy;
31288 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_update_message(uint32_t msg) {
31289 LDKChannelUpdate msg_conv;
31290 msg_conv.inner = (void*)(msg & (~1));
31291 msg_conv.is_owned = (msg & 1) || (msg == 0);
31292 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
31293 msg_conv = ChannelUpdate_clone(&msg_conv);
31294 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31295 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
31296 uint64_t ret_ref = (uint64_t)ret_copy;
31300 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_closed(int64_t short_channel_id, jboolean is_permanent) {
31301 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31302 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
31303 uint64_t ret_ref = (uint64_t)ret_copy;
31307 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
31308 LDKPublicKey node_id_ref;
31309 CHECK(*((uint32_t*)node_id) == 33);
31310 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
31311 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31312 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
31313 uint64_t ret_ref = (uint64_t)ret_copy;
31317 int8_tArray __attribute__((visibility("default"))) TS_NetworkUpdate_write(uint32_t obj) {
31318 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
31319 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
31320 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
31321 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
31322 CVec_u8Z_free(ret_var);
31326 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_read(int8_tArray ser) {
31327 LDKu8slice ser_ref;
31328 ser_ref.datalen = *((uint32_t*)ser);
31329 ser_ref.data = (int8_t*)(ser + 4);
31330 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
31331 *ret_conv = NetworkUpdate_read(ser_ref);
31332 return (uint64_t)ret_conv;
31335 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_EventHandler(uint32_t this_arg) {
31336 LDKNetGraphMsgHandler this_arg_conv;
31337 this_arg_conv.inner = (void*)(this_arg & (~1));
31338 this_arg_conv.is_owned = false;
31339 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31340 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
31341 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
31342 return (uint64_t)ret_ret;
31345 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) {
31346 LDKNetGraphMsgHandler this_obj_conv;
31347 this_obj_conv.inner = (void*)(this_obj & (~1));
31348 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31349 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31350 NetGraphMsgHandler_free(this_obj_conv);
31353 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(uint32_t network_graph, uint32_t chain_access, uint32_t logger) {
31354 LDKNetworkGraph network_graph_conv;
31355 network_graph_conv.inner = (void*)(network_graph & (~1));
31356 network_graph_conv.is_owned = false;
31357 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
31358 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
31359 CHECK_ACCESS(chain_access_ptr);
31360 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
31361 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
31362 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
31363 // Manually implement clone for Java trait instances
31365 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
31366 CHECK_ACCESS(logger_ptr);
31367 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
31368 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(&network_graph_conv, chain_access_conv, logger_conv);
31369 uint64_t ret_ref = 0;
31370 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31371 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31372 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31373 ret_ref = (uint64_t)ret_var.inner;
31374 if (ret_var.is_owned) {
31380 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
31381 LDKNetGraphMsgHandler this_arg_conv;
31382 this_arg_conv.inner = (void*)(this_arg & (~1));
31383 this_arg_conv.is_owned = false;
31384 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31385 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
31386 CHECK_ACCESS(chain_access_ptr);
31387 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
31388 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
31389 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
31390 // Manually implement clone for Java trait instances
31392 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
31395 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
31396 LDKNetGraphMsgHandler this_arg_conv;
31397 this_arg_conv.inner = (void*)(this_arg & (~1));
31398 this_arg_conv.is_owned = false;
31399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31400 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
31401 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
31402 return (uint64_t)ret_ret;
31405 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
31406 LDKNetGraphMsgHandler this_arg_conv;
31407 this_arg_conv.inner = (void*)(this_arg & (~1));
31408 this_arg_conv.is_owned = false;
31409 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31410 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
31411 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
31412 return (uint64_t)ret_ret;
31415 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_obj) {
31416 LDKDirectionalChannelInfo this_obj_conv;
31417 this_obj_conv.inner = (void*)(this_obj & (~1));
31418 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31419 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31420 DirectionalChannelInfo_free(this_obj_conv);
31423 int32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) {
31424 LDKDirectionalChannelInfo this_ptr_conv;
31425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31426 this_ptr_conv.is_owned = false;
31427 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31428 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
31432 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) {
31433 LDKDirectionalChannelInfo this_ptr_conv;
31434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31435 this_ptr_conv.is_owned = false;
31436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31437 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
31440 jboolean __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) {
31441 LDKDirectionalChannelInfo this_ptr_conv;
31442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31443 this_ptr_conv.is_owned = false;
31444 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31445 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
31449 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) {
31450 LDKDirectionalChannelInfo this_ptr_conv;
31451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31452 this_ptr_conv.is_owned = false;
31453 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31454 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
31457 int16_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
31458 LDKDirectionalChannelInfo this_ptr_conv;
31459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31460 this_ptr_conv.is_owned = false;
31461 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31462 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
31466 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
31467 LDKDirectionalChannelInfo this_ptr_conv;
31468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31469 this_ptr_conv.is_owned = false;
31470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31471 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
31474 int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
31475 LDKDirectionalChannelInfo this_ptr_conv;
31476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31477 this_ptr_conv.is_owned = false;
31478 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31479 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
31483 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
31484 LDKDirectionalChannelInfo this_ptr_conv;
31485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31486 this_ptr_conv.is_owned = false;
31487 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31488 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
31491 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_maximum_msat(uint32_t this_ptr) {
31492 LDKDirectionalChannelInfo this_ptr_conv;
31493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31494 this_ptr_conv.is_owned = false;
31495 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31496 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31497 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
31498 uint64_t ret_ref = (uint64_t)ret_copy;
31502 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
31503 LDKDirectionalChannelInfo this_ptr_conv;
31504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31505 this_ptr_conv.is_owned = false;
31506 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31507 void* val_ptr = (void*)(((uint64_t)val) & ~1);
31508 CHECK_ACCESS(val_ptr);
31509 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31510 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
31511 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
31514 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) {
31515 LDKDirectionalChannelInfo this_ptr_conv;
31516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31517 this_ptr_conv.is_owned = false;
31518 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31519 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
31520 uint64_t ret_ref = 0;
31521 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31522 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31523 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31524 ret_ref = (uint64_t)ret_var.inner;
31525 if (ret_var.is_owned) {
31531 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) {
31532 LDKDirectionalChannelInfo this_ptr_conv;
31533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31534 this_ptr_conv.is_owned = false;
31535 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31536 LDKRoutingFees val_conv;
31537 val_conv.inner = (void*)(val & (~1));
31538 val_conv.is_owned = (val & 1) || (val == 0);
31539 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31540 val_conv = RoutingFees_clone(&val_conv);
31541 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
31544 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) {
31545 LDKDirectionalChannelInfo this_ptr_conv;
31546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31547 this_ptr_conv.is_owned = false;
31548 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31549 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
31550 uint64_t ret_ref = 0;
31551 if ((uint64_t)ret_var.inner > 4096) {
31552 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31553 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31554 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31555 ret_ref = (uint64_t)ret_var.inner;
31556 if (ret_var.is_owned) {
31563 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
31564 LDKDirectionalChannelInfo this_ptr_conv;
31565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31566 this_ptr_conv.is_owned = false;
31567 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31568 LDKChannelUpdate val_conv;
31569 val_conv.inner = (void*)(val & (~1));
31570 val_conv.is_owned = (val & 1) || (val == 0);
31571 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31572 val_conv = ChannelUpdate_clone(&val_conv);
31573 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
31576 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) {
31577 void* htlc_maximum_msat_arg_ptr = (void*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
31578 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
31579 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
31580 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
31581 LDKRoutingFees fees_arg_conv;
31582 fees_arg_conv.inner = (void*)(fees_arg & (~1));
31583 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
31584 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
31585 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
31586 LDKChannelUpdate last_update_message_arg_conv;
31587 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
31588 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
31589 CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
31590 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
31591 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);
31592 uint64_t ret_ref = 0;
31593 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31594 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31595 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31596 ret_ref = (uint64_t)ret_var.inner;
31597 if (ret_var.is_owned) {
31603 static inline uint64_t DirectionalChannelInfo_clone_ptr(LDKDirectionalChannelInfo *NONNULL_PTR arg) {
31604 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(arg);
31605 uint64_t ret_ref = 0;
31606 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31607 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31608 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31609 ret_ref = (uint64_t)ret_var.inner;
31610 if (ret_var.is_owned) {
31615 int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone_ptr(uint32_t arg) {
31616 LDKDirectionalChannelInfo arg_conv;
31617 arg_conv.inner = (void*)(arg & (~1));
31618 arg_conv.is_owned = false;
31619 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31620 int64_t ret_val = DirectionalChannelInfo_clone_ptr(&arg_conv);
31624 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone(uint32_t orig) {
31625 LDKDirectionalChannelInfo orig_conv;
31626 orig_conv.inner = (void*)(orig & (~1));
31627 orig_conv.is_owned = false;
31628 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31629 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
31630 uint64_t ret_ref = 0;
31631 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31632 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31633 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31634 ret_ref = (uint64_t)ret_var.inner;
31635 if (ret_var.is_owned) {
31641 int8_tArray __attribute__((visibility("default"))) TS_DirectionalChannelInfo_write(uint32_t obj) {
31642 LDKDirectionalChannelInfo obj_conv;
31643 obj_conv.inner = (void*)(obj & (~1));
31644 obj_conv.is_owned = false;
31645 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31646 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
31647 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
31648 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
31649 CVec_u8Z_free(ret_var);
31653 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_read(int8_tArray ser) {
31654 LDKu8slice ser_ref;
31655 ser_ref.datalen = *((uint32_t*)ser);
31656 ser_ref.data = (int8_t*)(ser + 4);
31657 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
31658 *ret_conv = DirectionalChannelInfo_read(ser_ref);
31659 return (uint64_t)ret_conv;
31662 void __attribute__((visibility("default"))) TS_ChannelInfo_free(uint32_t this_obj) {
31663 LDKChannelInfo this_obj_conv;
31664 this_obj_conv.inner = (void*)(this_obj & (~1));
31665 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31667 ChannelInfo_free(this_obj_conv);
31670 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
31671 LDKChannelInfo this_ptr_conv;
31672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31673 this_ptr_conv.is_owned = false;
31674 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31675 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
31676 uint64_t ret_ref = 0;
31677 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31678 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31679 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31680 ret_ref = (uint64_t)ret_var.inner;
31681 if (ret_var.is_owned) {
31687 void __attribute__((visibility("default"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
31688 LDKChannelInfo this_ptr_conv;
31689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31690 this_ptr_conv.is_owned = false;
31691 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31692 LDKChannelFeatures val_conv;
31693 val_conv.inner = (void*)(val & (~1));
31694 val_conv.is_owned = (val & 1) || (val == 0);
31695 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31696 val_conv = ChannelFeatures_clone(&val_conv);
31697 ChannelInfo_set_features(&this_ptr_conv, val_conv);
31700 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
31701 LDKChannelInfo this_ptr_conv;
31702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31703 this_ptr_conv.is_owned = false;
31704 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31705 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
31706 uint64_t ret_ref = 0;
31707 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31708 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31709 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31710 ret_ref = (uint64_t)ret_var.inner;
31711 if (ret_var.is_owned) {
31717 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, uint32_t val) {
31718 LDKChannelInfo this_ptr_conv;
31719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31720 this_ptr_conv.is_owned = false;
31721 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31722 LDKNodeId val_conv;
31723 val_conv.inner = (void*)(val & (~1));
31724 val_conv.is_owned = (val & 1) || (val == 0);
31725 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31726 val_conv = NodeId_clone(&val_conv);
31727 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
31730 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
31731 LDKChannelInfo this_ptr_conv;
31732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31733 this_ptr_conv.is_owned = false;
31734 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31735 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
31736 uint64_t ret_ref = 0;
31737 if ((uint64_t)ret_var.inner > 4096) {
31738 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31739 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31740 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31741 ret_ref = (uint64_t)ret_var.inner;
31742 if (ret_var.is_owned) {
31749 void __attribute__((visibility("default"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
31750 LDKChannelInfo this_ptr_conv;
31751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31752 this_ptr_conv.is_owned = false;
31753 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31754 LDKDirectionalChannelInfo val_conv;
31755 val_conv.inner = (void*)(val & (~1));
31756 val_conv.is_owned = (val & 1) || (val == 0);
31757 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31758 val_conv = DirectionalChannelInfo_clone(&val_conv);
31759 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
31762 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
31763 LDKChannelInfo this_ptr_conv;
31764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31765 this_ptr_conv.is_owned = false;
31766 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31767 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
31768 uint64_t ret_ref = 0;
31769 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31770 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31771 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31772 ret_ref = (uint64_t)ret_var.inner;
31773 if (ret_var.is_owned) {
31779 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, uint32_t val) {
31780 LDKChannelInfo this_ptr_conv;
31781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31782 this_ptr_conv.is_owned = false;
31783 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31784 LDKNodeId val_conv;
31785 val_conv.inner = (void*)(val & (~1));
31786 val_conv.is_owned = (val & 1) || (val == 0);
31787 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31788 val_conv = NodeId_clone(&val_conv);
31789 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
31792 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
31793 LDKChannelInfo this_ptr_conv;
31794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31795 this_ptr_conv.is_owned = false;
31796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31797 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
31798 uint64_t ret_ref = 0;
31799 if ((uint64_t)ret_var.inner > 4096) {
31800 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31801 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31802 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31803 ret_ref = (uint64_t)ret_var.inner;
31804 if (ret_var.is_owned) {
31811 void __attribute__((visibility("default"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
31812 LDKChannelInfo this_ptr_conv;
31813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31814 this_ptr_conv.is_owned = false;
31815 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31816 LDKDirectionalChannelInfo val_conv;
31817 val_conv.inner = (void*)(val & (~1));
31818 val_conv.is_owned = (val & 1) || (val == 0);
31819 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31820 val_conv = DirectionalChannelInfo_clone(&val_conv);
31821 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
31824 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) {
31825 LDKChannelInfo this_ptr_conv;
31826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31827 this_ptr_conv.is_owned = false;
31828 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31829 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31830 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
31831 uint64_t ret_ref = (uint64_t)ret_copy;
31835 void __attribute__((visibility("default"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) {
31836 LDKChannelInfo this_ptr_conv;
31837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31838 this_ptr_conv.is_owned = false;
31839 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31840 void* val_ptr = (void*)(((uint64_t)val) & ~1);
31841 CHECK_ACCESS(val_ptr);
31842 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31843 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
31844 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
31847 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
31848 LDKChannelInfo this_ptr_conv;
31849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31850 this_ptr_conv.is_owned = false;
31851 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31852 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
31853 uint64_t ret_ref = 0;
31854 if ((uint64_t)ret_var.inner > 4096) {
31855 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31856 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31857 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31858 ret_ref = (uint64_t)ret_var.inner;
31859 if (ret_var.is_owned) {
31866 void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
31867 LDKChannelInfo this_ptr_conv;
31868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31869 this_ptr_conv.is_owned = false;
31870 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31871 LDKChannelAnnouncement val_conv;
31872 val_conv.inner = (void*)(val & (~1));
31873 val_conv.is_owned = (val & 1) || (val == 0);
31874 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31875 val_conv = ChannelAnnouncement_clone(&val_conv);
31876 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
31879 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_new(uint32_t features_arg, uint32_t node_one_arg, uint32_t one_to_two_arg, uint32_t node_two_arg, uint32_t two_to_one_arg, uint32_t capacity_sats_arg, uint32_t announcement_message_arg) {
31880 LDKChannelFeatures features_arg_conv;
31881 features_arg_conv.inner = (void*)(features_arg & (~1));
31882 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
31883 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
31884 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
31885 LDKNodeId node_one_arg_conv;
31886 node_one_arg_conv.inner = (void*)(node_one_arg & (~1));
31887 node_one_arg_conv.is_owned = (node_one_arg & 1) || (node_one_arg == 0);
31888 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_one_arg_conv);
31889 node_one_arg_conv = NodeId_clone(&node_one_arg_conv);
31890 LDKDirectionalChannelInfo one_to_two_arg_conv;
31891 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
31892 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
31893 CHECK_INNER_FIELD_ACCESS_OR_NULL(one_to_two_arg_conv);
31894 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
31895 LDKNodeId node_two_arg_conv;
31896 node_two_arg_conv.inner = (void*)(node_two_arg & (~1));
31897 node_two_arg_conv.is_owned = (node_two_arg & 1) || (node_two_arg == 0);
31898 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_two_arg_conv);
31899 node_two_arg_conv = NodeId_clone(&node_two_arg_conv);
31900 LDKDirectionalChannelInfo two_to_one_arg_conv;
31901 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
31902 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
31903 CHECK_INNER_FIELD_ACCESS_OR_NULL(two_to_one_arg_conv);
31904 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
31905 void* capacity_sats_arg_ptr = (void*)(((uint64_t)capacity_sats_arg) & ~1);
31906 CHECK_ACCESS(capacity_sats_arg_ptr);
31907 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(capacity_sats_arg_ptr);
31908 capacity_sats_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1));
31909 LDKChannelAnnouncement announcement_message_arg_conv;
31910 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
31911 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
31912 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
31913 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
31914 LDKChannelInfo ret_var = ChannelInfo_new(features_arg_conv, node_one_arg_conv, one_to_two_arg_conv, node_two_arg_conv, two_to_one_arg_conv, capacity_sats_arg_conv, announcement_message_arg_conv);
31915 uint64_t ret_ref = 0;
31916 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31917 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31918 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31919 ret_ref = (uint64_t)ret_var.inner;
31920 if (ret_var.is_owned) {
31926 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
31927 LDKChannelInfo ret_var = ChannelInfo_clone(arg);
31928 uint64_t ret_ref = 0;
31929 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31930 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31931 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31932 ret_ref = (uint64_t)ret_var.inner;
31933 if (ret_var.is_owned) {
31938 int64_t __attribute__((visibility("default"))) TS_ChannelInfo_clone_ptr(uint32_t arg) {
31939 LDKChannelInfo arg_conv;
31940 arg_conv.inner = (void*)(arg & (~1));
31941 arg_conv.is_owned = false;
31942 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31943 int64_t ret_val = ChannelInfo_clone_ptr(&arg_conv);
31947 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_clone(uint32_t orig) {
31948 LDKChannelInfo orig_conv;
31949 orig_conv.inner = (void*)(orig & (~1));
31950 orig_conv.is_owned = false;
31951 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31952 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
31953 uint64_t ret_ref = 0;
31954 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31955 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31956 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31957 ret_ref = (uint64_t)ret_var.inner;
31958 if (ret_var.is_owned) {
31964 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_write(uint32_t obj) {
31965 LDKChannelInfo obj_conv;
31966 obj_conv.inner = (void*)(obj & (~1));
31967 obj_conv.is_owned = false;
31968 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31969 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
31970 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
31971 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
31972 CVec_u8Z_free(ret_var);
31976 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_read(int8_tArray ser) {
31977 LDKu8slice ser_ref;
31978 ser_ref.datalen = *((uint32_t*)ser);
31979 ser_ref.data = (int8_t*)(ser + 4);
31980 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
31981 *ret_conv = ChannelInfo_read(ser_ref);
31982 return (uint64_t)ret_conv;
31985 void __attribute__((visibility("default"))) TS_RoutingFees_free(uint32_t this_obj) {
31986 LDKRoutingFees this_obj_conv;
31987 this_obj_conv.inner = (void*)(this_obj & (~1));
31988 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31990 RoutingFees_free(this_obj_conv);
31993 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
31994 LDKRoutingFees this_ptr_conv;
31995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31996 this_ptr_conv.is_owned = false;
31997 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31998 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
32002 void __attribute__((visibility("default"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
32003 LDKRoutingFees this_ptr_conv;
32004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32005 this_ptr_conv.is_owned = false;
32006 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32007 RoutingFees_set_base_msat(&this_ptr_conv, val);
32010 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
32011 LDKRoutingFees this_ptr_conv;
32012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32013 this_ptr_conv.is_owned = false;
32014 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32015 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
32019 void __attribute__((visibility("default"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
32020 LDKRoutingFees this_ptr_conv;
32021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32022 this_ptr_conv.is_owned = false;
32023 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32024 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
32027 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
32028 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
32029 uint64_t ret_ref = 0;
32030 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32031 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32032 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32033 ret_ref = (uint64_t)ret_var.inner;
32034 if (ret_var.is_owned) {
32040 jboolean __attribute__((visibility("default"))) TS_RoutingFees_eq(uint32_t a, uint32_t b) {
32041 LDKRoutingFees a_conv;
32042 a_conv.inner = (void*)(a & (~1));
32043 a_conv.is_owned = false;
32044 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32045 LDKRoutingFees b_conv;
32046 b_conv.inner = (void*)(b & (~1));
32047 b_conv.is_owned = false;
32048 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32049 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
32053 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
32054 LDKRoutingFees ret_var = RoutingFees_clone(arg);
32055 uint64_t ret_ref = 0;
32056 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32057 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32058 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32059 ret_ref = (uint64_t)ret_var.inner;
32060 if (ret_var.is_owned) {
32065 int64_t __attribute__((visibility("default"))) TS_RoutingFees_clone_ptr(uint32_t arg) {
32066 LDKRoutingFees arg_conv;
32067 arg_conv.inner = (void*)(arg & (~1));
32068 arg_conv.is_owned = false;
32069 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32070 int64_t ret_val = RoutingFees_clone_ptr(&arg_conv);
32074 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t orig) {
32075 LDKRoutingFees orig_conv;
32076 orig_conv.inner = (void*)(orig & (~1));
32077 orig_conv.is_owned = false;
32078 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32079 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
32080 uint64_t ret_ref = 0;
32081 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32082 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32083 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32084 ret_ref = (uint64_t)ret_var.inner;
32085 if (ret_var.is_owned) {
32091 int64_t __attribute__((visibility("default"))) TS_RoutingFees_hash(uint32_t o) {
32092 LDKRoutingFees o_conv;
32093 o_conv.inner = (void*)(o & (~1));
32094 o_conv.is_owned = false;
32095 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32096 int64_t ret_val = RoutingFees_hash(&o_conv);
32100 int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) {
32101 LDKRoutingFees obj_conv;
32102 obj_conv.inner = (void*)(obj & (~1));
32103 obj_conv.is_owned = false;
32104 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32105 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
32106 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
32107 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
32108 CVec_u8Z_free(ret_var);
32112 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_read(int8_tArray ser) {
32113 LDKu8slice ser_ref;
32114 ser_ref.datalen = *((uint32_t*)ser);
32115 ser_ref.data = (int8_t*)(ser + 4);
32116 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
32117 *ret_conv = RoutingFees_read(ser_ref);
32118 return (uint64_t)ret_conv;
32121 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) {
32122 LDKNodeAnnouncementInfo this_obj_conv;
32123 this_obj_conv.inner = (void*)(this_obj & (~1));
32124 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32125 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32126 NodeAnnouncementInfo_free(this_obj_conv);
32129 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
32130 LDKNodeAnnouncementInfo this_ptr_conv;
32131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32132 this_ptr_conv.is_owned = false;
32133 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32134 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
32135 uint64_t ret_ref = 0;
32136 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32137 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32138 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32139 ret_ref = (uint64_t)ret_var.inner;
32140 if (ret_var.is_owned) {
32146 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
32147 LDKNodeAnnouncementInfo this_ptr_conv;
32148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32149 this_ptr_conv.is_owned = false;
32150 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32151 LDKNodeFeatures val_conv;
32152 val_conv.inner = (void*)(val & (~1));
32153 val_conv.is_owned = (val & 1) || (val == 0);
32154 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32155 val_conv = NodeFeatures_clone(&val_conv);
32156 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
32159 int32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
32160 LDKNodeAnnouncementInfo 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 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
32168 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
32169 LDKNodeAnnouncementInfo 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 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
32176 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
32177 LDKNodeAnnouncementInfo 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 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
32182 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
32186 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
32187 LDKNodeAnnouncementInfo this_ptr_conv;
32188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32189 this_ptr_conv.is_owned = false;
32190 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32191 LDKThreeBytes val_ref;
32192 CHECK(*((uint32_t*)val) == 3);
32193 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
32194 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
32197 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
32198 LDKNodeAnnouncementInfo this_ptr_conv;
32199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32200 this_ptr_conv.is_owned = false;
32201 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32202 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
32203 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
32207 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
32208 LDKNodeAnnouncementInfo this_ptr_conv;
32209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32210 this_ptr_conv.is_owned = false;
32211 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32212 LDKThirtyTwoBytes val_ref;
32213 CHECK(*((uint32_t*)val) == 32);
32214 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
32215 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
32218 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
32219 LDKNodeAnnouncementInfo this_ptr_conv;
32220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32221 this_ptr_conv.is_owned = false;
32222 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32223 LDKCVec_NetAddressZ val_constr;
32224 val_constr.datalen = *((uint32_t*)val);
32225 if (val_constr.datalen > 0)
32226 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
32228 val_constr.data = NULL;
32229 uint32_t* val_vals = (uint32_t*)(val + 4);
32230 for (size_t m = 0; m < val_constr.datalen; m++) {
32231 uint32_t val_conv_12 = val_vals[m];
32232 void* val_conv_12_ptr = (void*)(((uint64_t)val_conv_12) & ~1);
32233 CHECK_ACCESS(val_conv_12_ptr);
32234 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
32235 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
32236 val_constr.data[m] = val_conv_12_conv;
32238 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
32241 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
32242 LDKNodeAnnouncementInfo this_ptr_conv;
32243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32244 this_ptr_conv.is_owned = false;
32245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32246 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
32247 uint64_t ret_ref = 0;
32248 if ((uint64_t)ret_var.inner > 4096) {
32249 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32250 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32251 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32252 ret_ref = (uint64_t)ret_var.inner;
32253 if (ret_var.is_owned) {
32260 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
32261 LDKNodeAnnouncementInfo this_ptr_conv;
32262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32263 this_ptr_conv.is_owned = false;
32264 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32265 LDKNodeAnnouncement val_conv;
32266 val_conv.inner = (void*)(val & (~1));
32267 val_conv.is_owned = (val & 1) || (val == 0);
32268 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32269 val_conv = NodeAnnouncement_clone(&val_conv);
32270 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
32273 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) {
32274 LDKNodeFeatures features_arg_conv;
32275 features_arg_conv.inner = (void*)(features_arg & (~1));
32276 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
32277 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
32278 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
32279 LDKThreeBytes rgb_arg_ref;
32280 CHECK(*((uint32_t*)rgb_arg) == 3);
32281 memcpy(rgb_arg_ref.data, (uint8_t*)(rgb_arg + 4), 3);
32282 LDKThirtyTwoBytes alias_arg_ref;
32283 CHECK(*((uint32_t*)alias_arg) == 32);
32284 memcpy(alias_arg_ref.data, (uint8_t*)(alias_arg + 4), 32);
32285 LDKCVec_NetAddressZ addresses_arg_constr;
32286 addresses_arg_constr.datalen = *((uint32_t*)addresses_arg);
32287 if (addresses_arg_constr.datalen > 0)
32288 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
32290 addresses_arg_constr.data = NULL;
32291 uint32_t* addresses_arg_vals = (uint32_t*)(addresses_arg + 4);
32292 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
32293 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
32294 void* addresses_arg_conv_12_ptr = (void*)(((uint64_t)addresses_arg_conv_12) & ~1);
32295 CHECK_ACCESS(addresses_arg_conv_12_ptr);
32296 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
32297 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
32299 LDKNodeAnnouncement announcement_message_arg_conv;
32300 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
32301 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
32302 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
32303 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
32304 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
32305 uint64_t ret_ref = 0;
32306 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32307 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32308 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32309 ret_ref = (uint64_t)ret_var.inner;
32310 if (ret_var.is_owned) {
32316 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
32317 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
32318 uint64_t ret_ref = 0;
32319 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32320 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32321 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32322 ret_ref = (uint64_t)ret_var.inner;
32323 if (ret_var.is_owned) {
32328 int64_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone_ptr(uint32_t arg) {
32329 LDKNodeAnnouncementInfo arg_conv;
32330 arg_conv.inner = (void*)(arg & (~1));
32331 arg_conv.is_owned = false;
32332 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32333 int64_t ret_val = NodeAnnouncementInfo_clone_ptr(&arg_conv);
32337 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
32338 LDKNodeAnnouncementInfo orig_conv;
32339 orig_conv.inner = (void*)(orig & (~1));
32340 orig_conv.is_owned = false;
32341 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32342 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
32343 uint64_t ret_ref = 0;
32344 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32345 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32346 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32347 ret_ref = (uint64_t)ret_var.inner;
32348 if (ret_var.is_owned) {
32354 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
32355 LDKNodeAnnouncementInfo obj_conv;
32356 obj_conv.inner = (void*)(obj & (~1));
32357 obj_conv.is_owned = false;
32358 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32359 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
32360 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
32361 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
32362 CVec_u8Z_free(ret_var);
32366 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
32367 LDKu8slice ser_ref;
32368 ser_ref.datalen = *((uint32_t*)ser);
32369 ser_ref.data = (int8_t*)(ser + 4);
32370 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
32371 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
32372 return (uint64_t)ret_conv;
32375 void __attribute__((visibility("default"))) TS_NodeInfo_free(uint32_t this_obj) {
32376 LDKNodeInfo this_obj_conv;
32377 this_obj_conv.inner = (void*)(this_obj & (~1));
32378 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32379 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32380 NodeInfo_free(this_obj_conv);
32383 void __attribute__((visibility("default"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
32384 LDKNodeInfo this_ptr_conv;
32385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32386 this_ptr_conv.is_owned = false;
32387 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32388 LDKCVec_u64Z val_constr;
32389 val_constr.datalen = *((uint32_t*)val);
32390 if (val_constr.datalen > 0)
32391 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
32393 val_constr.data = NULL;
32394 int64_t* val_vals = (int64_t*)(val + 4);
32395 for (size_t i = 0; i < val_constr.datalen; i++) {
32396 int64_t val_conv_8 = val_vals[i];
32397 val_constr.data[i] = val_conv_8;
32399 NodeInfo_set_channels(&this_ptr_conv, val_constr);
32402 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
32403 LDKNodeInfo this_ptr_conv;
32404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32405 this_ptr_conv.is_owned = false;
32406 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32407 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
32408 uint64_t ret_ref = 0;
32409 if ((uint64_t)ret_var.inner > 4096) {
32410 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32411 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32412 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32413 ret_ref = (uint64_t)ret_var.inner;
32414 if (ret_var.is_owned) {
32421 void __attribute__((visibility("default"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) {
32422 LDKNodeInfo this_ptr_conv;
32423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32424 this_ptr_conv.is_owned = false;
32425 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32426 LDKRoutingFees val_conv;
32427 val_conv.inner = (void*)(val & (~1));
32428 val_conv.is_owned = (val & 1) || (val == 0);
32429 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32430 val_conv = RoutingFees_clone(&val_conv);
32431 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
32434 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
32435 LDKNodeInfo this_ptr_conv;
32436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32437 this_ptr_conv.is_owned = false;
32438 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32439 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
32440 uint64_t ret_ref = 0;
32441 if ((uint64_t)ret_var.inner > 4096) {
32442 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32443 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32444 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32445 ret_ref = (uint64_t)ret_var.inner;
32446 if (ret_var.is_owned) {
32453 void __attribute__((visibility("default"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
32454 LDKNodeInfo this_ptr_conv;
32455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32456 this_ptr_conv.is_owned = false;
32457 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32458 LDKNodeAnnouncementInfo val_conv;
32459 val_conv.inner = (void*)(val & (~1));
32460 val_conv.is_owned = (val & 1) || (val == 0);
32461 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32462 val_conv = NodeAnnouncementInfo_clone(&val_conv);
32463 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
32466 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
32467 LDKCVec_u64Z channels_arg_constr;
32468 channels_arg_constr.datalen = *((uint32_t*)channels_arg);
32469 if (channels_arg_constr.datalen > 0)
32470 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
32472 channels_arg_constr.data = NULL;
32473 int64_t* channels_arg_vals = (int64_t*)(channels_arg + 4);
32474 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
32475 int64_t channels_arg_conv_8 = channels_arg_vals[i];
32476 channels_arg_constr.data[i] = channels_arg_conv_8;
32478 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
32479 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
32480 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
32481 CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
32482 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
32483 LDKNodeAnnouncementInfo announcement_info_arg_conv;
32484 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
32485 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
32486 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
32487 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
32488 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
32489 uint64_t ret_ref = 0;
32490 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32491 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32492 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32493 ret_ref = (uint64_t)ret_var.inner;
32494 if (ret_var.is_owned) {
32500 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
32501 LDKNodeInfo ret_var = NodeInfo_clone(arg);
32502 uint64_t ret_ref = 0;
32503 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32504 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32505 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32506 ret_ref = (uint64_t)ret_var.inner;
32507 if (ret_var.is_owned) {
32512 int64_t __attribute__((visibility("default"))) TS_NodeInfo_clone_ptr(uint32_t arg) {
32513 LDKNodeInfo arg_conv;
32514 arg_conv.inner = (void*)(arg & (~1));
32515 arg_conv.is_owned = false;
32516 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32517 int64_t ret_val = NodeInfo_clone_ptr(&arg_conv);
32521 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig) {
32522 LDKNodeInfo orig_conv;
32523 orig_conv.inner = (void*)(orig & (~1));
32524 orig_conv.is_owned = false;
32525 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32526 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
32527 uint64_t ret_ref = 0;
32528 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32529 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32530 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32531 ret_ref = (uint64_t)ret_var.inner;
32532 if (ret_var.is_owned) {
32538 int8_tArray __attribute__((visibility("default"))) TS_NodeInfo_write(uint32_t obj) {
32539 LDKNodeInfo obj_conv;
32540 obj_conv.inner = (void*)(obj & (~1));
32541 obj_conv.is_owned = false;
32542 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32543 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
32544 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
32545 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
32546 CVec_u8Z_free(ret_var);
32550 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_read(int8_tArray ser) {
32551 LDKu8slice ser_ref;
32552 ser_ref.datalen = *((uint32_t*)ser);
32553 ser_ref.data = (int8_t*)(ser + 4);
32554 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
32555 *ret_conv = NodeInfo_read(ser_ref);
32556 return (uint64_t)ret_conv;
32559 int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32_t obj) {
32560 LDKNetworkGraph obj_conv;
32561 obj_conv.inner = (void*)(obj & (~1));
32562 obj_conv.is_owned = false;
32563 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32564 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
32565 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
32566 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
32567 CVec_u8Z_free(ret_var);
32571 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read(int8_tArray ser) {
32572 LDKu8slice ser_ref;
32573 ser_ref.datalen = *((uint32_t*)ser);
32574 ser_ref.data = (int8_t*)(ser + 4);
32575 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
32576 *ret_conv = NetworkGraph_read(ser_ref);
32577 return (uint64_t)ret_conv;
32580 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray genesis_hash) {
32581 LDKThirtyTwoBytes genesis_hash_ref;
32582 CHECK(*((uint32_t*)genesis_hash) == 32);
32583 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
32584 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
32585 uint64_t ret_ref = 0;
32586 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32587 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32588 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32589 ret_ref = (uint64_t)ret_var.inner;
32590 if (ret_var.is_owned) {
32596 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read_only(uint32_t this_arg) {
32597 LDKNetworkGraph this_arg_conv;
32598 this_arg_conv.inner = (void*)(this_arg & (~1));
32599 this_arg_conv.is_owned = false;
32600 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32601 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
32602 uint64_t ret_ref = 0;
32603 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32604 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32605 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32606 ret_ref = (uint64_t)ret_var.inner;
32607 if (ret_var.is_owned) {
32613 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
32614 LDKNetworkGraph this_arg_conv;
32615 this_arg_conv.inner = (void*)(this_arg & (~1));
32616 this_arg_conv.is_owned = false;
32617 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32618 LDKNodeAnnouncement msg_conv;
32619 msg_conv.inner = (void*)(msg & (~1));
32620 msg_conv.is_owned = false;
32621 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32622 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
32623 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
32624 return (uint64_t)ret_conv;
32627 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) {
32628 LDKNetworkGraph this_arg_conv;
32629 this_arg_conv.inner = (void*)(this_arg & (~1));
32630 this_arg_conv.is_owned = false;
32631 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32632 LDKUnsignedNodeAnnouncement msg_conv;
32633 msg_conv.inner = (void*)(msg & (~1));
32634 msg_conv.is_owned = false;
32635 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32636 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
32637 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
32638 return (uint64_t)ret_conv;
32641 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
32642 LDKNetworkGraph this_arg_conv;
32643 this_arg_conv.inner = (void*)(this_arg & (~1));
32644 this_arg_conv.is_owned = false;
32645 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32646 LDKChannelAnnouncement msg_conv;
32647 msg_conv.inner = (void*)(msg & (~1));
32648 msg_conv.is_owned = false;
32649 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32650 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
32651 CHECK_ACCESS(chain_access_ptr);
32652 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
32653 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
32654 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
32655 // Manually implement clone for Java trait instances
32657 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
32658 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
32659 return (uint64_t)ret_conv;
32662 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
32663 LDKNetworkGraph this_arg_conv;
32664 this_arg_conv.inner = (void*)(this_arg & (~1));
32665 this_arg_conv.is_owned = false;
32666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32667 LDKUnsignedChannelAnnouncement msg_conv;
32668 msg_conv.inner = (void*)(msg & (~1));
32669 msg_conv.is_owned = false;
32670 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32671 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
32672 CHECK_ACCESS(chain_access_ptr);
32673 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
32674 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
32675 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
32676 // Manually implement clone for Java trait instances
32678 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
32679 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
32680 return (uint64_t)ret_conv;
32683 void __attribute__((visibility("default"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
32684 LDKNetworkGraph this_arg_conv;
32685 this_arg_conv.inner = (void*)(this_arg & (~1));
32686 this_arg_conv.is_owned = false;
32687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32688 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
32691 void __attribute__((visibility("default"))) TS_NetworkGraph_fail_node(uint32_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
32692 LDKNetworkGraph this_arg_conv;
32693 this_arg_conv.inner = (void*)(this_arg & (~1));
32694 this_arg_conv.is_owned = false;
32695 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32696 LDKPublicKey _node_id_ref;
32697 CHECK(*((uint32_t*)_node_id) == 33);
32698 memcpy(_node_id_ref.compressed_form, (uint8_t*)(_node_id + 4), 33);
32699 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
32702 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
32703 LDKNetworkGraph this_arg_conv;
32704 this_arg_conv.inner = (void*)(this_arg & (~1));
32705 this_arg_conv.is_owned = false;
32706 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32707 LDKChannelUpdate msg_conv;
32708 msg_conv.inner = (void*)(msg & (~1));
32709 msg_conv.is_owned = false;
32710 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32711 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
32712 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
32713 return (uint64_t)ret_conv;
32716 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
32717 LDKNetworkGraph this_arg_conv;
32718 this_arg_conv.inner = (void*)(this_arg & (~1));
32719 this_arg_conv.is_owned = false;
32720 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32721 LDKUnsignedChannelUpdate msg_conv;
32722 msg_conv.inner = (void*)(msg & (~1));
32723 msg_conv.is_owned = false;
32724 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32725 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
32726 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
32727 return (uint64_t)ret_conv;
32730 uint32_t __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_get_addresses(uint32_t this_arg, int8_tArray pubkey) {
32731 LDKReadOnlyNetworkGraph this_arg_conv;
32732 this_arg_conv.inner = (void*)(this_arg & (~1));
32733 this_arg_conv.is_owned = false;
32734 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32735 LDKPublicKey pubkey_ref;
32736 CHECK(*((uint32_t*)pubkey) == 33);
32737 memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33);
32738 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
32739 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
32740 uint64_t ret_ref = (uint64_t)ret_copy;
32744 void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) {
32745 LDKRouteHop this_obj_conv;
32746 this_obj_conv.inner = (void*)(this_obj & (~1));
32747 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32749 RouteHop_free(this_obj_conv);
32752 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
32753 LDKRouteHop this_ptr_conv;
32754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32755 this_ptr_conv.is_owned = false;
32756 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32757 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
32758 memcpy((uint8_t*)(ret_arr + 4), RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
32762 void __attribute__((visibility("default"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
32763 LDKRouteHop this_ptr_conv;
32764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32765 this_ptr_conv.is_owned = false;
32766 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32767 LDKPublicKey val_ref;
32768 CHECK(*((uint32_t*)val) == 33);
32769 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
32770 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
32773 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
32774 LDKRouteHop this_ptr_conv;
32775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32776 this_ptr_conv.is_owned = false;
32777 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32778 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
32779 uint64_t ret_ref = 0;
32780 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32781 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32782 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32783 ret_ref = (uint64_t)ret_var.inner;
32784 if (ret_var.is_owned) {
32790 void __attribute__((visibility("default"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
32791 LDKRouteHop this_ptr_conv;
32792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32793 this_ptr_conv.is_owned = false;
32794 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32795 LDKNodeFeatures val_conv;
32796 val_conv.inner = (void*)(val & (~1));
32797 val_conv.is_owned = (val & 1) || (val == 0);
32798 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32799 val_conv = NodeFeatures_clone(&val_conv);
32800 RouteHop_set_node_features(&this_ptr_conv, val_conv);
32803 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
32804 LDKRouteHop this_ptr_conv;
32805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32806 this_ptr_conv.is_owned = false;
32807 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32808 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
32812 void __attribute__((visibility("default"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
32813 LDKRouteHop this_ptr_conv;
32814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32815 this_ptr_conv.is_owned = false;
32816 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32817 RouteHop_set_short_channel_id(&this_ptr_conv, val);
32820 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
32821 LDKRouteHop this_ptr_conv;
32822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32823 this_ptr_conv.is_owned = false;
32824 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32825 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
32826 uint64_t ret_ref = 0;
32827 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32828 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32829 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32830 ret_ref = (uint64_t)ret_var.inner;
32831 if (ret_var.is_owned) {
32837 void __attribute__((visibility("default"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
32838 LDKRouteHop this_ptr_conv;
32839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32840 this_ptr_conv.is_owned = false;
32841 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32842 LDKChannelFeatures val_conv;
32843 val_conv.inner = (void*)(val & (~1));
32844 val_conv.is_owned = (val & 1) || (val == 0);
32845 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32846 val_conv = ChannelFeatures_clone(&val_conv);
32847 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
32850 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
32851 LDKRouteHop this_ptr_conv;
32852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32853 this_ptr_conv.is_owned = false;
32854 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32855 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
32859 void __attribute__((visibility("default"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
32860 LDKRouteHop this_ptr_conv;
32861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32862 this_ptr_conv.is_owned = false;
32863 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32864 RouteHop_set_fee_msat(&this_ptr_conv, val);
32867 int32_t __attribute__((visibility("default"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
32868 LDKRouteHop this_ptr_conv;
32869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32870 this_ptr_conv.is_owned = false;
32871 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32872 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
32876 void __attribute__((visibility("default"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
32877 LDKRouteHop this_ptr_conv;
32878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32879 this_ptr_conv.is_owned = false;
32880 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32881 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
32884 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) {
32885 LDKPublicKey pubkey_arg_ref;
32886 CHECK(*((uint32_t*)pubkey_arg) == 33);
32887 memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33);
32888 LDKNodeFeatures node_features_arg_conv;
32889 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
32890 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
32891 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
32892 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
32893 LDKChannelFeatures channel_features_arg_conv;
32894 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
32895 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
32896 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
32897 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
32898 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);
32899 uint64_t ret_ref = 0;
32900 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32901 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32902 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32903 ret_ref = (uint64_t)ret_var.inner;
32904 if (ret_var.is_owned) {
32910 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
32911 LDKRouteHop ret_var = RouteHop_clone(arg);
32912 uint64_t ret_ref = 0;
32913 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32914 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32915 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32916 ret_ref = (uint64_t)ret_var.inner;
32917 if (ret_var.is_owned) {
32922 int64_t __attribute__((visibility("default"))) TS_RouteHop_clone_ptr(uint32_t arg) {
32923 LDKRouteHop arg_conv;
32924 arg_conv.inner = (void*)(arg & (~1));
32925 arg_conv.is_owned = false;
32926 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32927 int64_t ret_val = RouteHop_clone_ptr(&arg_conv);
32931 uint32_t __attribute__((visibility("default"))) TS_RouteHop_clone(uint32_t orig) {
32932 LDKRouteHop orig_conv;
32933 orig_conv.inner = (void*)(orig & (~1));
32934 orig_conv.is_owned = false;
32935 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32936 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
32937 uint64_t ret_ref = 0;
32938 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32939 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32940 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32941 ret_ref = (uint64_t)ret_var.inner;
32942 if (ret_var.is_owned) {
32948 int64_t __attribute__((visibility("default"))) TS_RouteHop_hash(uint32_t o) {
32949 LDKRouteHop o_conv;
32950 o_conv.inner = (void*)(o & (~1));
32951 o_conv.is_owned = false;
32952 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32953 int64_t ret_val = RouteHop_hash(&o_conv);
32957 jboolean __attribute__((visibility("default"))) TS_RouteHop_eq(uint32_t a, uint32_t b) {
32958 LDKRouteHop a_conv;
32959 a_conv.inner = (void*)(a & (~1));
32960 a_conv.is_owned = false;
32961 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32962 LDKRouteHop b_conv;
32963 b_conv.inner = (void*)(b & (~1));
32964 b_conv.is_owned = false;
32965 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32966 jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
32970 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_write(uint32_t obj) {
32971 LDKRouteHop obj_conv;
32972 obj_conv.inner = (void*)(obj & (~1));
32973 obj_conv.is_owned = false;
32974 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32975 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
32976 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
32977 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
32978 CVec_u8Z_free(ret_var);
32982 uint32_t __attribute__((visibility("default"))) TS_RouteHop_read(int8_tArray ser) {
32983 LDKu8slice ser_ref;
32984 ser_ref.datalen = *((uint32_t*)ser);
32985 ser_ref.data = (int8_t*)(ser + 4);
32986 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
32987 *ret_conv = RouteHop_read(ser_ref);
32988 return (uint64_t)ret_conv;
32991 void __attribute__((visibility("default"))) TS_Route_free(uint32_t this_obj) {
32992 LDKRoute this_obj_conv;
32993 this_obj_conv.inner = (void*)(this_obj & (~1));
32994 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32995 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32996 Route_free(this_obj_conv);
32999 ptrArray __attribute__((visibility("default"))) TS_Route_get_paths(uint32_t this_ptr) {
33000 LDKRoute this_ptr_conv;
33001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33002 this_ptr_conv.is_owned = false;
33003 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33004 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
33005 ptrArray ret_arr = NULL;
33006 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
33007 uint32_tArray *ret_arr_ptr = (uint32_tArray*)(ret_arr + 4);
33008 for (size_t m = 0; m < ret_var.datalen; m++) {
33009 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
33010 uint32_tArray ret_conv_12_arr = NULL;
33011 ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
33012 uint32_t *ret_conv_12_arr_ptr = (uint32_t*)(ret_conv_12_arr + 4);
33013 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
33014 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
33015 uint64_t ret_conv_12_conv_10_ref = 0;
33016 CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33017 CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33018 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
33019 ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner;
33020 if (ret_conv_12_conv_10_var.is_owned) {
33021 ret_conv_12_conv_10_ref |= 1;
33023 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
33026 FREE(ret_conv_12_var.data);
33027 ret_arr_ptr[m] = ret_conv_12_arr;
33030 FREE(ret_var.data);
33034 void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
33035 LDKRoute this_ptr_conv;
33036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33037 this_ptr_conv.is_owned = false;
33038 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33039 LDKCVec_CVec_RouteHopZZ val_constr;
33040 val_constr.datalen = *((uint32_t*)val);
33041 if (val_constr.datalen > 0)
33042 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
33044 val_constr.data = NULL;
33045 uint32_tArray* val_vals = (uint32_tArray*)(val + 4);
33046 for (size_t m = 0; m < val_constr.datalen; m++) {
33047 uint32_tArray val_conv_12 = val_vals[m];
33048 LDKCVec_RouteHopZ val_conv_12_constr;
33049 val_conv_12_constr.datalen = *((uint32_t*)val_conv_12);
33050 if (val_conv_12_constr.datalen > 0)
33051 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
33053 val_conv_12_constr.data = NULL;
33054 uint32_t* val_conv_12_vals = (uint32_t*)(val_conv_12 + 4);
33055 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
33056 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
33057 LDKRouteHop val_conv_12_conv_10_conv;
33058 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
33059 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
33060 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
33061 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
33062 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
33064 val_constr.data[m] = val_conv_12_constr;
33066 Route_set_paths(&this_ptr_conv, val_constr);
33069 uint32_t __attribute__((visibility("default"))) TS_Route_get_payee(uint32_t this_ptr) {
33070 LDKRoute this_ptr_conv;
33071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33072 this_ptr_conv.is_owned = false;
33073 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33074 LDKPayee ret_var = Route_get_payee(&this_ptr_conv);
33075 uint64_t ret_ref = 0;
33076 if ((uint64_t)ret_var.inner > 4096) {
33077 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33078 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33079 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33080 ret_ref = (uint64_t)ret_var.inner;
33081 if (ret_var.is_owned) {
33088 void __attribute__((visibility("default"))) TS_Route_set_payee(uint32_t this_ptr, uint32_t val) {
33089 LDKRoute this_ptr_conv;
33090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33091 this_ptr_conv.is_owned = false;
33092 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33094 val_conv.inner = (void*)(val & (~1));
33095 val_conv.is_owned = (val & 1) || (val == 0);
33096 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33097 val_conv = Payee_clone(&val_conv);
33098 Route_set_payee(&this_ptr_conv, val_conv);
33101 uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg, uint32_t payee_arg) {
33102 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
33103 paths_arg_constr.datalen = *((uint32_t*)paths_arg);
33104 if (paths_arg_constr.datalen > 0)
33105 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
33107 paths_arg_constr.data = NULL;
33108 uint32_tArray* paths_arg_vals = (uint32_tArray*)(paths_arg + 4);
33109 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
33110 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
33111 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
33112 paths_arg_conv_12_constr.datalen = *((uint32_t*)paths_arg_conv_12);
33113 if (paths_arg_conv_12_constr.datalen > 0)
33114 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
33116 paths_arg_conv_12_constr.data = NULL;
33117 uint32_t* paths_arg_conv_12_vals = (uint32_t*)(paths_arg_conv_12 + 4);
33118 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
33119 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
33120 LDKRouteHop paths_arg_conv_12_conv_10_conv;
33121 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
33122 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
33123 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
33124 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
33125 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
33127 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
33129 LDKPayee payee_arg_conv;
33130 payee_arg_conv.inner = (void*)(payee_arg & (~1));
33131 payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0);
33132 CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_arg_conv);
33133 payee_arg_conv = Payee_clone(&payee_arg_conv);
33134 LDKRoute ret_var = Route_new(paths_arg_constr, payee_arg_conv);
33135 uint64_t ret_ref = 0;
33136 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33137 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33138 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33139 ret_ref = (uint64_t)ret_var.inner;
33140 if (ret_var.is_owned) {
33146 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
33147 LDKRoute ret_var = Route_clone(arg);
33148 uint64_t ret_ref = 0;
33149 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33150 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33151 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33152 ret_ref = (uint64_t)ret_var.inner;
33153 if (ret_var.is_owned) {
33158 int64_t __attribute__((visibility("default"))) TS_Route_clone_ptr(uint32_t arg) {
33160 arg_conv.inner = (void*)(arg & (~1));
33161 arg_conv.is_owned = false;
33162 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33163 int64_t ret_val = Route_clone_ptr(&arg_conv);
33167 uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) {
33168 LDKRoute orig_conv;
33169 orig_conv.inner = (void*)(orig & (~1));
33170 orig_conv.is_owned = false;
33171 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33172 LDKRoute ret_var = Route_clone(&orig_conv);
33173 uint64_t ret_ref = 0;
33174 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33175 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33176 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33177 ret_ref = (uint64_t)ret_var.inner;
33178 if (ret_var.is_owned) {
33184 int64_t __attribute__((visibility("default"))) TS_Route_hash(uint32_t o) {
33186 o_conv.inner = (void*)(o & (~1));
33187 o_conv.is_owned = false;
33188 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33189 int64_t ret_val = Route_hash(&o_conv);
33193 jboolean __attribute__((visibility("default"))) TS_Route_eq(uint32_t a, uint32_t b) {
33195 a_conv.inner = (void*)(a & (~1));
33196 a_conv.is_owned = false;
33197 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33199 b_conv.inner = (void*)(b & (~1));
33200 b_conv.is_owned = false;
33201 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33202 jboolean ret_val = Route_eq(&a_conv, &b_conv);
33206 int64_t __attribute__((visibility("default"))) TS_Route_get_total_fees(uint32_t this_arg) {
33207 LDKRoute this_arg_conv;
33208 this_arg_conv.inner = (void*)(this_arg & (~1));
33209 this_arg_conv.is_owned = false;
33210 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33211 int64_t ret_val = Route_get_total_fees(&this_arg_conv);
33215 int64_t __attribute__((visibility("default"))) TS_Route_get_total_amount(uint32_t this_arg) {
33216 LDKRoute this_arg_conv;
33217 this_arg_conv.inner = (void*)(this_arg & (~1));
33218 this_arg_conv.is_owned = false;
33219 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33220 int64_t ret_val = Route_get_total_amount(&this_arg_conv);
33224 int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) {
33226 obj_conv.inner = (void*)(obj & (~1));
33227 obj_conv.is_owned = false;
33228 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33229 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
33230 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
33231 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
33232 CVec_u8Z_free(ret_var);
33236 uint32_t __attribute__((visibility("default"))) TS_Route_read(int8_tArray ser) {
33237 LDKu8slice ser_ref;
33238 ser_ref.datalen = *((uint32_t*)ser);
33239 ser_ref.data = (int8_t*)(ser + 4);
33240 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
33241 *ret_conv = Route_read(ser_ref);
33242 return (uint64_t)ret_conv;
33245 void __attribute__((visibility("default"))) TS_RouteParameters_free(uint32_t this_obj) {
33246 LDKRouteParameters this_obj_conv;
33247 this_obj_conv.inner = (void*)(this_obj & (~1));
33248 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33249 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33250 RouteParameters_free(this_obj_conv);
33253 uint32_t __attribute__((visibility("default"))) TS_RouteParameters_get_payee(uint32_t this_ptr) {
33254 LDKRouteParameters this_ptr_conv;
33255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33256 this_ptr_conv.is_owned = false;
33257 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33258 LDKPayee ret_var = RouteParameters_get_payee(&this_ptr_conv);
33259 uint64_t ret_ref = 0;
33260 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33261 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33262 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33263 ret_ref = (uint64_t)ret_var.inner;
33264 if (ret_var.is_owned) {
33270 void __attribute__((visibility("default"))) TS_RouteParameters_set_payee(uint32_t this_ptr, uint32_t val) {
33271 LDKRouteParameters this_ptr_conv;
33272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33273 this_ptr_conv.is_owned = false;
33274 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33276 val_conv.inner = (void*)(val & (~1));
33277 val_conv.is_owned = (val & 1) || (val == 0);
33278 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33279 val_conv = Payee_clone(&val_conv);
33280 RouteParameters_set_payee(&this_ptr_conv, val_conv);
33283 int64_t __attribute__((visibility("default"))) TS_RouteParameters_get_final_value_msat(uint32_t this_ptr) {
33284 LDKRouteParameters this_ptr_conv;
33285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33286 this_ptr_conv.is_owned = false;
33287 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33288 int64_t ret_val = RouteParameters_get_final_value_msat(&this_ptr_conv);
33292 void __attribute__((visibility("default"))) TS_RouteParameters_set_final_value_msat(uint32_t this_ptr, int64_t val) {
33293 LDKRouteParameters this_ptr_conv;
33294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33295 this_ptr_conv.is_owned = false;
33296 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33297 RouteParameters_set_final_value_msat(&this_ptr_conv, val);
33300 int32_t __attribute__((visibility("default"))) TS_RouteParameters_get_final_cltv_expiry_delta(uint32_t this_ptr) {
33301 LDKRouteParameters this_ptr_conv;
33302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33303 this_ptr_conv.is_owned = false;
33304 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33305 int32_t ret_val = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
33309 void __attribute__((visibility("default"))) TS_RouteParameters_set_final_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
33310 LDKRouteParameters this_ptr_conv;
33311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33312 this_ptr_conv.is_owned = false;
33313 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33314 RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
33317 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) {
33318 LDKPayee payee_arg_conv;
33319 payee_arg_conv.inner = (void*)(payee_arg & (~1));
33320 payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0);
33321 CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_arg_conv);
33322 payee_arg_conv = Payee_clone(&payee_arg_conv);
33323 LDKRouteParameters ret_var = RouteParameters_new(payee_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
33324 uint64_t ret_ref = 0;
33325 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33326 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33327 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33328 ret_ref = (uint64_t)ret_var.inner;
33329 if (ret_var.is_owned) {
33335 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
33336 LDKRouteParameters ret_var = RouteParameters_clone(arg);
33337 uint64_t ret_ref = 0;
33338 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33339 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33340 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33341 ret_ref = (uint64_t)ret_var.inner;
33342 if (ret_var.is_owned) {
33347 int64_t __attribute__((visibility("default"))) TS_RouteParameters_clone_ptr(uint32_t arg) {
33348 LDKRouteParameters arg_conv;
33349 arg_conv.inner = (void*)(arg & (~1));
33350 arg_conv.is_owned = false;
33351 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33352 int64_t ret_val = RouteParameters_clone_ptr(&arg_conv);
33356 uint32_t __attribute__((visibility("default"))) TS_RouteParameters_clone(uint32_t orig) {
33357 LDKRouteParameters orig_conv;
33358 orig_conv.inner = (void*)(orig & (~1));
33359 orig_conv.is_owned = false;
33360 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33361 LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
33362 uint64_t ret_ref = 0;
33363 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33364 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33365 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33366 ret_ref = (uint64_t)ret_var.inner;
33367 if (ret_var.is_owned) {
33373 int8_tArray __attribute__((visibility("default"))) TS_RouteParameters_write(uint32_t obj) {
33374 LDKRouteParameters obj_conv;
33375 obj_conv.inner = (void*)(obj & (~1));
33376 obj_conv.is_owned = false;
33377 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33378 LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
33379 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
33380 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
33381 CVec_u8Z_free(ret_var);
33385 uint32_t __attribute__((visibility("default"))) TS_RouteParameters_read(int8_tArray ser) {
33386 LDKu8slice ser_ref;
33387 ser_ref.datalen = *((uint32_t*)ser);
33388 ser_ref.data = (int8_t*)(ser + 4);
33389 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
33390 *ret_conv = RouteParameters_read(ser_ref);
33391 return (uint64_t)ret_conv;
33394 void __attribute__((visibility("default"))) TS_Payee_free(uint32_t this_obj) {
33395 LDKPayee this_obj_conv;
33396 this_obj_conv.inner = (void*)(this_obj & (~1));
33397 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33398 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33399 Payee_free(this_obj_conv);
33402 int8_tArray __attribute__((visibility("default"))) TS_Payee_get_pubkey(uint32_t this_ptr) {
33403 LDKPayee this_ptr_conv;
33404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33405 this_ptr_conv.is_owned = false;
33406 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33407 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
33408 memcpy((uint8_t*)(ret_arr + 4), Payee_get_pubkey(&this_ptr_conv).compressed_form, 33);
33412 void __attribute__((visibility("default"))) TS_Payee_set_pubkey(uint32_t this_ptr, int8_tArray val) {
33413 LDKPayee this_ptr_conv;
33414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33415 this_ptr_conv.is_owned = false;
33416 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33417 LDKPublicKey val_ref;
33418 CHECK(*((uint32_t*)val) == 33);
33419 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
33420 Payee_set_pubkey(&this_ptr_conv, val_ref);
33423 uint32_t __attribute__((visibility("default"))) TS_Payee_get_features(uint32_t this_ptr) {
33424 LDKPayee this_ptr_conv;
33425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33426 this_ptr_conv.is_owned = false;
33427 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33428 LDKInvoiceFeatures ret_var = Payee_get_features(&this_ptr_conv);
33429 uint64_t ret_ref = 0;
33430 if ((uint64_t)ret_var.inner > 4096) {
33431 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33432 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33433 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33434 ret_ref = (uint64_t)ret_var.inner;
33435 if (ret_var.is_owned) {
33442 void __attribute__((visibility("default"))) TS_Payee_set_features(uint32_t this_ptr, uint32_t val) {
33443 LDKPayee 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 LDKInvoiceFeatures val_conv;
33448 val_conv.inner = (void*)(val & (~1));
33449 val_conv.is_owned = (val & 1) || (val == 0);
33450 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33451 val_conv = InvoiceFeatures_clone(&val_conv);
33452 Payee_set_features(&this_ptr_conv, val_conv);
33455 uint32_tArray __attribute__((visibility("default"))) TS_Payee_get_route_hints(uint32_t this_ptr) {
33456 LDKPayee this_ptr_conv;
33457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33458 this_ptr_conv.is_owned = false;
33459 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33460 LDKCVec_RouteHintZ ret_var = Payee_get_route_hints(&this_ptr_conv);
33461 uint32_tArray ret_arr = NULL;
33462 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
33463 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
33464 for (size_t l = 0; l < ret_var.datalen; l++) {
33465 LDKRouteHint ret_conv_11_var = ret_var.data[l];
33466 uint64_t ret_conv_11_ref = 0;
33467 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33468 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33469 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
33470 ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
33471 if (ret_conv_11_var.is_owned) {
33472 ret_conv_11_ref |= 1;
33474 ret_arr_ptr[l] = ret_conv_11_ref;
33477 FREE(ret_var.data);
33481 void __attribute__((visibility("default"))) TS_Payee_set_route_hints(uint32_t this_ptr, uint32_tArray val) {
33482 LDKPayee this_ptr_conv;
33483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33484 this_ptr_conv.is_owned = false;
33485 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33486 LDKCVec_RouteHintZ val_constr;
33487 val_constr.datalen = *((uint32_t*)val);
33488 if (val_constr.datalen > 0)
33489 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
33491 val_constr.data = NULL;
33492 uint32_t* val_vals = (uint32_t*)(val + 4);
33493 for (size_t l = 0; l < val_constr.datalen; l++) {
33494 uint32_t val_conv_11 = val_vals[l];
33495 LDKRouteHint val_conv_11_conv;
33496 val_conv_11_conv.inner = (void*)(val_conv_11 & (~1));
33497 val_conv_11_conv.is_owned = (val_conv_11 & 1) || (val_conv_11 == 0);
33498 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
33499 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
33500 val_constr.data[l] = val_conv_11_conv;
33502 Payee_set_route_hints(&this_ptr_conv, val_constr);
33505 uint32_t __attribute__((visibility("default"))) TS_Payee_get_expiry_time(uint32_t this_ptr) {
33506 LDKPayee this_ptr_conv;
33507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33508 this_ptr_conv.is_owned = false;
33509 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33510 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
33511 *ret_copy = Payee_get_expiry_time(&this_ptr_conv);
33512 uint64_t ret_ref = (uint64_t)ret_copy;
33516 void __attribute__((visibility("default"))) TS_Payee_set_expiry_time(uint32_t this_ptr, uint32_t val) {
33517 LDKPayee this_ptr_conv;
33518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33519 this_ptr_conv.is_owned = false;
33520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33521 void* val_ptr = (void*)(((uint64_t)val) & ~1);
33522 CHECK_ACCESS(val_ptr);
33523 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
33524 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
33525 Payee_set_expiry_time(&this_ptr_conv, val_conv);
33528 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) {
33529 LDKPublicKey pubkey_arg_ref;
33530 CHECK(*((uint32_t*)pubkey_arg) == 33);
33531 memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33);
33532 LDKInvoiceFeatures features_arg_conv;
33533 features_arg_conv.inner = (void*)(features_arg & (~1));
33534 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
33535 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
33536 features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
33537 LDKCVec_RouteHintZ route_hints_arg_constr;
33538 route_hints_arg_constr.datalen = *((uint32_t*)route_hints_arg);
33539 if (route_hints_arg_constr.datalen > 0)
33540 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
33542 route_hints_arg_constr.data = NULL;
33543 uint32_t* route_hints_arg_vals = (uint32_t*)(route_hints_arg + 4);
33544 for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
33545 uint32_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
33546 LDKRouteHint route_hints_arg_conv_11_conv;
33547 route_hints_arg_conv_11_conv.inner = (void*)(route_hints_arg_conv_11 & (~1));
33548 route_hints_arg_conv_11_conv.is_owned = (route_hints_arg_conv_11 & 1) || (route_hints_arg_conv_11 == 0);
33549 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
33550 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
33551 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
33553 void* expiry_time_arg_ptr = (void*)(((uint64_t)expiry_time_arg) & ~1);
33554 CHECK_ACCESS(expiry_time_arg_ptr);
33555 LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
33556 expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)expiry_time_arg) & ~1));
33557 LDKPayee ret_var = Payee_new(pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, expiry_time_arg_conv);
33558 uint64_t ret_ref = 0;
33559 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33560 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33561 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33562 ret_ref = (uint64_t)ret_var.inner;
33563 if (ret_var.is_owned) {
33569 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
33570 LDKPayee ret_var = Payee_clone(arg);
33571 uint64_t ret_ref = 0;
33572 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33573 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33574 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33575 ret_ref = (uint64_t)ret_var.inner;
33576 if (ret_var.is_owned) {
33581 int64_t __attribute__((visibility("default"))) TS_Payee_clone_ptr(uint32_t arg) {
33583 arg_conv.inner = (void*)(arg & (~1));
33584 arg_conv.is_owned = false;
33585 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33586 int64_t ret_val = Payee_clone_ptr(&arg_conv);
33590 uint32_t __attribute__((visibility("default"))) TS_Payee_clone(uint32_t orig) {
33591 LDKPayee orig_conv;
33592 orig_conv.inner = (void*)(orig & (~1));
33593 orig_conv.is_owned = false;
33594 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33595 LDKPayee ret_var = Payee_clone(&orig_conv);
33596 uint64_t ret_ref = 0;
33597 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33598 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33599 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33600 ret_ref = (uint64_t)ret_var.inner;
33601 if (ret_var.is_owned) {
33607 int64_t __attribute__((visibility("default"))) TS_Payee_hash(uint32_t o) {
33609 o_conv.inner = (void*)(o & (~1));
33610 o_conv.is_owned = false;
33611 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33612 int64_t ret_val = Payee_hash(&o_conv);
33616 jboolean __attribute__((visibility("default"))) TS_Payee_eq(uint32_t a, uint32_t b) {
33618 a_conv.inner = (void*)(a & (~1));
33619 a_conv.is_owned = false;
33620 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33622 b_conv.inner = (void*)(b & (~1));
33623 b_conv.is_owned = false;
33624 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33625 jboolean ret_val = Payee_eq(&a_conv, &b_conv);
33629 int8_tArray __attribute__((visibility("default"))) TS_Payee_write(uint32_t obj) {
33631 obj_conv.inner = (void*)(obj & (~1));
33632 obj_conv.is_owned = false;
33633 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33634 LDKCVec_u8Z ret_var = Payee_write(&obj_conv);
33635 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
33636 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
33637 CVec_u8Z_free(ret_var);
33641 uint32_t __attribute__((visibility("default"))) TS_Payee_read(int8_tArray ser) {
33642 LDKu8slice ser_ref;
33643 ser_ref.datalen = *((uint32_t*)ser);
33644 ser_ref.data = (int8_t*)(ser + 4);
33645 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
33646 *ret_conv = Payee_read(ser_ref);
33647 return (uint64_t)ret_conv;
33650 uint32_t __attribute__((visibility("default"))) TS_Payee_from_node_id(int8_tArray pubkey) {
33651 LDKPublicKey pubkey_ref;
33652 CHECK(*((uint32_t*)pubkey) == 33);
33653 memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33);
33654 LDKPayee ret_var = Payee_from_node_id(pubkey_ref);
33655 uint64_t ret_ref = 0;
33656 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33657 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33658 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33659 ret_ref = (uint64_t)ret_var.inner;
33660 if (ret_var.is_owned) {
33666 uint32_t __attribute__((visibility("default"))) TS_Payee_for_keysend(int8_tArray pubkey) {
33667 LDKPublicKey pubkey_ref;
33668 CHECK(*((uint32_t*)pubkey) == 33);
33669 memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33);
33670 LDKPayee ret_var = Payee_for_keysend(pubkey_ref);
33671 uint64_t ret_ref = 0;
33672 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33673 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33674 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33675 ret_ref = (uint64_t)ret_var.inner;
33676 if (ret_var.is_owned) {
33682 void __attribute__((visibility("default"))) TS_RouteHint_free(uint32_t this_obj) {
33683 LDKRouteHint this_obj_conv;
33684 this_obj_conv.inner = (void*)(this_obj & (~1));
33685 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33686 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33687 RouteHint_free(this_obj_conv);
33690 uint32_tArray __attribute__((visibility("default"))) TS_RouteHint_get_a(uint32_t this_ptr) {
33691 LDKRouteHint this_ptr_conv;
33692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33693 this_ptr_conv.is_owned = false;
33694 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33695 LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
33696 uint32_tArray ret_arr = NULL;
33697 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
33698 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
33699 for (size_t o = 0; o < ret_var.datalen; o++) {
33700 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
33701 uint64_t ret_conv_14_ref = 0;
33702 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33703 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33704 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
33705 ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
33706 if (ret_conv_14_var.is_owned) {
33707 ret_conv_14_ref |= 1;
33709 ret_arr_ptr[o] = ret_conv_14_ref;
33712 FREE(ret_var.data);
33716 void __attribute__((visibility("default"))) TS_RouteHint_set_a(uint32_t this_ptr, uint32_tArray val) {
33717 LDKRouteHint this_ptr_conv;
33718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33719 this_ptr_conv.is_owned = false;
33720 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33721 LDKCVec_RouteHintHopZ val_constr;
33722 val_constr.datalen = *((uint32_t*)val);
33723 if (val_constr.datalen > 0)
33724 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
33726 val_constr.data = NULL;
33727 uint32_t* val_vals = (uint32_t*)(val + 4);
33728 for (size_t o = 0; o < val_constr.datalen; o++) {
33729 uint32_t val_conv_14 = val_vals[o];
33730 LDKRouteHintHop val_conv_14_conv;
33731 val_conv_14_conv.inner = (void*)(val_conv_14 & (~1));
33732 val_conv_14_conv.is_owned = (val_conv_14 & 1) || (val_conv_14 == 0);
33733 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
33734 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
33735 val_constr.data[o] = val_conv_14_conv;
33737 RouteHint_set_a(&this_ptr_conv, val_constr);
33740 uint32_t __attribute__((visibility("default"))) TS_RouteHint_new(uint32_tArray a_arg) {
33741 LDKCVec_RouteHintHopZ a_arg_constr;
33742 a_arg_constr.datalen = *((uint32_t*)a_arg);
33743 if (a_arg_constr.datalen > 0)
33744 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
33746 a_arg_constr.data = NULL;
33747 uint32_t* a_arg_vals = (uint32_t*)(a_arg + 4);
33748 for (size_t o = 0; o < a_arg_constr.datalen; o++) {
33749 uint32_t a_arg_conv_14 = a_arg_vals[o];
33750 LDKRouteHintHop a_arg_conv_14_conv;
33751 a_arg_conv_14_conv.inner = (void*)(a_arg_conv_14 & (~1));
33752 a_arg_conv_14_conv.is_owned = (a_arg_conv_14 & 1) || (a_arg_conv_14 == 0);
33753 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
33754 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
33755 a_arg_constr.data[o] = a_arg_conv_14_conv;
33757 LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
33758 uint64_t ret_ref = 0;
33759 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33760 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33761 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33762 ret_ref = (uint64_t)ret_var.inner;
33763 if (ret_var.is_owned) {
33769 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
33770 LDKRouteHint ret_var = RouteHint_clone(arg);
33771 uint64_t ret_ref = 0;
33772 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33773 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33774 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33775 ret_ref = (uint64_t)ret_var.inner;
33776 if (ret_var.is_owned) {
33781 int64_t __attribute__((visibility("default"))) TS_RouteHint_clone_ptr(uint32_t arg) {
33782 LDKRouteHint arg_conv;
33783 arg_conv.inner = (void*)(arg & (~1));
33784 arg_conv.is_owned = false;
33785 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33786 int64_t ret_val = RouteHint_clone_ptr(&arg_conv);
33790 uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) {
33791 LDKRouteHint orig_conv;
33792 orig_conv.inner = (void*)(orig & (~1));
33793 orig_conv.is_owned = false;
33794 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33795 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
33796 uint64_t ret_ref = 0;
33797 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33798 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33799 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33800 ret_ref = (uint64_t)ret_var.inner;
33801 if (ret_var.is_owned) {
33807 int64_t __attribute__((visibility("default"))) TS_RouteHint_hash(uint32_t o) {
33808 LDKRouteHint o_conv;
33809 o_conv.inner = (void*)(o & (~1));
33810 o_conv.is_owned = false;
33811 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33812 int64_t ret_val = RouteHint_hash(&o_conv);
33816 jboolean __attribute__((visibility("default"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
33817 LDKRouteHint a_conv;
33818 a_conv.inner = (void*)(a & (~1));
33819 a_conv.is_owned = false;
33820 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33821 LDKRouteHint b_conv;
33822 b_conv.inner = (void*)(b & (~1));
33823 b_conv.is_owned = false;
33824 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33825 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
33829 int8_tArray __attribute__((visibility("default"))) TS_RouteHint_write(uint32_t obj) {
33830 LDKRouteHint obj_conv;
33831 obj_conv.inner = (void*)(obj & (~1));
33832 obj_conv.is_owned = false;
33833 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33834 LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
33835 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
33836 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
33837 CVec_u8Z_free(ret_var);
33841 uint32_t __attribute__((visibility("default"))) TS_RouteHint_read(int8_tArray ser) {
33842 LDKu8slice ser_ref;
33843 ser_ref.datalen = *((uint32_t*)ser);
33844 ser_ref.data = (int8_t*)(ser + 4);
33845 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
33846 *ret_conv = RouteHint_read(ser_ref);
33847 return (uint64_t)ret_conv;
33850 void __attribute__((visibility("default"))) TS_RouteHintHop_free(uint32_t this_obj) {
33851 LDKRouteHintHop this_obj_conv;
33852 this_obj_conv.inner = (void*)(this_obj & (~1));
33853 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33854 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33855 RouteHintHop_free(this_obj_conv);
33858 int8_tArray __attribute__((visibility("default"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) {
33859 LDKRouteHintHop this_ptr_conv;
33860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33861 this_ptr_conv.is_owned = false;
33862 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33863 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
33864 memcpy((uint8_t*)(ret_arr + 4), RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
33868 void __attribute__((visibility("default"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
33869 LDKRouteHintHop this_ptr_conv;
33870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33871 this_ptr_conv.is_owned = false;
33872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33873 LDKPublicKey val_ref;
33874 CHECK(*((uint32_t*)val) == 33);
33875 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
33876 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
33879 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) {
33880 LDKRouteHintHop this_ptr_conv;
33881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33882 this_ptr_conv.is_owned = false;
33883 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33884 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
33888 void __attribute__((visibility("default"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
33889 LDKRouteHintHop this_ptr_conv;
33890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33891 this_ptr_conv.is_owned = false;
33892 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33893 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
33896 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) {
33897 LDKRouteHintHop this_ptr_conv;
33898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33899 this_ptr_conv.is_owned = false;
33900 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33901 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
33902 uint64_t ret_ref = 0;
33903 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33904 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33905 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33906 ret_ref = (uint64_t)ret_var.inner;
33907 if (ret_var.is_owned) {
33913 void __attribute__((visibility("default"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) {
33914 LDKRouteHintHop this_ptr_conv;
33915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33916 this_ptr_conv.is_owned = false;
33917 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33918 LDKRoutingFees val_conv;
33919 val_conv.inner = (void*)(val & (~1));
33920 val_conv.is_owned = (val & 1) || (val == 0);
33921 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33922 val_conv = RoutingFees_clone(&val_conv);
33923 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
33926 int16_t __attribute__((visibility("default"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) {
33927 LDKRouteHintHop this_ptr_conv;
33928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33929 this_ptr_conv.is_owned = false;
33930 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33931 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
33935 void __attribute__((visibility("default"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
33936 LDKRouteHintHop this_ptr_conv;
33937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33938 this_ptr_conv.is_owned = false;
33939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33940 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
33943 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) {
33944 LDKRouteHintHop this_ptr_conv;
33945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33946 this_ptr_conv.is_owned = false;
33947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33948 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
33949 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
33950 uint64_t ret_ref = (uint64_t)ret_copy;
33954 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
33955 LDKRouteHintHop this_ptr_conv;
33956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33957 this_ptr_conv.is_owned = false;
33958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33959 void* val_ptr = (void*)(((uint64_t)val) & ~1);
33960 CHECK_ACCESS(val_ptr);
33961 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
33962 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
33963 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
33966 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) {
33967 LDKRouteHintHop this_ptr_conv;
33968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33969 this_ptr_conv.is_owned = false;
33970 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33971 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
33972 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
33973 uint64_t ret_ref = (uint64_t)ret_copy;
33977 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
33978 LDKRouteHintHop this_ptr_conv;
33979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33980 this_ptr_conv.is_owned = false;
33981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33982 void* val_ptr = (void*)(((uint64_t)val) & ~1);
33983 CHECK_ACCESS(val_ptr);
33984 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
33985 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
33986 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
33989 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) {
33990 LDKPublicKey src_node_id_arg_ref;
33991 CHECK(*((uint32_t*)src_node_id_arg) == 33);
33992 memcpy(src_node_id_arg_ref.compressed_form, (uint8_t*)(src_node_id_arg + 4), 33);
33993 LDKRoutingFees fees_arg_conv;
33994 fees_arg_conv.inner = (void*)(fees_arg & (~1));
33995 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
33996 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
33997 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
33998 void* htlc_minimum_msat_arg_ptr = (void*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
33999 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
34000 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
34001 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1));
34002 void* htlc_maximum_msat_arg_ptr = (void*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
34003 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
34004 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
34005 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
34006 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);
34007 uint64_t ret_ref = 0;
34008 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34009 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34010 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34011 ret_ref = (uint64_t)ret_var.inner;
34012 if (ret_var.is_owned) {
34018 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
34019 LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
34020 uint64_t ret_ref = 0;
34021 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34022 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34023 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34024 ret_ref = (uint64_t)ret_var.inner;
34025 if (ret_var.is_owned) {
34030 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_clone_ptr(uint32_t arg) {
34031 LDKRouteHintHop arg_conv;
34032 arg_conv.inner = (void*)(arg & (~1));
34033 arg_conv.is_owned = false;
34034 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34035 int64_t ret_val = RouteHintHop_clone_ptr(&arg_conv);
34039 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_clone(uint32_t orig) {
34040 LDKRouteHintHop orig_conv;
34041 orig_conv.inner = (void*)(orig & (~1));
34042 orig_conv.is_owned = false;
34043 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34044 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
34045 uint64_t ret_ref = 0;
34046 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34047 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34048 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34049 ret_ref = (uint64_t)ret_var.inner;
34050 if (ret_var.is_owned) {
34056 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_hash(uint32_t o) {
34057 LDKRouteHintHop o_conv;
34058 o_conv.inner = (void*)(o & (~1));
34059 o_conv.is_owned = false;
34060 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34061 int64_t ret_val = RouteHintHop_hash(&o_conv);
34065 jboolean __attribute__((visibility("default"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
34066 LDKRouteHintHop a_conv;
34067 a_conv.inner = (void*)(a & (~1));
34068 a_conv.is_owned = false;
34069 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34070 LDKRouteHintHop b_conv;
34071 b_conv.inner = (void*)(b & (~1));
34072 b_conv.is_owned = false;
34073 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34074 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
34078 int8_tArray __attribute__((visibility("default"))) TS_RouteHintHop_write(uint32_t obj) {
34079 LDKRouteHintHop obj_conv;
34080 obj_conv.inner = (void*)(obj & (~1));
34081 obj_conv.is_owned = false;
34082 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34083 LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
34084 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
34085 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
34086 CVec_u8Z_free(ret_var);
34090 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_read(int8_tArray ser) {
34091 LDKu8slice ser_ref;
34092 ser_ref.datalen = *((uint32_t*)ser);
34093 ser_ref.data = (int8_t*)(ser + 4);
34094 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
34095 *ret_conv = RouteHintHop_read(ser_ref);
34096 return (uint64_t)ret_conv;
34099 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) {
34100 LDKPublicKey our_node_pubkey_ref;
34101 CHECK(*((uint32_t*)our_node_pubkey) == 33);
34102 memcpy(our_node_pubkey_ref.compressed_form, (uint8_t*)(our_node_pubkey + 4), 33);
34103 LDKRouteParameters params_conv;
34104 params_conv.inner = (void*)(params & (~1));
34105 params_conv.is_owned = false;
34106 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
34107 LDKNetworkGraph network_conv;
34108 network_conv.inner = (void*)(network & (~1));
34109 network_conv.is_owned = false;
34110 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_conv);
34111 LDKCVec_ChannelDetailsZ first_hops_constr;
34112 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
34113 if (first_hops != 0) {
34114 first_hops_constr.datalen = *((uint32_t*)first_hops);
34115 if (first_hops_constr.datalen > 0)
34116 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
34118 first_hops_constr.data = NULL;
34119 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
34120 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
34121 uint32_t first_hops_conv_16 = first_hops_vals[q];
34122 LDKChannelDetails first_hops_conv_16_conv;
34123 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
34124 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
34125 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
34126 first_hops_constr.data[q] = first_hops_conv_16_conv;
34128 first_hops_ptr = &first_hops_constr;
34130 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
34131 CHECK_ACCESS(logger_ptr);
34132 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
34133 void* scorer_ptr = (void*)(((uint64_t)scorer) & ~1);
34134 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
34135 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
34136 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
34137 *ret_conv = find_route(our_node_pubkey_ref, ¶ms_conv, &network_conv, first_hops_ptr, logger_conv, scorer_conv);
34138 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
34139 return (uint64_t)ret_conv;
34142 void __attribute__((visibility("default"))) TS_Scorer_free(uint32_t this_obj) {
34143 LDKScorer this_obj_conv;
34144 this_obj_conv.inner = (void*)(this_obj & (~1));
34145 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34146 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34147 Scorer_free(this_obj_conv);
34150 void __attribute__((visibility("default"))) TS_ScoringParameters_free(uint32_t this_obj) {
34151 LDKScoringParameters this_obj_conv;
34152 this_obj_conv.inner = (void*)(this_obj & (~1));
34153 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34154 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34155 ScoringParameters_free(this_obj_conv);
34158 int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_base_penalty_msat(uint32_t this_ptr) {
34159 LDKScoringParameters this_ptr_conv;
34160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34161 this_ptr_conv.is_owned = false;
34162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34163 int64_t ret_val = ScoringParameters_get_base_penalty_msat(&this_ptr_conv);
34167 void __attribute__((visibility("default"))) TS_ScoringParameters_set_base_penalty_msat(uint32_t this_ptr, int64_t val) {
34168 LDKScoringParameters this_ptr_conv;
34169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34170 this_ptr_conv.is_owned = false;
34171 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34172 ScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
34175 int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_failure_penalty_msat(uint32_t this_ptr) {
34176 LDKScoringParameters this_ptr_conv;
34177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34178 this_ptr_conv.is_owned = false;
34179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34180 int64_t ret_val = ScoringParameters_get_failure_penalty_msat(&this_ptr_conv);
34184 void __attribute__((visibility("default"))) TS_ScoringParameters_set_failure_penalty_msat(uint32_t this_ptr, int64_t val) {
34185 LDKScoringParameters this_ptr_conv;
34186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34187 this_ptr_conv.is_owned = false;
34188 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34189 ScoringParameters_set_failure_penalty_msat(&this_ptr_conv, val);
34192 int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_failure_penalty_half_life(uint32_t this_ptr) {
34193 LDKScoringParameters this_ptr_conv;
34194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34195 this_ptr_conv.is_owned = false;
34196 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34197 int64_t ret_val = ScoringParameters_get_failure_penalty_half_life(&this_ptr_conv);
34201 void __attribute__((visibility("default"))) TS_ScoringParameters_set_failure_penalty_half_life(uint32_t this_ptr, int64_t val) {
34202 LDKScoringParameters this_ptr_conv;
34203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34204 this_ptr_conv.is_owned = false;
34205 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34206 ScoringParameters_set_failure_penalty_half_life(&this_ptr_conv, val);
34209 uint32_t __attribute__((visibility("default"))) TS_ScoringParameters_new(int64_t base_penalty_msat_arg, int64_t failure_penalty_msat_arg, int64_t failure_penalty_half_life_arg) {
34210 LDKScoringParameters ret_var = ScoringParameters_new(base_penalty_msat_arg, failure_penalty_msat_arg, failure_penalty_half_life_arg);
34211 uint64_t ret_ref = 0;
34212 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34213 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34214 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34215 ret_ref = (uint64_t)ret_var.inner;
34216 if (ret_var.is_owned) {
34222 int8_tArray __attribute__((visibility("default"))) TS_ScoringParameters_write(uint32_t obj) {
34223 LDKScoringParameters obj_conv;
34224 obj_conv.inner = (void*)(obj & (~1));
34225 obj_conv.is_owned = false;
34226 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34227 LDKCVec_u8Z ret_var = ScoringParameters_write(&obj_conv);
34228 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
34229 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
34230 CVec_u8Z_free(ret_var);
34234 uint32_t __attribute__((visibility("default"))) TS_ScoringParameters_read(int8_tArray ser) {
34235 LDKu8slice ser_ref;
34236 ser_ref.datalen = *((uint32_t*)ser);
34237 ser_ref.data = (int8_t*)(ser + 4);
34238 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
34239 *ret_conv = ScoringParameters_read(ser_ref);
34240 return (uint64_t)ret_conv;
34243 uint32_t __attribute__((visibility("default"))) TS_Scorer_new(uint32_t params) {
34244 LDKScoringParameters params_conv;
34245 params_conv.inner = (void*)(params & (~1));
34246 params_conv.is_owned = (params & 1) || (params == 0);
34247 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
34248 // Warning: we need a move here but no clone is available for LDKScoringParameters
34249 LDKScorer ret_var = Scorer_new(params_conv);
34250 uint64_t ret_ref = 0;
34251 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34252 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34253 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34254 ret_ref = (uint64_t)ret_var.inner;
34255 if (ret_var.is_owned) {
34261 uint32_t __attribute__((visibility("default"))) TS_Scorer_default() {
34262 LDKScorer ret_var = Scorer_default();
34263 uint64_t ret_ref = 0;
34264 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34265 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34266 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34267 ret_ref = (uint64_t)ret_var.inner;
34268 if (ret_var.is_owned) {
34274 uint32_t __attribute__((visibility("default"))) TS_ScoringParameters_default() {
34275 LDKScoringParameters ret_var = ScoringParameters_default();
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 uint32_t __attribute__((visibility("default"))) TS_Scorer_as_Score(uint32_t this_arg) {
34288 LDKScorer this_arg_conv;
34289 this_arg_conv.inner = (void*)(this_arg & (~1));
34290 this_arg_conv.is_owned = false;
34291 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34292 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
34293 *ret_ret = Scorer_as_Score(&this_arg_conv);
34294 return (uint64_t)ret_ret;
34297 int8_tArray __attribute__((visibility("default"))) TS_Scorer_write(uint32_t obj) {
34298 LDKScorer obj_conv;
34299 obj_conv.inner = (void*)(obj & (~1));
34300 obj_conv.is_owned = false;
34301 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34302 LDKCVec_u8Z ret_var = Scorer_write(&obj_conv);
34303 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
34304 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
34305 CVec_u8Z_free(ret_var);
34309 uint32_t __attribute__((visibility("default"))) TS_Scorer_read(int8_tArray ser) {
34310 LDKu8slice ser_ref;
34311 ser_ref.datalen = *((uint32_t*)ser);
34312 ser_ref.data = (int8_t*)(ser + 4);
34313 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
34314 *ret_conv = Scorer_read(ser_ref);
34315 return (uint64_t)ret_conv;
34318 void __attribute__((visibility("default"))) TS_FilesystemPersister_free(uint32_t this_obj) {
34319 LDKFilesystemPersister this_obj_conv;
34320 this_obj_conv.inner = (void*)(this_obj & (~1));
34321 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34322 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34323 FilesystemPersister_free(this_obj_conv);
34326 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_new(jstring path_to_channel_data) {
34327 LDKStr path_to_channel_data_conv = str_ref_to_owned_c(path_to_channel_data);
34328 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
34329 uint64_t ret_ref = 0;
34330 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34331 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34332 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34333 ret_ref = (uint64_t)ret_var.inner;
34334 if (ret_var.is_owned) {
34340 jstring __attribute__((visibility("default"))) TS_FilesystemPersister_get_data_dir(uint32_t this_arg) {
34341 LDKFilesystemPersister this_arg_conv;
34342 this_arg_conv.inner = (void*)(this_arg & (~1));
34343 this_arg_conv.is_owned = false;
34344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34345 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
34346 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
34351 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_persist_manager(jstring data_dir, uint32_t manager) {
34352 LDKStr data_dir_conv = str_ref_to_owned_c(data_dir);
34353 LDKChannelManager manager_conv;
34354 manager_conv.inner = (void*)(manager & (~1));
34355 manager_conv.is_owned = false;
34356 CHECK_INNER_FIELD_ACCESS_OR_NULL(manager_conv);
34357 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
34358 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
34359 return (uint64_t)ret_conv;
34362 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_read_channelmonitors(uint32_t this_arg, uint32_t keys_manager) {
34363 LDKFilesystemPersister this_arg_conv;
34364 this_arg_conv.inner = (void*)(this_arg & (~1));
34365 this_arg_conv.is_owned = false;
34366 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34367 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
34368 CHECK_ACCESS(keys_manager_ptr);
34369 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
34370 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
34371 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
34372 return (uint64_t)ret_conv;
34375 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_as_Persist(uint32_t this_arg) {
34376 LDKFilesystemPersister this_arg_conv;
34377 this_arg_conv.inner = (void*)(this_arg & (~1));
34378 this_arg_conv.is_owned = false;
34379 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34380 LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
34381 *ret_ret = FilesystemPersister_as_Persist(&this_arg_conv);
34382 return (uint64_t)ret_ret;
34385 void __attribute__((visibility("default"))) TS_BackgroundProcessor_free(uint32_t this_obj) {
34386 LDKBackgroundProcessor this_obj_conv;
34387 this_obj_conv.inner = (void*)(this_obj & (~1));
34388 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34389 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34390 BackgroundProcessor_free(this_obj_conv);
34393 void __attribute__((visibility("default"))) TS_ChannelManagerPersister_free(uint32_t this_ptr) {
34394 if ((this_ptr & 1) != 0) return;
34395 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
34396 CHECK_ACCESS(this_ptr_ptr);
34397 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(this_ptr_ptr);
34398 FREE((void*)this_ptr);
34399 ChannelManagerPersister_free(this_ptr_conv);
34402 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) {
34403 void* persister_ptr = (void*)(((uint64_t)persister) & ~1);
34404 CHECK_ACCESS(persister_ptr);
34405 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(persister_ptr);
34406 void* event_handler_ptr = (void*)(((uint64_t)event_handler) & ~1);
34407 CHECK_ACCESS(event_handler_ptr);
34408 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
34409 LDKChainMonitor chain_monitor_conv;
34410 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
34411 chain_monitor_conv.is_owned = false;
34412 CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
34413 LDKChannelManager channel_manager_conv;
34414 channel_manager_conv.inner = (void*)(channel_manager & (~1));
34415 channel_manager_conv.is_owned = false;
34416 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
34417 LDKNetGraphMsgHandler net_graph_msg_handler_conv;
34418 net_graph_msg_handler_conv.inner = (void*)(net_graph_msg_handler & (~1));
34419 net_graph_msg_handler_conv.is_owned = (net_graph_msg_handler & 1) || (net_graph_msg_handler == 0);
34420 CHECK_INNER_FIELD_ACCESS_OR_NULL(net_graph_msg_handler_conv);
34421 LDKPeerManager peer_manager_conv;
34422 peer_manager_conv.inner = (void*)(peer_manager & (~1));
34423 peer_manager_conv.is_owned = false;
34424 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
34425 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
34426 CHECK_ACCESS(logger_ptr);
34427 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
34428 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);
34429 uint64_t ret_ref = 0;
34430 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34431 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34432 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34433 ret_ref = (uint64_t)ret_var.inner;
34434 if (ret_var.is_owned) {
34440 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_join(uint32_t this_arg) {
34441 LDKBackgroundProcessor this_arg_conv;
34442 this_arg_conv.inner = (void*)(this_arg & (~1));
34443 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
34444 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34445 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
34446 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
34447 *ret_conv = BackgroundProcessor_join(this_arg_conv);
34448 return (uint64_t)ret_conv;
34451 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_stop(uint32_t this_arg) {
34452 LDKBackgroundProcessor this_arg_conv;
34453 this_arg_conv.inner = (void*)(this_arg & (~1));
34454 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
34455 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34456 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
34457 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
34458 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
34459 return (uint64_t)ret_conv;
34462 void __attribute__((visibility("default"))) TS_check_platform() {
34466 void __attribute__((visibility("default"))) TS_Invoice_free(uint32_t this_obj) {
34467 LDKInvoice this_obj_conv;
34468 this_obj_conv.inner = (void*)(this_obj & (~1));
34469 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34471 Invoice_free(this_obj_conv);
34474 jboolean __attribute__((visibility("default"))) TS_Invoice_eq(uint32_t a, uint32_t b) {
34476 a_conv.inner = (void*)(a & (~1));
34477 a_conv.is_owned = false;
34478 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34480 b_conv.inner = (void*)(b & (~1));
34481 b_conv.is_owned = false;
34482 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34483 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
34487 static inline uint64_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
34488 LDKInvoice ret_var = Invoice_clone(arg);
34489 uint64_t ret_ref = 0;
34490 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34491 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34492 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34493 ret_ref = (uint64_t)ret_var.inner;
34494 if (ret_var.is_owned) {
34499 int64_t __attribute__((visibility("default"))) TS_Invoice_clone_ptr(uint32_t arg) {
34500 LDKInvoice arg_conv;
34501 arg_conv.inner = (void*)(arg & (~1));
34502 arg_conv.is_owned = false;
34503 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34504 int64_t ret_val = Invoice_clone_ptr(&arg_conv);
34508 uint32_t __attribute__((visibility("default"))) TS_Invoice_clone(uint32_t orig) {
34509 LDKInvoice orig_conv;
34510 orig_conv.inner = (void*)(orig & (~1));
34511 orig_conv.is_owned = false;
34512 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34513 LDKInvoice ret_var = Invoice_clone(&orig_conv);
34514 uint64_t ret_ref = 0;
34515 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34516 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34517 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34518 ret_ref = (uint64_t)ret_var.inner;
34519 if (ret_var.is_owned) {
34525 void __attribute__((visibility("default"))) TS_SignedRawInvoice_free(uint32_t this_obj) {
34526 LDKSignedRawInvoice this_obj_conv;
34527 this_obj_conv.inner = (void*)(this_obj & (~1));
34528 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34529 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34530 SignedRawInvoice_free(this_obj_conv);
34533 jboolean __attribute__((visibility("default"))) TS_SignedRawInvoice_eq(uint32_t a, uint32_t b) {
34534 LDKSignedRawInvoice a_conv;
34535 a_conv.inner = (void*)(a & (~1));
34536 a_conv.is_owned = false;
34537 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34538 LDKSignedRawInvoice b_conv;
34539 b_conv.inner = (void*)(b & (~1));
34540 b_conv.is_owned = false;
34541 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34542 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
34546 static inline uint64_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
34547 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
34548 uint64_t ret_ref = 0;
34549 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34550 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34551 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34552 ret_ref = (uint64_t)ret_var.inner;
34553 if (ret_var.is_owned) {
34558 int64_t __attribute__((visibility("default"))) TS_SignedRawInvoice_clone_ptr(uint32_t arg) {
34559 LDKSignedRawInvoice arg_conv;
34560 arg_conv.inner = (void*)(arg & (~1));
34561 arg_conv.is_owned = false;
34562 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34563 int64_t ret_val = SignedRawInvoice_clone_ptr(&arg_conv);
34567 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_clone(uint32_t orig) {
34568 LDKSignedRawInvoice orig_conv;
34569 orig_conv.inner = (void*)(orig & (~1));
34570 orig_conv.is_owned = false;
34571 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34572 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
34573 uint64_t ret_ref = 0;
34574 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34575 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34576 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34577 ret_ref = (uint64_t)ret_var.inner;
34578 if (ret_var.is_owned) {
34584 void __attribute__((visibility("default"))) TS_RawInvoice_free(uint32_t this_obj) {
34585 LDKRawInvoice this_obj_conv;
34586 this_obj_conv.inner = (void*)(this_obj & (~1));
34587 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34589 RawInvoice_free(this_obj_conv);
34592 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_get_data(uint32_t this_ptr) {
34593 LDKRawInvoice this_ptr_conv;
34594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34595 this_ptr_conv.is_owned = false;
34596 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34597 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
34598 uint64_t ret_ref = 0;
34599 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34600 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34601 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34602 ret_ref = (uint64_t)ret_var.inner;
34603 if (ret_var.is_owned) {
34609 void __attribute__((visibility("default"))) TS_RawInvoice_set_data(uint32_t this_ptr, uint32_t val) {
34610 LDKRawInvoice this_ptr_conv;
34611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34612 this_ptr_conv.is_owned = false;
34613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34614 LDKRawDataPart val_conv;
34615 val_conv.inner = (void*)(val & (~1));
34616 val_conv.is_owned = (val & 1) || (val == 0);
34617 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34618 val_conv = RawDataPart_clone(&val_conv);
34619 RawInvoice_set_data(&this_ptr_conv, val_conv);
34622 jboolean __attribute__((visibility("default"))) TS_RawInvoice_eq(uint32_t a, uint32_t b) {
34623 LDKRawInvoice a_conv;
34624 a_conv.inner = (void*)(a & (~1));
34625 a_conv.is_owned = false;
34626 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34627 LDKRawInvoice b_conv;
34628 b_conv.inner = (void*)(b & (~1));
34629 b_conv.is_owned = false;
34630 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34631 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
34635 static inline uint64_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
34636 LDKRawInvoice ret_var = RawInvoice_clone(arg);
34637 uint64_t ret_ref = 0;
34638 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34639 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34640 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34641 ret_ref = (uint64_t)ret_var.inner;
34642 if (ret_var.is_owned) {
34647 int64_t __attribute__((visibility("default"))) TS_RawInvoice_clone_ptr(uint32_t arg) {
34648 LDKRawInvoice arg_conv;
34649 arg_conv.inner = (void*)(arg & (~1));
34650 arg_conv.is_owned = false;
34651 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34652 int64_t ret_val = RawInvoice_clone_ptr(&arg_conv);
34656 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_clone(uint32_t orig) {
34657 LDKRawInvoice orig_conv;
34658 orig_conv.inner = (void*)(orig & (~1));
34659 orig_conv.is_owned = false;
34660 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34661 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
34662 uint64_t ret_ref = 0;
34663 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34664 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34665 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34666 ret_ref = (uint64_t)ret_var.inner;
34667 if (ret_var.is_owned) {
34673 void __attribute__((visibility("default"))) TS_RawDataPart_free(uint32_t this_obj) {
34674 LDKRawDataPart this_obj_conv;
34675 this_obj_conv.inner = (void*)(this_obj & (~1));
34676 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34677 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34678 RawDataPart_free(this_obj_conv);
34681 uint32_t __attribute__((visibility("default"))) TS_RawDataPart_get_timestamp(uint32_t this_ptr) {
34682 LDKRawDataPart this_ptr_conv;
34683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34684 this_ptr_conv.is_owned = false;
34685 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34686 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_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 void __attribute__((visibility("default"))) TS_RawDataPart_set_timestamp(uint32_t this_ptr, uint32_t val) {
34699 LDKRawDataPart this_ptr_conv;
34700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34701 this_ptr_conv.is_owned = false;
34702 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34703 LDKPositiveTimestamp val_conv;
34704 val_conv.inner = (void*)(val & (~1));
34705 val_conv.is_owned = (val & 1) || (val == 0);
34706 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34707 val_conv = PositiveTimestamp_clone(&val_conv);
34708 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
34711 jboolean __attribute__((visibility("default"))) TS_RawDataPart_eq(uint32_t a, uint32_t b) {
34712 LDKRawDataPart a_conv;
34713 a_conv.inner = (void*)(a & (~1));
34714 a_conv.is_owned = false;
34715 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34716 LDKRawDataPart b_conv;
34717 b_conv.inner = (void*)(b & (~1));
34718 b_conv.is_owned = false;
34719 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34720 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
34724 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
34725 LDKRawDataPart ret_var = RawDataPart_clone(arg);
34726 uint64_t ret_ref = 0;
34727 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34728 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34729 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34730 ret_ref = (uint64_t)ret_var.inner;
34731 if (ret_var.is_owned) {
34736 int64_t __attribute__((visibility("default"))) TS_RawDataPart_clone_ptr(uint32_t arg) {
34737 LDKRawDataPart arg_conv;
34738 arg_conv.inner = (void*)(arg & (~1));
34739 arg_conv.is_owned = false;
34740 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34741 int64_t ret_val = RawDataPart_clone_ptr(&arg_conv);
34745 uint32_t __attribute__((visibility("default"))) TS_RawDataPart_clone(uint32_t orig) {
34746 LDKRawDataPart orig_conv;
34747 orig_conv.inner = (void*)(orig & (~1));
34748 orig_conv.is_owned = false;
34749 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34750 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
34751 uint64_t ret_ref = 0;
34752 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34753 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34754 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34755 ret_ref = (uint64_t)ret_var.inner;
34756 if (ret_var.is_owned) {
34762 void __attribute__((visibility("default"))) TS_PositiveTimestamp_free(uint32_t this_obj) {
34763 LDKPositiveTimestamp this_obj_conv;
34764 this_obj_conv.inner = (void*)(this_obj & (~1));
34765 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34766 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34767 PositiveTimestamp_free(this_obj_conv);
34770 jboolean __attribute__((visibility("default"))) TS_PositiveTimestamp_eq(uint32_t a, uint32_t b) {
34771 LDKPositiveTimestamp a_conv;
34772 a_conv.inner = (void*)(a & (~1));
34773 a_conv.is_owned = false;
34774 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34775 LDKPositiveTimestamp b_conv;
34776 b_conv.inner = (void*)(b & (~1));
34777 b_conv.is_owned = false;
34778 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34779 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
34783 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
34784 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
34785 uint64_t ret_ref = 0;
34786 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34787 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34788 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34789 ret_ref = (uint64_t)ret_var.inner;
34790 if (ret_var.is_owned) {
34795 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_clone_ptr(uint32_t arg) {
34796 LDKPositiveTimestamp arg_conv;
34797 arg_conv.inner = (void*)(arg & (~1));
34798 arg_conv.is_owned = false;
34799 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34800 int64_t ret_val = PositiveTimestamp_clone_ptr(&arg_conv);
34804 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_clone(uint32_t orig) {
34805 LDKPositiveTimestamp orig_conv;
34806 orig_conv.inner = (void*)(orig & (~1));
34807 orig_conv.is_owned = false;
34808 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34809 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
34810 uint64_t ret_ref = 0;
34811 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34812 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34813 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34814 ret_ref = (uint64_t)ret_var.inner;
34815 if (ret_var.is_owned) {
34821 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_clone(uint32_t orig) {
34822 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
34823 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
34827 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_milli() {
34828 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
34832 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_micro() {
34833 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
34837 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_nano() {
34838 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
34842 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_pico() {
34843 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
34847 jboolean __attribute__((visibility("default"))) TS_SiPrefix_eq(uint32_t a, uint32_t b) {
34848 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
34849 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
34850 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
34854 int64_t __attribute__((visibility("default"))) TS_SiPrefix_multiplier(uint32_t this_arg) {
34855 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
34856 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
34860 uint32_t __attribute__((visibility("default"))) TS_Currency_clone(uint32_t orig) {
34861 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
34862 uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
34866 uint32_t __attribute__((visibility("default"))) TS_Currency_bitcoin() {
34867 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
34871 uint32_t __attribute__((visibility("default"))) TS_Currency_bitcoin_testnet() {
34872 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
34876 uint32_t __attribute__((visibility("default"))) TS_Currency_regtest() {
34877 uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
34881 uint32_t __attribute__((visibility("default"))) TS_Currency_simnet() {
34882 uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
34886 uint32_t __attribute__((visibility("default"))) TS_Currency_signet() {
34887 uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
34891 int64_t __attribute__((visibility("default"))) TS_Currency_hash(uint32_t o) {
34892 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
34893 int64_t ret_val = Currency_hash(o_conv);
34897 jboolean __attribute__((visibility("default"))) TS_Currency_eq(uint32_t a, uint32_t b) {
34898 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
34899 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
34900 jboolean ret_val = Currency_eq(a_conv, b_conv);
34904 void __attribute__((visibility("default"))) TS_Sha256_free(uint32_t this_obj) {
34905 LDKSha256 this_obj_conv;
34906 this_obj_conv.inner = (void*)(this_obj & (~1));
34907 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34908 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34909 Sha256_free(this_obj_conv);
34912 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
34913 LDKSha256 ret_var = Sha256_clone(arg);
34914 uint64_t ret_ref = 0;
34915 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34916 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34917 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34918 ret_ref = (uint64_t)ret_var.inner;
34919 if (ret_var.is_owned) {
34924 int64_t __attribute__((visibility("default"))) TS_Sha256_clone_ptr(uint32_t arg) {
34925 LDKSha256 arg_conv;
34926 arg_conv.inner = (void*)(arg & (~1));
34927 arg_conv.is_owned = false;
34928 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34929 int64_t ret_val = Sha256_clone_ptr(&arg_conv);
34933 uint32_t __attribute__((visibility("default"))) TS_Sha256_clone(uint32_t orig) {
34934 LDKSha256 orig_conv;
34935 orig_conv.inner = (void*)(orig & (~1));
34936 orig_conv.is_owned = false;
34937 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34938 LDKSha256 ret_var = Sha256_clone(&orig_conv);
34939 uint64_t ret_ref = 0;
34940 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34941 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34942 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34943 ret_ref = (uint64_t)ret_var.inner;
34944 if (ret_var.is_owned) {
34950 int64_t __attribute__((visibility("default"))) TS_Sha256_hash(uint32_t o) {
34952 o_conv.inner = (void*)(o & (~1));
34953 o_conv.is_owned = false;
34954 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34955 int64_t ret_val = Sha256_hash(&o_conv);
34959 jboolean __attribute__((visibility("default"))) TS_Sha256_eq(uint32_t a, uint32_t b) {
34961 a_conv.inner = (void*)(a & (~1));
34962 a_conv.is_owned = false;
34963 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34965 b_conv.inner = (void*)(b & (~1));
34966 b_conv.is_owned = false;
34967 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34968 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
34972 void __attribute__((visibility("default"))) TS_Description_free(uint32_t this_obj) {
34973 LDKDescription this_obj_conv;
34974 this_obj_conv.inner = (void*)(this_obj & (~1));
34975 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34976 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34977 Description_free(this_obj_conv);
34980 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
34981 LDKDescription ret_var = Description_clone(arg);
34982 uint64_t ret_ref = 0;
34983 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34984 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34985 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34986 ret_ref = (uint64_t)ret_var.inner;
34987 if (ret_var.is_owned) {
34992 int64_t __attribute__((visibility("default"))) TS_Description_clone_ptr(uint32_t arg) {
34993 LDKDescription arg_conv;
34994 arg_conv.inner = (void*)(arg & (~1));
34995 arg_conv.is_owned = false;
34996 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34997 int64_t ret_val = Description_clone_ptr(&arg_conv);
35001 uint32_t __attribute__((visibility("default"))) TS_Description_clone(uint32_t orig) {
35002 LDKDescription orig_conv;
35003 orig_conv.inner = (void*)(orig & (~1));
35004 orig_conv.is_owned = false;
35005 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35006 LDKDescription ret_var = Description_clone(&orig_conv);
35007 uint64_t ret_ref = 0;
35008 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35009 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35010 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35011 ret_ref = (uint64_t)ret_var.inner;
35012 if (ret_var.is_owned) {
35018 int64_t __attribute__((visibility("default"))) TS_Description_hash(uint32_t o) {
35019 LDKDescription o_conv;
35020 o_conv.inner = (void*)(o & (~1));
35021 o_conv.is_owned = false;
35022 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35023 int64_t ret_val = Description_hash(&o_conv);
35027 jboolean __attribute__((visibility("default"))) TS_Description_eq(uint32_t a, uint32_t b) {
35028 LDKDescription a_conv;
35029 a_conv.inner = (void*)(a & (~1));
35030 a_conv.is_owned = false;
35031 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35032 LDKDescription b_conv;
35033 b_conv.inner = (void*)(b & (~1));
35034 b_conv.is_owned = false;
35035 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35036 jboolean ret_val = Description_eq(&a_conv, &b_conv);
35040 void __attribute__((visibility("default"))) TS_PayeePubKey_free(uint32_t this_obj) {
35041 LDKPayeePubKey this_obj_conv;
35042 this_obj_conv.inner = (void*)(this_obj & (~1));
35043 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35044 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35045 PayeePubKey_free(this_obj_conv);
35048 int8_tArray __attribute__((visibility("default"))) TS_PayeePubKey_get_a(uint32_t this_ptr) {
35049 LDKPayeePubKey this_ptr_conv;
35050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35051 this_ptr_conv.is_owned = false;
35052 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35053 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
35054 memcpy((uint8_t*)(ret_arr + 4), PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
35058 void __attribute__((visibility("default"))) TS_PayeePubKey_set_a(uint32_t this_ptr, int8_tArray val) {
35059 LDKPayeePubKey this_ptr_conv;
35060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35061 this_ptr_conv.is_owned = false;
35062 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35063 LDKPublicKey val_ref;
35064 CHECK(*((uint32_t*)val) == 33);
35065 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
35066 PayeePubKey_set_a(&this_ptr_conv, val_ref);
35069 uint32_t __attribute__((visibility("default"))) TS_PayeePubKey_new(int8_tArray a_arg) {
35070 LDKPublicKey a_arg_ref;
35071 CHECK(*((uint32_t*)a_arg) == 33);
35072 memcpy(a_arg_ref.compressed_form, (uint8_t*)(a_arg + 4), 33);
35073 LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
35074 uint64_t ret_ref = 0;
35075 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35076 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35077 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35078 ret_ref = (uint64_t)ret_var.inner;
35079 if (ret_var.is_owned) {
35085 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
35086 LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
35087 uint64_t ret_ref = 0;
35088 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35089 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35090 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35091 ret_ref = (uint64_t)ret_var.inner;
35092 if (ret_var.is_owned) {
35097 int64_t __attribute__((visibility("default"))) TS_PayeePubKey_clone_ptr(uint32_t arg) {
35098 LDKPayeePubKey arg_conv;
35099 arg_conv.inner = (void*)(arg & (~1));
35100 arg_conv.is_owned = false;
35101 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35102 int64_t ret_val = PayeePubKey_clone_ptr(&arg_conv);
35106 uint32_t __attribute__((visibility("default"))) TS_PayeePubKey_clone(uint32_t orig) {
35107 LDKPayeePubKey orig_conv;
35108 orig_conv.inner = (void*)(orig & (~1));
35109 orig_conv.is_owned = false;
35110 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35111 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
35112 uint64_t ret_ref = 0;
35113 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35114 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35115 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35116 ret_ref = (uint64_t)ret_var.inner;
35117 if (ret_var.is_owned) {
35123 int64_t __attribute__((visibility("default"))) TS_PayeePubKey_hash(uint32_t o) {
35124 LDKPayeePubKey o_conv;
35125 o_conv.inner = (void*)(o & (~1));
35126 o_conv.is_owned = false;
35127 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35128 int64_t ret_val = PayeePubKey_hash(&o_conv);
35132 jboolean __attribute__((visibility("default"))) TS_PayeePubKey_eq(uint32_t a, uint32_t b) {
35133 LDKPayeePubKey a_conv;
35134 a_conv.inner = (void*)(a & (~1));
35135 a_conv.is_owned = false;
35136 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35137 LDKPayeePubKey b_conv;
35138 b_conv.inner = (void*)(b & (~1));
35139 b_conv.is_owned = false;
35140 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35141 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
35145 void __attribute__((visibility("default"))) TS_ExpiryTime_free(uint32_t this_obj) {
35146 LDKExpiryTime this_obj_conv;
35147 this_obj_conv.inner = (void*)(this_obj & (~1));
35148 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35149 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35150 ExpiryTime_free(this_obj_conv);
35153 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
35154 LDKExpiryTime ret_var = ExpiryTime_clone(arg);
35155 uint64_t ret_ref = 0;
35156 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35157 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35158 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35159 ret_ref = (uint64_t)ret_var.inner;
35160 if (ret_var.is_owned) {
35165 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_clone_ptr(uint32_t arg) {
35166 LDKExpiryTime arg_conv;
35167 arg_conv.inner = (void*)(arg & (~1));
35168 arg_conv.is_owned = false;
35169 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35170 int64_t ret_val = ExpiryTime_clone_ptr(&arg_conv);
35174 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_clone(uint32_t orig) {
35175 LDKExpiryTime orig_conv;
35176 orig_conv.inner = (void*)(orig & (~1));
35177 orig_conv.is_owned = false;
35178 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35179 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
35180 uint64_t ret_ref = 0;
35181 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35182 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35183 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35184 ret_ref = (uint64_t)ret_var.inner;
35185 if (ret_var.is_owned) {
35191 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_hash(uint32_t o) {
35192 LDKExpiryTime o_conv;
35193 o_conv.inner = (void*)(o & (~1));
35194 o_conv.is_owned = false;
35195 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35196 int64_t ret_val = ExpiryTime_hash(&o_conv);
35200 jboolean __attribute__((visibility("default"))) TS_ExpiryTime_eq(uint32_t a, uint32_t b) {
35201 LDKExpiryTime a_conv;
35202 a_conv.inner = (void*)(a & (~1));
35203 a_conv.is_owned = false;
35204 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35205 LDKExpiryTime b_conv;
35206 b_conv.inner = (void*)(b & (~1));
35207 b_conv.is_owned = false;
35208 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35209 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
35213 void __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_free(uint32_t this_obj) {
35214 LDKMinFinalCltvExpiry this_obj_conv;
35215 this_obj_conv.inner = (void*)(this_obj & (~1));
35216 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35217 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35218 MinFinalCltvExpiry_free(this_obj_conv);
35221 int64_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_get_a(uint32_t this_ptr) {
35222 LDKMinFinalCltvExpiry this_ptr_conv;
35223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35224 this_ptr_conv.is_owned = false;
35225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35226 int64_t ret_val = MinFinalCltvExpiry_get_a(&this_ptr_conv);
35230 void __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_set_a(uint32_t this_ptr, int64_t val) {
35231 LDKMinFinalCltvExpiry this_ptr_conv;
35232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35233 this_ptr_conv.is_owned = false;
35234 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35235 MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
35238 uint32_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_new(int64_t a_arg) {
35239 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
35240 uint64_t ret_ref = 0;
35241 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35242 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35243 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35244 ret_ref = (uint64_t)ret_var.inner;
35245 if (ret_var.is_owned) {
35251 static inline uint64_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
35252 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
35253 uint64_t ret_ref = 0;
35254 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35255 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35256 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35257 ret_ref = (uint64_t)ret_var.inner;
35258 if (ret_var.is_owned) {
35263 int64_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_clone_ptr(uint32_t arg) {
35264 LDKMinFinalCltvExpiry arg_conv;
35265 arg_conv.inner = (void*)(arg & (~1));
35266 arg_conv.is_owned = false;
35267 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35268 int64_t ret_val = MinFinalCltvExpiry_clone_ptr(&arg_conv);
35272 uint32_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_clone(uint32_t orig) {
35273 LDKMinFinalCltvExpiry orig_conv;
35274 orig_conv.inner = (void*)(orig & (~1));
35275 orig_conv.is_owned = false;
35276 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35277 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
35278 uint64_t ret_ref = 0;
35279 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35280 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35281 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35282 ret_ref = (uint64_t)ret_var.inner;
35283 if (ret_var.is_owned) {
35289 int64_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_hash(uint32_t o) {
35290 LDKMinFinalCltvExpiry o_conv;
35291 o_conv.inner = (void*)(o & (~1));
35292 o_conv.is_owned = false;
35293 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35294 int64_t ret_val = MinFinalCltvExpiry_hash(&o_conv);
35298 jboolean __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_eq(uint32_t a, uint32_t b) {
35299 LDKMinFinalCltvExpiry a_conv;
35300 a_conv.inner = (void*)(a & (~1));
35301 a_conv.is_owned = false;
35302 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35303 LDKMinFinalCltvExpiry b_conv;
35304 b_conv.inner = (void*)(b & (~1));
35305 b_conv.is_owned = false;
35306 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35307 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
35311 void __attribute__((visibility("default"))) TS_Fallback_free(uint32_t this_ptr) {
35312 if ((this_ptr & 1) != 0) return;
35313 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
35314 CHECK_ACCESS(this_ptr_ptr);
35315 LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
35316 FREE((void*)this_ptr);
35317 Fallback_free(this_ptr_conv);
35320 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
35321 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
35322 *ret_copy = Fallback_clone(arg);
35323 uint64_t ret_ref = (uint64_t)ret_copy;
35326 int64_t __attribute__((visibility("default"))) TS_Fallback_clone_ptr(uint32_t arg) {
35327 LDKFallback* arg_conv = (LDKFallback*)arg;
35328 int64_t ret_val = Fallback_clone_ptr(arg_conv);
35332 uint32_t __attribute__((visibility("default"))) TS_Fallback_clone(uint32_t orig) {
35333 LDKFallback* orig_conv = (LDKFallback*)orig;
35334 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
35335 *ret_copy = Fallback_clone(orig_conv);
35336 uint64_t ret_ref = (uint64_t)ret_copy;
35340 uint32_t __attribute__((visibility("default"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
35342 LDKCVec_u8Z program_ref;
35343 program_ref.datalen = *((uint32_t*)program);
35344 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
35345 memcpy(program_ref.data, (uint8_t*)(program + 4), program_ref.datalen);
35346 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
35347 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
35348 uint64_t ret_ref = (uint64_t)ret_copy;
35352 uint32_t __attribute__((visibility("default"))) TS_Fallback_pub_key_hash(int8_tArray a) {
35353 LDKTwentyBytes a_ref;
35354 CHECK(*((uint32_t*)a) == 20);
35355 memcpy(a_ref.data, (uint8_t*)(a + 4), 20);
35356 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
35357 *ret_copy = Fallback_pub_key_hash(a_ref);
35358 uint64_t ret_ref = (uint64_t)ret_copy;
35362 uint32_t __attribute__((visibility("default"))) TS_Fallback_script_hash(int8_tArray a) {
35363 LDKTwentyBytes a_ref;
35364 CHECK(*((uint32_t*)a) == 20);
35365 memcpy(a_ref.data, (uint8_t*)(a + 4), 20);
35366 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
35367 *ret_copy = Fallback_script_hash(a_ref);
35368 uint64_t ret_ref = (uint64_t)ret_copy;
35372 int64_t __attribute__((visibility("default"))) TS_Fallback_hash(uint32_t o) {
35373 LDKFallback* o_conv = (LDKFallback*)o;
35374 int64_t ret_val = Fallback_hash(o_conv);
35378 jboolean __attribute__((visibility("default"))) TS_Fallback_eq(uint32_t a, uint32_t b) {
35379 LDKFallback* a_conv = (LDKFallback*)a;
35380 LDKFallback* b_conv = (LDKFallback*)b;
35381 jboolean ret_val = Fallback_eq(a_conv, b_conv);
35385 void __attribute__((visibility("default"))) TS_InvoiceSignature_free(uint32_t this_obj) {
35386 LDKInvoiceSignature this_obj_conv;
35387 this_obj_conv.inner = (void*)(this_obj & (~1));
35388 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35389 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35390 InvoiceSignature_free(this_obj_conv);
35393 static inline uint64_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
35394 LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
35395 uint64_t ret_ref = 0;
35396 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35397 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35398 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35399 ret_ref = (uint64_t)ret_var.inner;
35400 if (ret_var.is_owned) {
35405 int64_t __attribute__((visibility("default"))) TS_InvoiceSignature_clone_ptr(uint32_t arg) {
35406 LDKInvoiceSignature arg_conv;
35407 arg_conv.inner = (void*)(arg & (~1));
35408 arg_conv.is_owned = false;
35409 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35410 int64_t ret_val = InvoiceSignature_clone_ptr(&arg_conv);
35414 uint32_t __attribute__((visibility("default"))) TS_InvoiceSignature_clone(uint32_t orig) {
35415 LDKInvoiceSignature orig_conv;
35416 orig_conv.inner = (void*)(orig & (~1));
35417 orig_conv.is_owned = false;
35418 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35419 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
35420 uint64_t ret_ref = 0;
35421 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35422 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35423 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35424 ret_ref = (uint64_t)ret_var.inner;
35425 if (ret_var.is_owned) {
35431 jboolean __attribute__((visibility("default"))) TS_InvoiceSignature_eq(uint32_t a, uint32_t b) {
35432 LDKInvoiceSignature a_conv;
35433 a_conv.inner = (void*)(a & (~1));
35434 a_conv.is_owned = false;
35435 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35436 LDKInvoiceSignature b_conv;
35437 b_conv.inner = (void*)(b & (~1));
35438 b_conv.is_owned = false;
35439 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35440 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
35444 void __attribute__((visibility("default"))) TS_PrivateRoute_free(uint32_t this_obj) {
35445 LDKPrivateRoute this_obj_conv;
35446 this_obj_conv.inner = (void*)(this_obj & (~1));
35447 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35449 PrivateRoute_free(this_obj_conv);
35452 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
35453 LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
35454 uint64_t ret_ref = 0;
35455 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35456 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35457 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35458 ret_ref = (uint64_t)ret_var.inner;
35459 if (ret_var.is_owned) {
35464 int64_t __attribute__((visibility("default"))) TS_PrivateRoute_clone_ptr(uint32_t arg) {
35465 LDKPrivateRoute arg_conv;
35466 arg_conv.inner = (void*)(arg & (~1));
35467 arg_conv.is_owned = false;
35468 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35469 int64_t ret_val = PrivateRoute_clone_ptr(&arg_conv);
35473 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_clone(uint32_t orig) {
35474 LDKPrivateRoute orig_conv;
35475 orig_conv.inner = (void*)(orig & (~1));
35476 orig_conv.is_owned = false;
35477 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35478 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
35479 uint64_t ret_ref = 0;
35480 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35481 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35482 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35483 ret_ref = (uint64_t)ret_var.inner;
35484 if (ret_var.is_owned) {
35490 int64_t __attribute__((visibility("default"))) TS_PrivateRoute_hash(uint32_t o) {
35491 LDKPrivateRoute o_conv;
35492 o_conv.inner = (void*)(o & (~1));
35493 o_conv.is_owned = false;
35494 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35495 int64_t ret_val = PrivateRoute_hash(&o_conv);
35499 jboolean __attribute__((visibility("default"))) TS_PrivateRoute_eq(uint32_t a, uint32_t b) {
35500 LDKPrivateRoute a_conv;
35501 a_conv.inner = (void*)(a & (~1));
35502 a_conv.is_owned = false;
35503 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35504 LDKPrivateRoute b_conv;
35505 b_conv.inner = (void*)(b & (~1));
35506 b_conv.is_owned = false;
35507 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35508 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
35512 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_into_parts(uint32_t this_arg) {
35513 LDKSignedRawInvoice this_arg_conv;
35514 this_arg_conv.inner = (void*)(this_arg & (~1));
35515 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
35516 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35517 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
35518 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
35519 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
35520 return ((uint64_t)ret_conv);
35523 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_raw_invoice(uint32_t this_arg) {
35524 LDKSignedRawInvoice this_arg_conv;
35525 this_arg_conv.inner = (void*)(this_arg & (~1));
35526 this_arg_conv.is_owned = false;
35527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35528 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
35529 uint64_t ret_ref = 0;
35530 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35531 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35532 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35533 ret_ref = (uint64_t)ret_var.inner;
35534 if (ret_var.is_owned) {
35540 int8_tArray __attribute__((visibility("default"))) TS_SignedRawInvoice_hash(uint32_t this_arg) {
35541 LDKSignedRawInvoice this_arg_conv;
35542 this_arg_conv.inner = (void*)(this_arg & (~1));
35543 this_arg_conv.is_owned = false;
35544 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35545 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
35546 memcpy((uint8_t*)(ret_arr + 4), *SignedRawInvoice_hash(&this_arg_conv), 32);
35550 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_signature(uint32_t this_arg) {
35551 LDKSignedRawInvoice this_arg_conv;
35552 this_arg_conv.inner = (void*)(this_arg & (~1));
35553 this_arg_conv.is_owned = false;
35554 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35555 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
35556 uint64_t ret_ref = 0;
35557 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35558 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35559 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35560 ret_ref = (uint64_t)ret_var.inner;
35561 if (ret_var.is_owned) {
35567 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_recover_payee_pub_key(uint32_t this_arg) {
35568 LDKSignedRawInvoice this_arg_conv;
35569 this_arg_conv.inner = (void*)(this_arg & (~1));
35570 this_arg_conv.is_owned = false;
35571 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35572 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
35573 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
35574 return (uint64_t)ret_conv;
35577 jboolean __attribute__((visibility("default"))) TS_SignedRawInvoice_check_signature(uint32_t this_arg) {
35578 LDKSignedRawInvoice this_arg_conv;
35579 this_arg_conv.inner = (void*)(this_arg & (~1));
35580 this_arg_conv.is_owned = false;
35581 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35582 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
35586 int8_tArray __attribute__((visibility("default"))) TS_RawInvoice_hash(uint32_t this_arg) {
35587 LDKRawInvoice this_arg_conv;
35588 this_arg_conv.inner = (void*)(this_arg & (~1));
35589 this_arg_conv.is_owned = false;
35590 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35591 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
35592 memcpy((uint8_t*)(ret_arr + 4), RawInvoice_hash(&this_arg_conv).data, 32);
35596 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_payment_hash(uint32_t this_arg) {
35597 LDKRawInvoice this_arg_conv;
35598 this_arg_conv.inner = (void*)(this_arg & (~1));
35599 this_arg_conv.is_owned = false;
35600 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35601 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
35602 uint64_t ret_ref = 0;
35603 if ((uint64_t)ret_var.inner > 4096) {
35604 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35605 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35606 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35607 ret_ref = (uint64_t)ret_var.inner;
35608 if (ret_var.is_owned) {
35615 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_description(uint32_t this_arg) {
35616 LDKRawInvoice this_arg_conv;
35617 this_arg_conv.inner = (void*)(this_arg & (~1));
35618 this_arg_conv.is_owned = false;
35619 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35620 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
35621 uint64_t ret_ref = 0;
35622 if ((uint64_t)ret_var.inner > 4096) {
35623 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35624 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35625 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35626 ret_ref = (uint64_t)ret_var.inner;
35627 if (ret_var.is_owned) {
35634 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_payee_pub_key(uint32_t this_arg) {
35635 LDKRawInvoice this_arg_conv;
35636 this_arg_conv.inner = (void*)(this_arg & (~1));
35637 this_arg_conv.is_owned = false;
35638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35639 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
35640 uint64_t ret_ref = 0;
35641 if ((uint64_t)ret_var.inner > 4096) {
35642 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35643 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35644 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35645 ret_ref = (uint64_t)ret_var.inner;
35646 if (ret_var.is_owned) {
35653 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_description_hash(uint32_t this_arg) {
35654 LDKRawInvoice this_arg_conv;
35655 this_arg_conv.inner = (void*)(this_arg & (~1));
35656 this_arg_conv.is_owned = false;
35657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35658 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
35659 uint64_t ret_ref = 0;
35660 if ((uint64_t)ret_var.inner > 4096) {
35661 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35662 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35663 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35664 ret_ref = (uint64_t)ret_var.inner;
35665 if (ret_var.is_owned) {
35672 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_expiry_time(uint32_t this_arg) {
35673 LDKRawInvoice this_arg_conv;
35674 this_arg_conv.inner = (void*)(this_arg & (~1));
35675 this_arg_conv.is_owned = false;
35676 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35677 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
35678 uint64_t ret_ref = 0;
35679 if ((uint64_t)ret_var.inner > 4096) {
35680 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35681 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35682 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35683 ret_ref = (uint64_t)ret_var.inner;
35684 if (ret_var.is_owned) {
35691 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_min_final_cltv_expiry(uint32_t this_arg) {
35692 LDKRawInvoice this_arg_conv;
35693 this_arg_conv.inner = (void*)(this_arg & (~1));
35694 this_arg_conv.is_owned = false;
35695 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35696 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
35697 uint64_t ret_ref = 0;
35698 if ((uint64_t)ret_var.inner > 4096) {
35699 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35700 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35701 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35702 ret_ref = (uint64_t)ret_var.inner;
35703 if (ret_var.is_owned) {
35710 int8_tArray __attribute__((visibility("default"))) TS_RawInvoice_payment_secret(uint32_t this_arg) {
35711 LDKRawInvoice this_arg_conv;
35712 this_arg_conv.inner = (void*)(this_arg & (~1));
35713 this_arg_conv.is_owned = false;
35714 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35715 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
35716 memcpy((uint8_t*)(ret_arr + 4), RawInvoice_payment_secret(&this_arg_conv).data, 32);
35720 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_features(uint32_t this_arg) {
35721 LDKRawInvoice this_arg_conv;
35722 this_arg_conv.inner = (void*)(this_arg & (~1));
35723 this_arg_conv.is_owned = false;
35724 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35725 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
35726 uint64_t ret_ref = 0;
35727 if ((uint64_t)ret_var.inner > 4096) {
35728 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35729 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35730 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35731 ret_ref = (uint64_t)ret_var.inner;
35732 if (ret_var.is_owned) {
35739 uint32_tArray __attribute__((visibility("default"))) TS_RawInvoice_private_routes(uint32_t this_arg) {
35740 LDKRawInvoice this_arg_conv;
35741 this_arg_conv.inner = (void*)(this_arg & (~1));
35742 this_arg_conv.is_owned = false;
35743 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35744 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
35745 uint32_tArray ret_arr = NULL;
35746 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
35747 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
35748 for (size_t o = 0; o < ret_var.datalen; o++) {
35749 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
35750 uint64_t ret_conv_14_ref = 0;
35751 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35752 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35753 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
35754 ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
35755 if (ret_conv_14_var.is_owned) {
35756 ret_conv_14_ref |= 1;
35758 ret_arr_ptr[o] = ret_conv_14_ref;
35761 FREE(ret_var.data);
35765 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_amount_pico_btc(uint32_t this_arg) {
35766 LDKRawInvoice this_arg_conv;
35767 this_arg_conv.inner = (void*)(this_arg & (~1));
35768 this_arg_conv.is_owned = false;
35769 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35770 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
35771 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
35772 uint64_t ret_ref = (uint64_t)ret_copy;
35776 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_currency(uint32_t this_arg) {
35777 LDKRawInvoice this_arg_conv;
35778 this_arg_conv.inner = (void*)(this_arg & (~1));
35779 this_arg_conv.is_owned = false;
35780 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35781 uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
35785 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
35786 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
35787 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
35788 return (uint64_t)ret_conv;
35791 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_from_system_time(int64_t time) {
35792 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
35793 *ret_conv = PositiveTimestamp_from_system_time(time);
35794 return (uint64_t)ret_conv;
35797 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_as_unix_timestamp(uint32_t this_arg) {
35798 LDKPositiveTimestamp this_arg_conv;
35799 this_arg_conv.inner = (void*)(this_arg & (~1));
35800 this_arg_conv.is_owned = false;
35801 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35802 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
35806 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_as_time(uint32_t this_arg) {
35807 LDKPositiveTimestamp this_arg_conv;
35808 this_arg_conv.inner = (void*)(this_arg & (~1));
35809 this_arg_conv.is_owned = false;
35810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35811 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
35815 uint32_t __attribute__((visibility("default"))) TS_Invoice_into_signed_raw(uint32_t this_arg) {
35816 LDKInvoice this_arg_conv;
35817 this_arg_conv.inner = (void*)(this_arg & (~1));
35818 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
35819 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35820 this_arg_conv = Invoice_clone(&this_arg_conv);
35821 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
35822 uint64_t ret_ref = 0;
35823 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35824 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35825 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35826 ret_ref = (uint64_t)ret_var.inner;
35827 if (ret_var.is_owned) {
35833 uint32_t __attribute__((visibility("default"))) TS_Invoice_check_signature(uint32_t this_arg) {
35834 LDKInvoice this_arg_conv;
35835 this_arg_conv.inner = (void*)(this_arg & (~1));
35836 this_arg_conv.is_owned = false;
35837 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35838 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
35839 *ret_conv = Invoice_check_signature(&this_arg_conv);
35840 return (uint64_t)ret_conv;
35843 uint32_t __attribute__((visibility("default"))) TS_Invoice_from_signed(uint32_t signed_invoice) {
35844 LDKSignedRawInvoice signed_invoice_conv;
35845 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
35846 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
35847 CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
35848 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
35849 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
35850 *ret_conv = Invoice_from_signed(signed_invoice_conv);
35851 return (uint64_t)ret_conv;
35854 int64_t __attribute__((visibility("default"))) TS_Invoice_timestamp(uint32_t this_arg) {
35855 LDKInvoice this_arg_conv;
35856 this_arg_conv.inner = (void*)(this_arg & (~1));
35857 this_arg_conv.is_owned = false;
35858 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35859 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
35863 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payment_hash(uint32_t this_arg) {
35864 LDKInvoice this_arg_conv;
35865 this_arg_conv.inner = (void*)(this_arg & (~1));
35866 this_arg_conv.is_owned = false;
35867 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35868 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
35869 memcpy((uint8_t*)(ret_arr + 4), *Invoice_payment_hash(&this_arg_conv), 32);
35873 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payee_pub_key(uint32_t this_arg) {
35874 LDKInvoice this_arg_conv;
35875 this_arg_conv.inner = (void*)(this_arg & (~1));
35876 this_arg_conv.is_owned = false;
35877 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35878 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
35879 memcpy((uint8_t*)(ret_arr + 4), Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
35883 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payment_secret(uint32_t this_arg) {
35884 LDKInvoice this_arg_conv;
35885 this_arg_conv.inner = (void*)(this_arg & (~1));
35886 this_arg_conv.is_owned = false;
35887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35888 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
35889 memcpy((uint8_t*)(ret_arr + 4), *Invoice_payment_secret(&this_arg_conv), 32);
35893 uint32_t __attribute__((visibility("default"))) TS_Invoice_features(uint32_t this_arg) {
35894 LDKInvoice this_arg_conv;
35895 this_arg_conv.inner = (void*)(this_arg & (~1));
35896 this_arg_conv.is_owned = false;
35897 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35898 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
35899 uint64_t ret_ref = 0;
35900 if ((uint64_t)ret_var.inner > 4096) {
35901 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35902 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35903 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35904 ret_ref = (uint64_t)ret_var.inner;
35905 if (ret_var.is_owned) {
35912 int8_tArray __attribute__((visibility("default"))) TS_Invoice_recover_payee_pub_key(uint32_t this_arg) {
35913 LDKInvoice this_arg_conv;
35914 this_arg_conv.inner = (void*)(this_arg & (~1));
35915 this_arg_conv.is_owned = false;
35916 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35917 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
35918 memcpy((uint8_t*)(ret_arr + 4), Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
35922 int64_t __attribute__((visibility("default"))) TS_Invoice_expiry_time(uint32_t this_arg) {
35923 LDKInvoice this_arg_conv;
35924 this_arg_conv.inner = (void*)(this_arg & (~1));
35925 this_arg_conv.is_owned = false;
35926 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35927 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
35931 jboolean __attribute__((visibility("default"))) TS_Invoice_is_expired(uint32_t this_arg) {
35932 LDKInvoice this_arg_conv;
35933 this_arg_conv.inner = (void*)(this_arg & (~1));
35934 this_arg_conv.is_owned = false;
35935 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35936 jboolean ret_val = Invoice_is_expired(&this_arg_conv);
35940 int64_t __attribute__((visibility("default"))) TS_Invoice_min_final_cltv_expiry(uint32_t this_arg) {
35941 LDKInvoice this_arg_conv;
35942 this_arg_conv.inner = (void*)(this_arg & (~1));
35943 this_arg_conv.is_owned = false;
35944 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35945 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
35949 uint32_tArray __attribute__((visibility("default"))) TS_Invoice_private_routes(uint32_t this_arg) {
35950 LDKInvoice this_arg_conv;
35951 this_arg_conv.inner = (void*)(this_arg & (~1));
35952 this_arg_conv.is_owned = false;
35953 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35954 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
35955 uint32_tArray ret_arr = NULL;
35956 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
35957 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
35958 for (size_t o = 0; o < ret_var.datalen; o++) {
35959 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
35960 uint64_t ret_conv_14_ref = 0;
35961 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35962 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35963 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
35964 ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
35965 if (ret_conv_14_var.is_owned) {
35966 ret_conv_14_ref |= 1;
35968 ret_arr_ptr[o] = ret_conv_14_ref;
35971 FREE(ret_var.data);
35975 uint32_tArray __attribute__((visibility("default"))) TS_Invoice_route_hints(uint32_t this_arg) {
35976 LDKInvoice this_arg_conv;
35977 this_arg_conv.inner = (void*)(this_arg & (~1));
35978 this_arg_conv.is_owned = false;
35979 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35980 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
35981 uint32_tArray ret_arr = NULL;
35982 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
35983 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
35984 for (size_t l = 0; l < ret_var.datalen; l++) {
35985 LDKRouteHint ret_conv_11_var = ret_var.data[l];
35986 uint64_t ret_conv_11_ref = 0;
35987 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35988 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35989 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
35990 ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
35991 if (ret_conv_11_var.is_owned) {
35992 ret_conv_11_ref |= 1;
35994 ret_arr_ptr[l] = ret_conv_11_ref;
35997 FREE(ret_var.data);
36001 uint32_t __attribute__((visibility("default"))) TS_Invoice_currency(uint32_t this_arg) {
36002 LDKInvoice this_arg_conv;
36003 this_arg_conv.inner = (void*)(this_arg & (~1));
36004 this_arg_conv.is_owned = false;
36005 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36006 uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
36010 uint32_t __attribute__((visibility("default"))) TS_Invoice_amount_milli_satoshis(uint32_t this_arg) {
36011 LDKInvoice this_arg_conv;
36012 this_arg_conv.inner = (void*)(this_arg & (~1));
36013 this_arg_conv.is_owned = false;
36014 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36015 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
36016 *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
36017 uint64_t ret_ref = (uint64_t)ret_copy;
36021 uint32_t __attribute__((visibility("default"))) TS_Description_new(jstring description) {
36022 LDKStr description_conv = str_ref_to_owned_c(description);
36023 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
36024 *ret_conv = Description_new(description_conv);
36025 return (uint64_t)ret_conv;
36028 jstring __attribute__((visibility("default"))) TS_Description_into_inner(uint32_t this_arg) {
36029 LDKDescription this_arg_conv;
36030 this_arg_conv.inner = (void*)(this_arg & (~1));
36031 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
36032 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36033 this_arg_conv = Description_clone(&this_arg_conv);
36034 LDKStr ret_str = Description_into_inner(this_arg_conv);
36035 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36040 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
36041 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
36042 *ret_conv = ExpiryTime_from_seconds(seconds);
36043 return (uint64_t)ret_conv;
36046 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_from_duration(int64_t duration) {
36047 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
36048 *ret_conv = ExpiryTime_from_duration(duration);
36049 return (uint64_t)ret_conv;
36052 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_as_seconds(uint32_t this_arg) {
36053 LDKExpiryTime this_arg_conv;
36054 this_arg_conv.inner = (void*)(this_arg & (~1));
36055 this_arg_conv.is_owned = false;
36056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36057 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
36061 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_as_duration(uint32_t this_arg) {
36062 LDKExpiryTime this_arg_conv;
36063 this_arg_conv.inner = (void*)(this_arg & (~1));
36064 this_arg_conv.is_owned = false;
36065 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36066 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
36070 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_new(uint32_t hops) {
36071 LDKRouteHint hops_conv;
36072 hops_conv.inner = (void*)(hops & (~1));
36073 hops_conv.is_owned = (hops & 1) || (hops == 0);
36074 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
36075 hops_conv = RouteHint_clone(&hops_conv);
36076 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
36077 *ret_conv = PrivateRoute_new(hops_conv);
36078 return (uint64_t)ret_conv;
36081 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_into_inner(uint32_t this_arg) {
36082 LDKPrivateRoute this_arg_conv;
36083 this_arg_conv.inner = (void*)(this_arg & (~1));
36084 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
36085 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36086 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
36087 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
36088 uint64_t ret_ref = 0;
36089 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36090 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36091 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36092 ret_ref = (uint64_t)ret_var.inner;
36093 if (ret_var.is_owned) {
36099 uint32_t __attribute__((visibility("default"))) TS_CreationError_clone(uint32_t orig) {
36100 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
36101 uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
36105 uint32_t __attribute__((visibility("default"))) TS_CreationError_description_too_long() {
36106 uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
36110 uint32_t __attribute__((visibility("default"))) TS_CreationError_route_too_long() {
36111 uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
36115 uint32_t __attribute__((visibility("default"))) TS_CreationError_timestamp_out_of_bounds() {
36116 uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
36120 uint32_t __attribute__((visibility("default"))) TS_CreationError_expiry_time_out_of_bounds() {
36121 uint32_t ret_conv = LDKCreationError_to_js(CreationError_expiry_time_out_of_bounds());
36125 jboolean __attribute__((visibility("default"))) TS_CreationError_eq(uint32_t a, uint32_t b) {
36126 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
36127 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
36128 jboolean ret_val = CreationError_eq(a_conv, b_conv);
36132 jstring __attribute__((visibility("default"))) TS_CreationError_to_str(uint32_t o) {
36133 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
36134 LDKStr ret_str = CreationError_to_str(o_conv);
36135 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36140 uint32_t __attribute__((visibility("default"))) TS_SemanticError_clone(uint32_t orig) {
36141 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
36142 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
36146 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_payment_hash() {
36147 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
36151 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_hashes() {
36152 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
36156 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_description() {
36157 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
36161 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_descriptions() {
36162 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
36166 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_payment_secret() {
36167 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
36171 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_secrets() {
36172 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
36176 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_features() {
36177 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
36181 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_recovery_id() {
36182 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
36186 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_signature() {
36187 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
36191 uint32_t __attribute__((visibility("default"))) TS_SemanticError_imprecise_amount() {
36192 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
36196 jboolean __attribute__((visibility("default"))) TS_SemanticError_eq(uint32_t a, uint32_t b) {
36197 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
36198 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
36199 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
36203 jstring __attribute__((visibility("default"))) TS_SemanticError_to_str(uint32_t o) {
36204 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
36205 LDKStr ret_str = SemanticError_to_str(o_conv);
36206 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36211 void __attribute__((visibility("default"))) TS_SignOrCreationError_free(uint32_t this_ptr) {
36212 if ((this_ptr & 1) != 0) return;
36213 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
36214 CHECK_ACCESS(this_ptr_ptr);
36215 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
36216 FREE((void*)this_ptr);
36217 SignOrCreationError_free(this_ptr_conv);
36220 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
36221 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
36222 *ret_copy = SignOrCreationError_clone(arg);
36223 uint64_t ret_ref = (uint64_t)ret_copy;
36226 int64_t __attribute__((visibility("default"))) TS_SignOrCreationError_clone_ptr(uint32_t arg) {
36227 LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)arg;
36228 int64_t ret_val = SignOrCreationError_clone_ptr(arg_conv);
36232 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_clone(uint32_t orig) {
36233 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
36234 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
36235 *ret_copy = SignOrCreationError_clone(orig_conv);
36236 uint64_t ret_ref = (uint64_t)ret_copy;
36240 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_sign_error() {
36241 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
36242 *ret_copy = SignOrCreationError_sign_error();
36243 uint64_t ret_ref = (uint64_t)ret_copy;
36247 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_creation_error(uint32_t a) {
36248 LDKCreationError a_conv = LDKCreationError_from_js(a);
36249 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
36250 *ret_copy = SignOrCreationError_creation_error(a_conv);
36251 uint64_t ret_ref = (uint64_t)ret_copy;
36255 jboolean __attribute__((visibility("default"))) TS_SignOrCreationError_eq(uint32_t a, uint32_t b) {
36256 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
36257 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
36258 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
36262 jstring __attribute__((visibility("default"))) TS_SignOrCreationError_to_str(uint32_t o) {
36263 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
36264 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
36265 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36270 void __attribute__((visibility("default"))) TS_InvoicePayer_free(uint32_t this_obj) {
36271 LDKInvoicePayer this_obj_conv;
36272 this_obj_conv.inner = (void*)(this_obj & (~1));
36273 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36274 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36275 InvoicePayer_free(this_obj_conv);
36278 void __attribute__((visibility("default"))) TS_Payer_free(uint32_t this_ptr) {
36279 if ((this_ptr & 1) != 0) return;
36280 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
36281 CHECK_ACCESS(this_ptr_ptr);
36282 LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
36283 FREE((void*)this_ptr);
36284 Payer_free(this_ptr_conv);
36287 void __attribute__((visibility("default"))) TS_Router_free(uint32_t this_ptr) {
36288 if ((this_ptr & 1) != 0) return;
36289 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
36290 CHECK_ACCESS(this_ptr_ptr);
36291 LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
36292 FREE((void*)this_ptr);
36293 Router_free(this_ptr_conv);
36296 void __attribute__((visibility("default"))) TS_RetryAttempts_free(uint32_t this_obj) {
36297 LDKRetryAttempts this_obj_conv;
36298 this_obj_conv.inner = (void*)(this_obj & (~1));
36299 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36300 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36301 RetryAttempts_free(this_obj_conv);
36304 int64_t __attribute__((visibility("default"))) TS_RetryAttempts_get_a(uint32_t this_ptr) {
36305 LDKRetryAttempts this_ptr_conv;
36306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36307 this_ptr_conv.is_owned = false;
36308 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36309 int64_t ret_val = RetryAttempts_get_a(&this_ptr_conv);
36313 void __attribute__((visibility("default"))) TS_RetryAttempts_set_a(uint32_t this_ptr, int64_t val) {
36314 LDKRetryAttempts this_ptr_conv;
36315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36316 this_ptr_conv.is_owned = false;
36317 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36318 RetryAttempts_set_a(&this_ptr_conv, val);
36321 uint32_t __attribute__((visibility("default"))) TS_RetryAttempts_new(int64_t a_arg) {
36322 LDKRetryAttempts ret_var = RetryAttempts_new(a_arg);
36323 uint64_t ret_ref = 0;
36324 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36325 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36326 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36327 ret_ref = (uint64_t)ret_var.inner;
36328 if (ret_var.is_owned) {
36334 static inline uint64_t RetryAttempts_clone_ptr(LDKRetryAttempts *NONNULL_PTR arg) {
36335 LDKRetryAttempts ret_var = RetryAttempts_clone(arg);
36336 uint64_t ret_ref = 0;
36337 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36338 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36339 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36340 ret_ref = (uint64_t)ret_var.inner;
36341 if (ret_var.is_owned) {
36346 int64_t __attribute__((visibility("default"))) TS_RetryAttempts_clone_ptr(uint32_t arg) {
36347 LDKRetryAttempts arg_conv;
36348 arg_conv.inner = (void*)(arg & (~1));
36349 arg_conv.is_owned = false;
36350 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36351 int64_t ret_val = RetryAttempts_clone_ptr(&arg_conv);
36355 uint32_t __attribute__((visibility("default"))) TS_RetryAttempts_clone(uint32_t orig) {
36356 LDKRetryAttempts orig_conv;
36357 orig_conv.inner = (void*)(orig & (~1));
36358 orig_conv.is_owned = false;
36359 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36360 LDKRetryAttempts ret_var = RetryAttempts_clone(&orig_conv);
36361 uint64_t ret_ref = 0;
36362 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36363 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36364 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36365 ret_ref = (uint64_t)ret_var.inner;
36366 if (ret_var.is_owned) {
36372 jboolean __attribute__((visibility("default"))) TS_RetryAttempts_eq(uint32_t a, uint32_t b) {
36373 LDKRetryAttempts a_conv;
36374 a_conv.inner = (void*)(a & (~1));
36375 a_conv.is_owned = false;
36376 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36377 LDKRetryAttempts b_conv;
36378 b_conv.inner = (void*)(b & (~1));
36379 b_conv.is_owned = false;
36380 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36381 jboolean ret_val = RetryAttempts_eq(&a_conv, &b_conv);
36385 int64_t __attribute__((visibility("default"))) TS_RetryAttempts_hash(uint32_t o) {
36386 LDKRetryAttempts o_conv;
36387 o_conv.inner = (void*)(o & (~1));
36388 o_conv.is_owned = false;
36389 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36390 int64_t ret_val = RetryAttempts_hash(&o_conv);
36394 void __attribute__((visibility("default"))) TS_PaymentError_free(uint32_t this_ptr) {
36395 if ((this_ptr & 1) != 0) return;
36396 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
36397 CHECK_ACCESS(this_ptr_ptr);
36398 LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
36399 FREE((void*)this_ptr);
36400 PaymentError_free(this_ptr_conv);
36403 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
36404 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
36405 *ret_copy = PaymentError_clone(arg);
36406 uint64_t ret_ref = (uint64_t)ret_copy;
36409 int64_t __attribute__((visibility("default"))) TS_PaymentError_clone_ptr(uint32_t arg) {
36410 LDKPaymentError* arg_conv = (LDKPaymentError*)arg;
36411 int64_t ret_val = PaymentError_clone_ptr(arg_conv);
36415 uint32_t __attribute__((visibility("default"))) TS_PaymentError_clone(uint32_t orig) {
36416 LDKPaymentError* orig_conv = (LDKPaymentError*)orig;
36417 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
36418 *ret_copy = PaymentError_clone(orig_conv);
36419 uint64_t ret_ref = (uint64_t)ret_copy;
36423 uint32_t __attribute__((visibility("default"))) TS_PaymentError_invoice(jstring a) {
36424 LDKStr a_conv = str_ref_to_owned_c(a);
36425 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
36426 *ret_copy = PaymentError_invoice(a_conv);
36427 uint64_t ret_ref = (uint64_t)ret_copy;
36431 uint32_t __attribute__((visibility("default"))) TS_PaymentError_routing(uint32_t a) {
36432 LDKLightningError a_conv;
36433 a_conv.inner = (void*)(a & (~1));
36434 a_conv.is_owned = (a & 1) || (a == 0);
36435 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36436 a_conv = LightningError_clone(&a_conv);
36437 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
36438 *ret_copy = PaymentError_routing(a_conv);
36439 uint64_t ret_ref = (uint64_t)ret_copy;
36443 uint32_t __attribute__((visibility("default"))) TS_PaymentError_sending(uint32_t a) {
36444 void* a_ptr = (void*)(((uint64_t)a) & ~1);
36445 CHECK_ACCESS(a_ptr);
36446 LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
36447 a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)a) & ~1));
36448 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
36449 *ret_copy = PaymentError_sending(a_conv);
36450 uint64_t ret_ref = (uint64_t)ret_copy;
36454 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) {
36455 void* payer_ptr = (void*)(((uint64_t)payer) & ~1);
36456 CHECK_ACCESS(payer_ptr);
36457 LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
36458 void* router_ptr = (void*)(((uint64_t)router) & ~1);
36459 CHECK_ACCESS(router_ptr);
36460 LDKRouter router_conv = *(LDKRouter*)(router_ptr);
36461 LDKLockableScore scorer_conv;
36462 scorer_conv.inner = (void*)(scorer & (~1));
36463 scorer_conv.is_owned = false;
36464 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
36465 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
36466 CHECK_ACCESS(logger_ptr);
36467 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36468 void* event_handler_ptr = (void*)(((uint64_t)event_handler) & ~1);
36469 CHECK_ACCESS(event_handler_ptr);
36470 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
36471 LDKRetryAttempts retry_attempts_conv;
36472 retry_attempts_conv.inner = (void*)(retry_attempts & (~1));
36473 retry_attempts_conv.is_owned = (retry_attempts & 1) || (retry_attempts == 0);
36474 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_attempts_conv);
36475 retry_attempts_conv = RetryAttempts_clone(&retry_attempts_conv);
36476 LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, &scorer_conv, logger_conv, event_handler_conv, retry_attempts_conv);
36477 uint64_t ret_ref = 0;
36478 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36479 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36480 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36481 ret_ref = (uint64_t)ret_var.inner;
36482 if (ret_var.is_owned) {
36488 uint32_t __attribute__((visibility("default"))) TS_InvoicePayer_pay_invoice(uint32_t this_arg, uint32_t invoice) {
36489 LDKInvoicePayer this_arg_conv;
36490 this_arg_conv.inner = (void*)(this_arg & (~1));
36491 this_arg_conv.is_owned = false;
36492 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36493 LDKInvoice invoice_conv;
36494 invoice_conv.inner = (void*)(invoice & (~1));
36495 invoice_conv.is_owned = false;
36496 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
36497 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
36498 *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
36499 return (uint64_t)ret_conv;
36502 uint32_t __attribute__((visibility("default"))) TS_InvoicePayer_pay_zero_value_invoice(uint32_t this_arg, uint32_t invoice, int64_t amount_msats) {
36503 LDKInvoicePayer this_arg_conv;
36504 this_arg_conv.inner = (void*)(this_arg & (~1));
36505 this_arg_conv.is_owned = false;
36506 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36507 LDKInvoice invoice_conv;
36508 invoice_conv.inner = (void*)(invoice & (~1));
36509 invoice_conv.is_owned = false;
36510 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
36511 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
36512 *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
36513 return (uint64_t)ret_conv;
36516 void __attribute__((visibility("default"))) TS_InvoicePayer_remove_cached_payment(uint32_t this_arg, int8_tArray payment_hash) {
36517 LDKInvoicePayer this_arg_conv;
36518 this_arg_conv.inner = (void*)(this_arg & (~1));
36519 this_arg_conv.is_owned = false;
36520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36521 unsigned char payment_hash_arr[32];
36522 CHECK(*((uint32_t*)payment_hash) == 32);
36523 memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32);
36524 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
36525 InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
36528 uint32_t __attribute__((visibility("default"))) TS_InvoicePayer_as_EventHandler(uint32_t this_arg) {
36529 LDKInvoicePayer this_arg_conv;
36530 this_arg_conv.inner = (void*)(this_arg & (~1));
36531 this_arg_conv.is_owned = false;
36532 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36533 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
36534 *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
36535 return (uint64_t)ret_ret;
36538 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) {
36539 LDKChannelManager channelmanager_conv;
36540 channelmanager_conv.inner = (void*)(channelmanager & (~1));
36541 channelmanager_conv.is_owned = false;
36542 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
36543 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
36544 CHECK_ACCESS(keys_manager_ptr);
36545 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
36546 LDKCurrency network_conv = LDKCurrency_from_js(network);
36547 void* amt_msat_ptr = (void*)(((uint64_t)amt_msat) & ~1);
36548 CHECK_ACCESS(amt_msat_ptr);
36549 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
36550 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1));
36551 LDKStr description_conv = str_ref_to_owned_c(description);
36552 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
36553 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
36554 return (uint64_t)ret_conv;
36557 void __attribute__((visibility("default"))) TS_DefaultRouter_free(uint32_t this_obj) {
36558 LDKDefaultRouter this_obj_conv;
36559 this_obj_conv.inner = (void*)(this_obj & (~1));
36560 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36561 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36562 DefaultRouter_free(this_obj_conv);
36565 uint32_t __attribute__((visibility("default"))) TS_DefaultRouter_new(uint32_t network_graph, uint32_t logger) {
36566 LDKNetworkGraph network_graph_conv;
36567 network_graph_conv.inner = (void*)(network_graph & (~1));
36568 network_graph_conv.is_owned = false;
36569 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
36570 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
36571 CHECK_ACCESS(logger_ptr);
36572 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36573 LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv);
36574 uint64_t ret_ref = 0;
36575 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36576 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36577 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36578 ret_ref = (uint64_t)ret_var.inner;
36579 if (ret_var.is_owned) {
36585 uint32_t __attribute__((visibility("default"))) TS_DefaultRouter_as_Router(uint32_t this_arg) {
36586 LDKDefaultRouter this_arg_conv;
36587 this_arg_conv.inner = (void*)(this_arg & (~1));
36588 this_arg_conv.is_owned = false;
36589 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36590 LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
36591 *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
36592 return (uint64_t)ret_ret;
36595 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Payer(uint32_t this_arg) {
36596 LDKChannelManager this_arg_conv;
36597 this_arg_conv.inner = (void*)(this_arg & (~1));
36598 this_arg_conv.is_owned = false;
36599 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36600 LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
36601 *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
36602 return (uint64_t)ret_ret;
36605 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_from_str(jstring s) {
36606 LDKStr s_conv = str_ref_to_owned_c(s);
36607 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
36608 *ret_conv = SiPrefix_from_str(s_conv);
36609 return (uint64_t)ret_conv;
36612 uint32_t __attribute__((visibility("default"))) TS_Invoice_from_str(jstring s) {
36613 LDKStr s_conv = str_ref_to_owned_c(s);
36614 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
36615 *ret_conv = Invoice_from_str(s_conv);
36616 return (uint64_t)ret_conv;
36619 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_from_str(jstring s) {
36620 LDKStr s_conv = str_ref_to_owned_c(s);
36621 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
36622 *ret_conv = SignedRawInvoice_from_str(s_conv);
36623 return (uint64_t)ret_conv;
36626 jstring __attribute__((visibility("default"))) TS_Invoice_to_str(uint32_t o) {
36628 o_conv.inner = (void*)(o & (~1));
36629 o_conv.is_owned = false;
36630 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36631 LDKStr ret_str = Invoice_to_str(&o_conv);
36632 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36637 jstring __attribute__((visibility("default"))) TS_SignedRawInvoice_to_str(uint32_t o) {
36638 LDKSignedRawInvoice o_conv;
36639 o_conv.inner = (void*)(o & (~1));
36640 o_conv.is_owned = false;
36641 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36642 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
36643 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36648 jstring __attribute__((visibility("default"))) TS_Currency_to_str(uint32_t o) {
36649 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
36650 LDKStr ret_str = Currency_to_str(o_conv);
36651 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36656 jstring __attribute__((visibility("default"))) TS_SiPrefix_to_str(uint32_t o) {
36657 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
36658 LDKStr ret_str = SiPrefix_to_str(o_conv);
36659 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);