1 #define LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
2 #define CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free
7 // These should be provided...somehow...
8 void *memset(void *s, int c, size_t n);
9 void *memcpy(void *dest, const void *src, size_t n);
10 int memcmp(const void *s1, const void *s2, size_t n);
12 void __attribute__((noreturn)) abort(void);
13 static inline void assert(bool expression) {
14 if (!expression) { abort(); }
17 void *malloc(size_t size);
20 #define MALLOC(a, _) malloc(a)
21 #define FREE(p) if ((unsigned long)(p) > 4096) { free(p); }
22 #define DO_ASSERT(a) (void)(a)
24 #define CHECK_ACCESS(p)
25 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
27 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
28 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
29 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
30 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
32 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
34 typedef uint32_t int64_tArray;
35 typedef uint32_t int8_tArray;
36 typedef uint32_t uint32_tArray;
37 typedef uint32_t ptrArray;
38 typedef uint32_t jstring;
40 static inline uint32_t init_arr(size_t arr_len, size_t elem_size, const char *type_desc) {
41 uint32_t *elems = (uint32_t*)MALLOC(arr_len * elem_size + 4, type_desc);
43 return (uint32_t)elems;
46 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
47 char* err_buf = MALLOC(len + 4, "str conv buf");
48 *((uint32_t*)err_buf) = len;
49 memcpy(err_buf + 4, chars, len);
50 return (uint32_t) err_buf;
52 static inline LDKStr str_ref_to_owned_c(jstring str) {
53 uint32_t *str_len = (uint32_t*)str;
54 char* newchars = MALLOC(*str_len + 1, "String chars");
55 memcpy(newchars, (const char*)(str + 4), *str_len);
56 newchars[*str_len] = 0;
60 .chars_is_owned = true
65 typedef bool jboolean;
67 uint32_t __attribute__((visibility("default"))) TS_malloc(uint32_t size) {
68 return (uint32_t)MALLOC(size, "JS-Called malloc");
70 void __attribute__((visibility("default"))) TS_free(uint32_t ptr) {
73 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
74 static inline LDKAccessError LDKAccessError_from_js(int32_t ord) {
76 case 0: return LDKAccessError_UnknownChain;
77 case 1: return LDKAccessError_UnknownTx;
81 static inline int32_t LDKAccessError_to_js(LDKAccessError val) {
83 case LDKAccessError_UnknownChain: return 0;
84 case LDKAccessError_UnknownTx: return 1;
88 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_js(int32_t ord) {
90 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
91 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
95 static inline int32_t LDKChannelMonitorUpdateErr_to_js(LDKChannelMonitorUpdateErr val) {
97 case LDKChannelMonitorUpdateErr_TemporaryFailure: return 0;
98 case LDKChannelMonitorUpdateErr_PermanentFailure: return 1;
102 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
104 case 0: return LDKConfirmationTarget_Background;
105 case 1: return LDKConfirmationTarget_Normal;
106 case 2: return LDKConfirmationTarget_HighPriority;
110 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
112 case LDKConfirmationTarget_Background: return 0;
113 case LDKConfirmationTarget_Normal: return 1;
114 case LDKConfirmationTarget_HighPriority: return 2;
118 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
120 case 0: return LDKCreationError_DescriptionTooLong;
121 case 1: return LDKCreationError_RouteTooLong;
122 case 2: return LDKCreationError_TimestampOutOfBounds;
123 case 3: return LDKCreationError_ExpiryTimeOutOfBounds;
127 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
129 case LDKCreationError_DescriptionTooLong: return 0;
130 case LDKCreationError_RouteTooLong: return 1;
131 case LDKCreationError_TimestampOutOfBounds: return 2;
132 case LDKCreationError_ExpiryTimeOutOfBounds: return 3;
136 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
138 case 0: return LDKCurrency_Bitcoin;
139 case 1: return LDKCurrency_BitcoinTestnet;
140 case 2: return LDKCurrency_Regtest;
141 case 3: return LDKCurrency_Simnet;
142 case 4: return LDKCurrency_Signet;
146 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
148 case LDKCurrency_Bitcoin: return 0;
149 case LDKCurrency_BitcoinTestnet: return 1;
150 case LDKCurrency_Regtest: return 2;
151 case LDKCurrency_Simnet: return 3;
152 case LDKCurrency_Signet: return 4;
156 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
158 case 0: return LDKIOError_NotFound;
159 case 1: return LDKIOError_PermissionDenied;
160 case 2: return LDKIOError_ConnectionRefused;
161 case 3: return LDKIOError_ConnectionReset;
162 case 4: return LDKIOError_ConnectionAborted;
163 case 5: return LDKIOError_NotConnected;
164 case 6: return LDKIOError_AddrInUse;
165 case 7: return LDKIOError_AddrNotAvailable;
166 case 8: return LDKIOError_BrokenPipe;
167 case 9: return LDKIOError_AlreadyExists;
168 case 10: return LDKIOError_WouldBlock;
169 case 11: return LDKIOError_InvalidInput;
170 case 12: return LDKIOError_InvalidData;
171 case 13: return LDKIOError_TimedOut;
172 case 14: return LDKIOError_WriteZero;
173 case 15: return LDKIOError_Interrupted;
174 case 16: return LDKIOError_Other;
175 case 17: return LDKIOError_UnexpectedEof;
179 static inline int32_t LDKIOError_to_js(LDKIOError val) {
181 case LDKIOError_NotFound: return 0;
182 case LDKIOError_PermissionDenied: return 1;
183 case LDKIOError_ConnectionRefused: return 2;
184 case LDKIOError_ConnectionReset: return 3;
185 case LDKIOError_ConnectionAborted: return 4;
186 case LDKIOError_NotConnected: return 5;
187 case LDKIOError_AddrInUse: return 6;
188 case LDKIOError_AddrNotAvailable: return 7;
189 case LDKIOError_BrokenPipe: return 8;
190 case LDKIOError_AlreadyExists: return 9;
191 case LDKIOError_WouldBlock: return 10;
192 case LDKIOError_InvalidInput: return 11;
193 case LDKIOError_InvalidData: return 12;
194 case LDKIOError_TimedOut: return 13;
195 case LDKIOError_WriteZero: return 14;
196 case LDKIOError_Interrupted: return 15;
197 case LDKIOError_Other: return 16;
198 case LDKIOError_UnexpectedEof: return 17;
202 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
204 case 0: return LDKLevel_Trace;
205 case 1: return LDKLevel_Debug;
206 case 2: return LDKLevel_Info;
207 case 3: return LDKLevel_Warn;
208 case 4: return LDKLevel_Error;
212 static inline int32_t LDKLevel_to_js(LDKLevel val) {
214 case LDKLevel_Trace: return 0;
215 case LDKLevel_Debug: return 1;
216 case LDKLevel_Info: return 2;
217 case LDKLevel_Warn: return 3;
218 case LDKLevel_Error: return 4;
222 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
224 case 0: return LDKNetwork_Bitcoin;
225 case 1: return LDKNetwork_Testnet;
226 case 2: return LDKNetwork_Regtest;
227 case 3: return LDKNetwork_Signet;
231 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
233 case LDKNetwork_Bitcoin: return 0;
234 case LDKNetwork_Testnet: return 1;
235 case LDKNetwork_Regtest: return 2;
236 case LDKNetwork_Signet: return 3;
240 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
242 case 0: return LDKSecp256k1Error_IncorrectSignature;
243 case 1: return LDKSecp256k1Error_InvalidMessage;
244 case 2: return LDKSecp256k1Error_InvalidPublicKey;
245 case 3: return LDKSecp256k1Error_InvalidSignature;
246 case 4: return LDKSecp256k1Error_InvalidSecretKey;
247 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
248 case 6: return LDKSecp256k1Error_InvalidTweak;
249 case 7: return LDKSecp256k1Error_TweakCheckFailed;
250 case 8: return LDKSecp256k1Error_NotEnoughMemory;
254 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
256 case LDKSecp256k1Error_IncorrectSignature: return 0;
257 case LDKSecp256k1Error_InvalidMessage: return 1;
258 case LDKSecp256k1Error_InvalidPublicKey: return 2;
259 case LDKSecp256k1Error_InvalidSignature: return 3;
260 case LDKSecp256k1Error_InvalidSecretKey: return 4;
261 case LDKSecp256k1Error_InvalidRecoveryId: return 5;
262 case LDKSecp256k1Error_InvalidTweak: return 6;
263 case LDKSecp256k1Error_TweakCheckFailed: return 7;
264 case LDKSecp256k1Error_NotEnoughMemory: return 8;
268 static inline LDKSemanticError LDKSemanticError_from_js(int32_t ord) {
270 case 0: return LDKSemanticError_NoPaymentHash;
271 case 1: return LDKSemanticError_MultiplePaymentHashes;
272 case 2: return LDKSemanticError_NoDescription;
273 case 3: return LDKSemanticError_MultipleDescriptions;
274 case 4: return LDKSemanticError_NoPaymentSecret;
275 case 5: return LDKSemanticError_MultiplePaymentSecrets;
276 case 6: return LDKSemanticError_InvalidFeatures;
277 case 7: return LDKSemanticError_InvalidRecoveryId;
278 case 8: return LDKSemanticError_InvalidSignature;
279 case 9: return LDKSemanticError_ImpreciseAmount;
283 static inline int32_t LDKSemanticError_to_js(LDKSemanticError val) {
285 case LDKSemanticError_NoPaymentHash: return 0;
286 case LDKSemanticError_MultiplePaymentHashes: return 1;
287 case LDKSemanticError_NoDescription: return 2;
288 case LDKSemanticError_MultipleDescriptions: return 3;
289 case LDKSemanticError_NoPaymentSecret: return 4;
290 case LDKSemanticError_MultiplePaymentSecrets: return 5;
291 case LDKSemanticError_InvalidFeatures: return 6;
292 case LDKSemanticError_InvalidRecoveryId: return 7;
293 case LDKSemanticError_InvalidSignature: return 8;
294 case LDKSemanticError_ImpreciseAmount: return 9;
298 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
300 case 0: return LDKSiPrefix_Milli;
301 case 1: return LDKSiPrefix_Micro;
302 case 2: return LDKSiPrefix_Nano;
303 case 3: return LDKSiPrefix_Pico;
307 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
309 case LDKSiPrefix_Milli: return 0;
310 case LDKSiPrefix_Micro: return 1;
311 case LDKSiPrefix_Nano: return 2;
312 case LDKSiPrefix_Pico: return 3;
316 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
317 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
318 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
321 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) {
322 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
323 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
324 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
325 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
326 CVec_u8Z_free(ret_var);
330 uint64_t TxOut_get_value (struct LDKTxOut* thing) { return thing->value;}int64_t __attribute__((visibility("default"))) TS_TxOut_get_value(uint32_t thing) {
331 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
332 int64_t ret_val = TxOut_get_value(thing_conv);
336 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_ok(uint32_t arg) {
337 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
338 CHECK(val->result_ok);
339 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
340 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).bytes, 32);
343 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_err(uint32_t arg) {
344 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
345 CHECK(!val->result_ok);
346 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
349 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_ok(uint32_t arg) {
350 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
351 CHECK(val->result_ok);
352 int8_tArray res_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
353 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compressed_form, 33);
356 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_err(uint32_t arg) {
357 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
358 CHECK(!val->result_ok);
359 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
362 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_ok(uint32_t arg) {
363 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
364 CHECK(val->result_ok);
365 LDKTxCreationKeys res_var = (*val->contents.result);
366 uint64_t res_ref = 0;
367 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
368 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
369 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
370 res_ref = (uint64_t)res_var.inner & ~1;
373 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_err(uint32_t arg) {
374 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
375 CHECK(!val->result_ok);
376 LDKDecodeError err_var = (*val->contents.err);
377 uint64_t err_ref = 0;
378 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
379 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
380 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
381 err_ref = (uint64_t)err_var.inner & ~1;
384 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint32_t arg) {
385 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
386 CHECK(val->result_ok);
387 LDKChannelPublicKeys res_var = (*val->contents.result);
388 uint64_t res_ref = 0;
389 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
390 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
391 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
392 res_ref = (uint64_t)res_var.inner & ~1;
395 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_err(uint32_t arg) {
396 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
397 CHECK(!val->result_ok);
398 LDKDecodeError err_var = (*val->contents.err);
399 uint64_t err_ref = 0;
400 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
401 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
402 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
403 err_ref = (uint64_t)err_var.inner & ~1;
406 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_ok(uint32_t arg) {
407 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
408 CHECK(val->result_ok);
409 LDKTxCreationKeys res_var = (*val->contents.result);
410 uint64_t res_ref = 0;
411 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
412 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
413 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
414 res_ref = (uint64_t)res_var.inner & ~1;
417 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_err(uint32_t arg) {
418 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
419 CHECK(!val->result_ok);
420 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
423 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u32Z_ref_from_ptr(uint32_t ptr) {
424 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
426 case LDKCOption_u32Z_Some: {
427 return 0 /* LDKCOption_u32Z - Some */; (void) obj->some;
429 case LDKCOption_u32Z_None: {
430 return 0 /* LDKCOption_u32Z - None */;
435 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint32_t arg) {
436 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
437 CHECK(val->result_ok);
438 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
439 uint64_t res_ref = 0;
440 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
441 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
442 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
443 res_ref = (uint64_t)res_var.inner & ~1;
446 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint32_t arg) {
447 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
448 CHECK(!val->result_ok);
449 LDKDecodeError err_var = (*val->contents.err);
450 uint64_t err_ref = 0;
451 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
452 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
453 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
454 err_ref = (uint64_t)err_var.inner & ~1;
457 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
458 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
459 CHECK(val->result_ok);
460 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
461 uint64_t res_ref = 0;
462 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
463 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
464 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
465 res_ref = (uint64_t)res_var.inner & ~1;
468 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
469 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
470 CHECK(!val->result_ok);
471 LDKDecodeError err_var = (*val->contents.err);
472 uint64_t err_ref = 0;
473 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
474 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
475 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
476 err_ref = (uint64_t)err_var.inner & ~1;
479 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
480 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
481 CHECK(val->result_ok);
482 LDKChannelTransactionParameters res_var = (*val->contents.result);
483 uint64_t res_ref = 0;
484 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
485 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
486 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
487 res_ref = (uint64_t)res_var.inner & ~1;
490 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
491 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
492 CHECK(!val->result_ok);
493 LDKDecodeError err_var = (*val->contents.err);
494 uint64_t err_ref = 0;
495 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
496 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
497 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
498 err_ref = (uint64_t)err_var.inner & ~1;
501 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
502 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
503 CHECK(val->result_ok);
504 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
505 uint64_t res_ref = 0;
506 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
507 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
508 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
509 res_ref = (uint64_t)res_var.inner & ~1;
512 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
513 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
514 CHECK(!val->result_ok);
515 LDKDecodeError err_var = (*val->contents.err);
516 uint64_t err_ref = 0;
517 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
518 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
519 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
520 err_ref = (uint64_t)err_var.inner & ~1;
523 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
524 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
525 CHECK(val->result_ok);
526 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
527 uint64_t res_ref = 0;
528 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
529 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
530 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
531 res_ref = (uint64_t)res_var.inner & ~1;
534 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
535 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
536 CHECK(!val->result_ok);
537 LDKDecodeError err_var = (*val->contents.err);
538 uint64_t err_ref = 0;
539 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
540 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
541 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
542 err_ref = (uint64_t)err_var.inner & ~1;
545 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_get_ok(uint32_t arg) {
546 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
547 CHECK(val->result_ok);
548 LDKTrustedClosingTransaction res_var = (*val->contents.result);
549 uint64_t res_ref = 0;
550 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
551 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
552 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
553 res_ref = (uint64_t)res_var.inner & ~1;
556 void __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_get_err(uint32_t arg) {
557 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
558 CHECK(!val->result_ok);
559 return *val->contents.err;
561 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
562 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
563 CHECK(val->result_ok);
564 LDKCommitmentTransaction res_var = (*val->contents.result);
565 uint64_t res_ref = 0;
566 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
567 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
568 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
569 res_ref = (uint64_t)res_var.inner & ~1;
572 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
573 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
574 CHECK(!val->result_ok);
575 LDKDecodeError err_var = (*val->contents.err);
576 uint64_t err_ref = 0;
577 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
578 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
579 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
580 err_ref = (uint64_t)err_var.inner & ~1;
583 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_ok(uint32_t arg) {
584 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
585 CHECK(val->result_ok);
586 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
587 uint64_t res_ref = 0;
588 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
589 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
590 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
591 res_ref = (uint64_t)res_var.inner & ~1;
594 void __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_err(uint32_t arg) {
595 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
596 CHECK(!val->result_ok);
597 return *val->contents.err;
599 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_ok(uint32_t arg) {
600 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
601 CHECK(val->result_ok);
602 LDKCVec_SignatureZ res_var = (*val->contents.result);
603 ptrArray res_arr = NULL;
604 res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
605 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
606 for (size_t m = 0; m < res_var.datalen; m++) {
607 int8_tArray res_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
608 memcpy((uint8_t*)(res_conv_12_arr + 4), res_var.data[m].compact_form, 64);
609 res_arr_ptr[m] = res_conv_12_arr;
614 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_err(uint32_t arg) {
615 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
616 CHECK(!val->result_ok);
617 return *val->contents.err;
619 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_get_ok(uint32_t arg) {
620 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
621 CHECK(val->result_ok);
622 LDKShutdownScript res_var = (*val->contents.result);
623 uint64_t res_ref = 0;
624 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
625 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
626 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
627 res_ref = (uint64_t)res_var.inner & ~1;
630 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_get_err(uint32_t arg) {
631 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
632 CHECK(!val->result_ok);
633 LDKDecodeError err_var = (*val->contents.err);
634 uint64_t err_ref = 0;
635 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
636 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
637 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
638 err_ref = (uint64_t)err_var.inner & ~1;
641 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint32_t arg) {
642 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
643 CHECK(val->result_ok);
644 LDKShutdownScript res_var = (*val->contents.result);
645 uint64_t res_ref = 0;
646 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
647 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
648 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
649 res_ref = (uint64_t)res_var.inner & ~1;
652 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint32_t arg) {
653 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
654 CHECK(!val->result_ok);
655 LDKInvalidShutdownScript err_var = (*val->contents.err);
656 uint64_t err_ref = 0;
657 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
658 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
659 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
660 err_ref = (uint64_t)err_var.inner & ~1;
663 void __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_ok(uint32_t arg) {
664 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
665 CHECK(val->result_ok);
666 return *val->contents.result;
668 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_err(uint32_t arg) {
669 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
670 CHECK(!val->result_ok);
671 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
674 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_get_ok(uint32_t arg) {
675 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
676 CHECK(val->result_ok);
677 LDKRouteHop res_var = (*val->contents.result);
678 uint64_t res_ref = 0;
679 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
680 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
681 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
682 res_ref = (uint64_t)res_var.inner & ~1;
685 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_get_err(uint32_t arg) {
686 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
687 CHECK(!val->result_ok);
688 LDKDecodeError err_var = (*val->contents.err);
689 uint64_t err_ref = 0;
690 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
691 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
692 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
693 err_ref = (uint64_t)err_var.inner & ~1;
696 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
697 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
698 for (size_t i = 0; i < ret.datalen; i++) {
699 ret.data[i] = RouteHop_clone(&orig->data[i]);
703 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
704 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
705 for (size_t i = 0; i < ret.datalen; i++) {
706 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
710 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_ok(uint32_t arg) {
711 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
712 CHECK(val->result_ok);
713 LDKRoute res_var = (*val->contents.result);
714 uint64_t res_ref = 0;
715 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
716 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
717 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
718 res_ref = (uint64_t)res_var.inner & ~1;
721 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_err(uint32_t arg) {
722 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
723 CHECK(!val->result_ok);
724 LDKDecodeError err_var = (*val->contents.err);
725 uint64_t err_ref = 0;
726 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
727 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
728 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
729 err_ref = (uint64_t)err_var.inner & ~1;
732 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteParametersDecodeErrorZ_get_ok(uint32_t arg) {
733 LDKCResult_RouteParametersDecodeErrorZ *val = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
734 CHECK(val->result_ok);
735 LDKRouteParameters res_var = (*val->contents.result);
736 uint64_t res_ref = 0;
737 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
738 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
739 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
740 res_ref = (uint64_t)res_var.inner & ~1;
743 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteParametersDecodeErrorZ_get_err(uint32_t arg) {
744 LDKCResult_RouteParametersDecodeErrorZ *val = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
745 CHECK(!val->result_ok);
746 LDKDecodeError err_var = (*val->contents.err);
747 uint64_t err_ref = 0;
748 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
749 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
750 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
751 err_ref = (uint64_t)err_var.inner & ~1;
754 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
755 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
756 for (size_t i = 0; i < ret.datalen; i++) {
757 ret.data[i] = RouteHint_clone(&orig->data[i]);
761 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u64Z_ref_from_ptr(uint32_t ptr) {
762 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
764 case LDKCOption_u64Z_Some: {
765 return 0 /* LDKCOption_u64Z - Some */; (void) obj->some;
767 case LDKCOption_u64Z_None: {
768 return 0 /* LDKCOption_u64Z - None */;
773 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeeDecodeErrorZ_get_ok(uint32_t arg) {
774 LDKCResult_PayeeDecodeErrorZ *val = (LDKCResult_PayeeDecodeErrorZ*)(arg & ~1);
775 CHECK(val->result_ok);
776 LDKPayee res_var = (*val->contents.result);
777 uint64_t res_ref = 0;
778 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
779 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
780 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
781 res_ref = (uint64_t)res_var.inner & ~1;
784 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeeDecodeErrorZ_get_err(uint32_t arg) {
785 LDKCResult_PayeeDecodeErrorZ *val = (LDKCResult_PayeeDecodeErrorZ*)(arg & ~1);
786 CHECK(!val->result_ok);
787 LDKDecodeError err_var = (*val->contents.err);
788 uint64_t err_ref = 0;
789 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
790 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
791 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
792 err_ref = (uint64_t)err_var.inner & ~1;
795 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
796 LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
797 for (size_t i = 0; i < ret.datalen; i++) {
798 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
802 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHintDecodeErrorZ_get_ok(uint32_t arg) {
803 LDKCResult_RouteHintDecodeErrorZ *val = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
804 CHECK(val->result_ok);
805 LDKRouteHint res_var = (*val->contents.result);
806 uint64_t res_ref = 0;
807 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
808 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
809 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
810 res_ref = (uint64_t)res_var.inner & ~1;
813 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHintDecodeErrorZ_get_err(uint32_t arg) {
814 LDKCResult_RouteHintDecodeErrorZ *val = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
815 CHECK(!val->result_ok);
816 LDKDecodeError err_var = (*val->contents.err);
817 uint64_t err_ref = 0;
818 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
819 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
820 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
821 err_ref = (uint64_t)err_var.inner & ~1;
824 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHintHopDecodeErrorZ_get_ok(uint32_t arg) {
825 LDKCResult_RouteHintHopDecodeErrorZ *val = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
826 CHECK(val->result_ok);
827 LDKRouteHintHop res_var = (*val->contents.result);
828 uint64_t res_ref = 0;
829 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
830 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
831 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
832 res_ref = (uint64_t)res_var.inner & ~1;
835 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHintHopDecodeErrorZ_get_err(uint32_t arg) {
836 LDKCResult_RouteHintHopDecodeErrorZ *val = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
837 CHECK(!val->result_ok);
838 LDKDecodeError err_var = (*val->contents.err);
839 uint64_t err_ref = 0;
840 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
841 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
842 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
843 err_ref = (uint64_t)err_var.inner & ~1;
846 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
847 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
848 for (size_t i = 0; i < ret.datalen; i++) {
849 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
853 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_ok(uint32_t arg) {
854 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
855 CHECK(val->result_ok);
856 LDKRoute res_var = (*val->contents.result);
857 uint64_t res_ref = 0;
858 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
859 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
860 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
861 res_ref = (uint64_t)res_var.inner & ~1;
864 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_err(uint32_t arg) {
865 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
866 CHECK(!val->result_ok);
867 LDKLightningError err_var = (*val->contents.err);
868 uint64_t err_ref = 0;
869 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
870 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
871 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
872 err_ref = (uint64_t)err_var.inner & ~1;
875 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_ok(uint32_t arg) {
876 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
877 CHECK(val->result_ok);
878 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
879 return (uint64_t)res_ref;
881 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_err(uint32_t arg) {
882 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
883 CHECK(!val->result_ok);
884 uint32_t err_conv = LDKAccessError_to_js((*val->contents.err));
887 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR tuple){
890 int64_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_get_a(uint32_t tuple) {
891 LDKC2Tuple_usizeTransactionZ* tuple_conv = (LDKC2Tuple_usizeTransactionZ*)(tuple & ~1);
892 int64_t ret_val = C2Tuple_usizeTransactionZ_get_a(tuple_conv);
896 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR tuple){
899 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_get_b(uint32_t tuple) {
900 LDKC2Tuple_usizeTransactionZ* tuple_conv = (LDKC2Tuple_usizeTransactionZ*)(tuple & ~1);
901 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(tuple_conv);
902 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
903 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
904 Transaction_free(ret_var);
908 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
909 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
910 for (size_t i = 0; i < ret.datalen; i++) {
911 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
915 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
916 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
917 for (size_t i = 0; i < ret.datalen; i++) {
918 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
922 void __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t arg) {
923 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
924 CHECK(val->result_ok);
925 return *val->contents.result;
927 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t arg) {
928 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
929 CHECK(!val->result_ok);
930 uint32_t err_conv = LDKChannelMonitorUpdateErr_to_js((*val->contents.err));
933 uint32_t __attribute__((visibility("default"))) TS_LDKMonitorEvent_ref_from_ptr(uint32_t ptr) {
934 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
936 case LDKMonitorEvent_HTLCEvent: {
937 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
938 uint64_t htlc_event_ref = 0;
939 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
940 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
941 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
942 htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
943 return 0 /* LDKMonitorEvent - HTLCEvent */; (void) htlc_event_ref;
945 case LDKMonitorEvent_CommitmentTxConfirmed: {
946 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
947 uint64_t commitment_tx_confirmed_ref = 0;
948 CHECK((((uint64_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
949 CHECK((((uint64_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
950 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
951 commitment_tx_confirmed_ref = (uint64_t)commitment_tx_confirmed_var.inner & ~1;
952 return 0 /* LDKMonitorEvent - CommitmentTxConfirmed */; (void) commitment_tx_confirmed_ref;
954 case LDKMonitorEvent_UpdateCompleted: {
955 LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
956 uint64_t funding_txo_ref = 0;
957 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
958 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
959 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
960 funding_txo_ref = (uint64_t)funding_txo_var.inner & ~1;
961 return 0 /* LDKMonitorEvent - UpdateCompleted */; (void) funding_txo_ref; (void) obj->update_completed.monitor_update_id;
963 case LDKMonitorEvent_UpdateFailed: {
964 LDKOutPoint update_failed_var = obj->update_failed;
965 uint64_t update_failed_ref = 0;
966 CHECK((((uint64_t)update_failed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
967 CHECK((((uint64_t)&update_failed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
968 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
969 update_failed_ref = (uint64_t)update_failed_var.inner & ~1;
970 return 0 /* LDKMonitorEvent - UpdateFailed */; (void) update_failed_ref;
975 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
976 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
977 for (size_t i = 0; i < ret.datalen; i++) {
978 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
982 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_ref_from_ptr(uint32_t ptr) {
983 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
985 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
986 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
987 *some_conv = obj->some;
988 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
989 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - Some */; (void) ((uint64_t)some_conv);
991 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
992 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - None */;
997 uint32_t __attribute__((visibility("default"))) TS_LDKClosureReason_ref_from_ptr(uint32_t ptr) {
998 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
1000 case LDKClosureReason_CounterpartyForceClosed: {
1001 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
1002 jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
1003 return 0 /* LDKClosureReason - CounterpartyForceClosed */; (void) peer_msg_conv;
1005 case LDKClosureReason_HolderForceClosed: {
1006 return 0 /* LDKClosureReason - HolderForceClosed */;
1008 case LDKClosureReason_CooperativeClosure: {
1009 return 0 /* LDKClosureReason - CooperativeClosure */;
1011 case LDKClosureReason_CommitmentTxConfirmed: {
1012 return 0 /* LDKClosureReason - CommitmentTxConfirmed */;
1014 case LDKClosureReason_ProcessingError: {
1015 LDKStr err_str = obj->processing_error.err;
1016 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
1017 return 0 /* LDKClosureReason - ProcessingError */; (void) err_conv;
1019 case LDKClosureReason_DisconnectedPeer: {
1020 return 0 /* LDKClosureReason - DisconnectedPeer */;
1022 case LDKClosureReason_OutdatedChannelManager: {
1023 return 0 /* LDKClosureReason - OutdatedChannelManager */;
1028 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_ClosureReasonZ_ref_from_ptr(uint32_t ptr) {
1029 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
1031 case LDKCOption_ClosureReasonZ_Some: {
1032 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1033 return 0 /* LDKCOption_ClosureReasonZ - Some */; (void) some_ref;
1035 case LDKCOption_ClosureReasonZ_None: {
1036 return 0 /* LDKCOption_ClosureReasonZ - None */;
1041 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint32_t arg) {
1042 LDKCResult_COption_ClosureReasonZDecodeErrorZ *val = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
1043 CHECK(val->result_ok);
1044 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1047 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint32_t arg) {
1048 LDKCResult_COption_ClosureReasonZDecodeErrorZ *val = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
1049 CHECK(!val->result_ok);
1050 LDKDecodeError err_var = (*val->contents.err);
1051 uint64_t err_ref = 0;
1052 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1053 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1054 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1055 err_ref = (uint64_t)err_var.inner & ~1;
1058 uint32_t __attribute__((visibility("default"))) TS_LDKNetworkUpdate_ref_from_ptr(uint32_t ptr) {
1059 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1061 case LDKNetworkUpdate_ChannelUpdateMessage: {
1062 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1063 uint64_t msg_ref = 0;
1064 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1065 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1066 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1067 msg_ref = (uint64_t)msg_var.inner & ~1;
1068 return 0 /* LDKNetworkUpdate - ChannelUpdateMessage */; (void) msg_ref;
1070 case LDKNetworkUpdate_ChannelClosed: {
1071 return 0 /* LDKNetworkUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
1073 case LDKNetworkUpdate_NodeFailure: {
1074 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1075 memcpy((uint8_t*)(node_id_arr + 4), obj->node_failure.node_id.compressed_form, 33);
1076 return 0 /* LDKNetworkUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
1081 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_NetworkUpdateZ_ref_from_ptr(uint32_t ptr) {
1082 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1084 case LDKCOption_NetworkUpdateZ_Some: {
1085 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1086 return 0 /* LDKCOption_NetworkUpdateZ - Some */; (void) some_ref;
1088 case LDKCOption_NetworkUpdateZ_None: {
1089 return 0 /* LDKCOption_NetworkUpdateZ - None */;
1094 uint32_t __attribute__((visibility("default"))) TS_LDKSpendableOutputDescriptor_ref_from_ptr(uint32_t ptr) {
1095 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1097 case LDKSpendableOutputDescriptor_StaticOutput: {
1098 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1099 uint64_t outpoint_ref = 0;
1100 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1101 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1102 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1103 outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1104 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1105 return 0 /* LDKSpendableOutputDescriptor - StaticOutput */; (void) outpoint_ref; (void) (uint64_t)output_ref;
1107 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1108 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1109 uint64_t delayed_payment_output_ref = 0;
1110 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1111 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1112 CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1113 delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1114 return 0 /* LDKSpendableOutputDescriptor - DelayedPaymentOutput */; (void) delayed_payment_output_ref;
1116 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1117 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1118 uint64_t static_payment_output_ref = 0;
1119 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1120 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1121 CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1122 static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1123 return 0 /* LDKSpendableOutputDescriptor - StaticPaymentOutput */; (void) static_payment_output_ref;
1128 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1129 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1130 for (size_t i = 0; i < ret.datalen; i++) {
1131 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1135 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentPurpose_ref_from_ptr(uint32_t ptr) {
1136 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1138 case LDKPaymentPurpose_InvoicePayment: {
1139 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1140 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->invoice_payment.payment_preimage.data, 32);
1141 int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1142 memcpy((uint8_t*)(payment_secret_arr + 4), obj->invoice_payment.payment_secret.data, 32);
1143 return 0 /* LDKPaymentPurpose - InvoicePayment */; (void) payment_preimage_arr; (void) payment_secret_arr; (void) obj->invoice_payment.user_payment_id;
1145 case LDKPaymentPurpose_SpontaneousPayment: {
1146 int8_tArray spontaneous_payment_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1147 memcpy((uint8_t*)(spontaneous_payment_arr + 4), obj->spontaneous_payment.data, 32);
1148 return 0 /* LDKPaymentPurpose - SpontaneousPayment */; (void) spontaneous_payment_arr;
1153 uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_t ptr) {
1154 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1156 case LDKEvent_FundingGenerationReady: {
1157 int8_tArray temporary_channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1158 memcpy((uint8_t*)(temporary_channel_id_arr + 4), obj->funding_generation_ready.temporary_channel_id.data, 32);
1159 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1160 int8_tArray output_script_arr = init_arr(output_script_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1161 memcpy((uint8_t*)(output_script_arr + 4), output_script_var.data, output_script_var.datalen);
1162 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;
1164 case LDKEvent_PaymentReceived: {
1165 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1166 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_received.payment_hash.data, 32);
1167 uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
1168 return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) obj->payment_received.amt; (void) purpose_ref;
1170 case LDKEvent_PaymentSent: {
1171 int8_tArray payment_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1172 memcpy((uint8_t*)(payment_id_arr + 4), obj->payment_sent.payment_id.data, 32);
1173 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1174 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_sent.payment_preimage.data, 32);
1175 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1176 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_sent.payment_hash.data, 32);
1177 uint64_t fee_paid_msat_ref = ((uint64_t)&obj->payment_sent.fee_paid_msat) | 1;
1178 return 0 /* LDKEvent - PaymentSent */; (void) payment_id_arr; (void) payment_preimage_arr; (void) payment_hash_arr; (void) fee_paid_msat_ref;
1180 case LDKEvent_PaymentPathFailed: {
1181 int8_tArray payment_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1182 memcpy((uint8_t*)(payment_id_arr + 4), obj->payment_path_failed.payment_id.data, 32);
1183 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1184 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_path_failed.payment_hash.data, 32);
1185 uint64_t network_update_ref = ((uint64_t)&obj->payment_path_failed.network_update) | 1;
1186 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
1187 uint32_tArray path_arr = NULL;
1188 path_arr = init_arr(path_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
1189 uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4);
1190 for (size_t k = 0; k < path_var.datalen; k++) {
1191 LDKRouteHop path_conv_10_var = path_var.data[k];
1192 uint64_t path_conv_10_ref = 0;
1193 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1194 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1195 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1196 path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
1197 path_arr_ptr[k] = path_conv_10_ref;
1200 uint64_t short_channel_id_ref = ((uint64_t)&obj->payment_path_failed.short_channel_id) | 1;
1201 LDKRouteParameters retry_var = obj->payment_path_failed.retry;
1202 uint64_t retry_ref = 0;
1203 if ((uint64_t)retry_var.inner > 4096) {
1204 CHECK((((uint64_t)retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1205 CHECK((((uint64_t)&retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1206 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
1207 retry_ref = (uint64_t)retry_var.inner & ~1;
1209 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;
1211 case LDKEvent_PendingHTLCsForwardable: {
1212 return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable;
1214 case LDKEvent_SpendableOutputs: {
1215 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1216 uint32_tArray outputs_arr = NULL;
1217 outputs_arr = init_arr(outputs_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
1218 uint32_t *outputs_arr_ptr = (uint32_t*)(outputs_arr + 4);
1219 for (size_t b = 0; b < outputs_var.datalen; b++) {
1220 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
1221 outputs_arr_ptr[b] = outputs_conv_27_ref;
1224 return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr;
1226 case LDKEvent_PaymentForwarded: {
1227 uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
1228 return 0 /* LDKEvent - PaymentForwarded */; (void) fee_earned_msat_ref; (void) obj->payment_forwarded.claim_from_onchain_tx;
1230 case LDKEvent_ChannelClosed: {
1231 int8_tArray channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1232 memcpy((uint8_t*)(channel_id_arr + 4), obj->channel_closed.channel_id.data, 32);
1233 uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1;
1234 return 0 /* LDKEvent - ChannelClosed */; (void) channel_id_arr; (void) obj->channel_closed.user_channel_id; (void) reason_ref;
1236 case LDKEvent_DiscardFunding: {
1237 int8_tArray channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1238 memcpy((uint8_t*)(channel_id_arr + 4), obj->discard_funding.channel_id.data, 32);
1239 LDKTransaction transaction_var = obj->discard_funding.transaction;
1240 int8_tArray transaction_arr = init_arr(transaction_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1241 memcpy((uint8_t*)(transaction_arr + 4), transaction_var.data, transaction_var.datalen);
1242 return 0 /* LDKEvent - DiscardFunding */; (void) channel_id_arr; (void) transaction_arr;
1247 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_EventZ_ref_from_ptr(uint32_t ptr) {
1248 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
1250 case LDKCOption_EventZ_Some: {
1251 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1252 return 0 /* LDKCOption_EventZ - Some */; (void) some_ref;
1254 case LDKCOption_EventZ_None: {
1255 return 0 /* LDKCOption_EventZ - None */;
1260 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_EventZDecodeErrorZ_get_ok(uint32_t arg) {
1261 LDKCResult_COption_EventZDecodeErrorZ *val = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
1262 CHECK(val->result_ok);
1263 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1266 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_EventZDecodeErrorZ_get_err(uint32_t arg) {
1267 LDKCResult_COption_EventZDecodeErrorZ *val = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
1268 CHECK(!val->result_ok);
1269 LDKDecodeError err_var = (*val->contents.err);
1270 uint64_t err_ref = 0;
1271 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1272 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1273 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1274 err_ref = (uint64_t)err_var.inner & ~1;
1277 uint32_t __attribute__((visibility("default"))) TS_LDKErrorAction_ref_from_ptr(uint32_t ptr) {
1278 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1280 case LDKErrorAction_DisconnectPeer: {
1281 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1282 uint64_t msg_ref = 0;
1283 if ((uint64_t)msg_var.inner > 4096) {
1284 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1285 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1286 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1287 msg_ref = (uint64_t)msg_var.inner & ~1;
1289 return 0 /* LDKErrorAction - DisconnectPeer */; (void) msg_ref;
1291 case LDKErrorAction_IgnoreError: {
1292 return 0 /* LDKErrorAction - IgnoreError */;
1294 case LDKErrorAction_IgnoreAndLog: {
1295 uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
1296 return 0 /* LDKErrorAction - IgnoreAndLog */; (void) ignore_and_log_conv;
1298 case LDKErrorAction_SendErrorMessage: {
1299 LDKErrorMessage msg_var = obj->send_error_message.msg;
1300 uint64_t msg_ref = 0;
1301 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1302 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1303 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1304 msg_ref = (uint64_t)msg_var.inner & ~1;
1305 return 0 /* LDKErrorAction - SendErrorMessage */; (void) msg_ref;
1310 uint32_t __attribute__((visibility("default"))) TS_LDKMessageSendEvent_ref_from_ptr(uint32_t ptr) {
1311 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1313 case LDKMessageSendEvent_SendAcceptChannel: {
1314 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1315 memcpy((uint8_t*)(node_id_arr + 4), obj->send_accept_channel.node_id.compressed_form, 33);
1316 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1317 uint64_t msg_ref = 0;
1318 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1319 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1320 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1321 msg_ref = (uint64_t)msg_var.inner & ~1;
1322 return 0 /* LDKMessageSendEvent - SendAcceptChannel */; (void) node_id_arr; (void) msg_ref;
1324 case LDKMessageSendEvent_SendOpenChannel: {
1325 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1326 memcpy((uint8_t*)(node_id_arr + 4), obj->send_open_channel.node_id.compressed_form, 33);
1327 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1328 uint64_t msg_ref = 0;
1329 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1330 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1331 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1332 msg_ref = (uint64_t)msg_var.inner & ~1;
1333 return 0 /* LDKMessageSendEvent - SendOpenChannel */; (void) node_id_arr; (void) msg_ref;
1335 case LDKMessageSendEvent_SendFundingCreated: {
1336 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1337 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_created.node_id.compressed_form, 33);
1338 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1339 uint64_t msg_ref = 0;
1340 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1341 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1342 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1343 msg_ref = (uint64_t)msg_var.inner & ~1;
1344 return 0 /* LDKMessageSendEvent - SendFundingCreated */; (void) node_id_arr; (void) msg_ref;
1346 case LDKMessageSendEvent_SendFundingSigned: {
1347 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1348 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_signed.node_id.compressed_form, 33);
1349 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1350 uint64_t msg_ref = 0;
1351 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1352 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1353 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1354 msg_ref = (uint64_t)msg_var.inner & ~1;
1355 return 0 /* LDKMessageSendEvent - SendFundingSigned */; (void) node_id_arr; (void) msg_ref;
1357 case LDKMessageSendEvent_SendFundingLocked: {
1358 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1359 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_locked.node_id.compressed_form, 33);
1360 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1361 uint64_t msg_ref = 0;
1362 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1363 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1364 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1365 msg_ref = (uint64_t)msg_var.inner & ~1;
1366 return 0 /* LDKMessageSendEvent - SendFundingLocked */; (void) node_id_arr; (void) msg_ref;
1368 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1369 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1370 memcpy((uint8_t*)(node_id_arr + 4), obj->send_announcement_signatures.node_id.compressed_form, 33);
1371 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1372 uint64_t msg_ref = 0;
1373 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1374 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1375 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1376 msg_ref = (uint64_t)msg_var.inner & ~1;
1377 return 0 /* LDKMessageSendEvent - SendAnnouncementSignatures */; (void) node_id_arr; (void) msg_ref;
1379 case LDKMessageSendEvent_UpdateHTLCs: {
1380 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1381 memcpy((uint8_t*)(node_id_arr + 4), obj->update_htl_cs.node_id.compressed_form, 33);
1382 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1383 uint64_t updates_ref = 0;
1384 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1385 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1386 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
1387 updates_ref = (uint64_t)updates_var.inner & ~1;
1388 return 0 /* LDKMessageSendEvent - UpdateHTLCs */; (void) node_id_arr; (void) updates_ref;
1390 case LDKMessageSendEvent_SendRevokeAndACK: {
1391 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1392 memcpy((uint8_t*)(node_id_arr + 4), obj->send_revoke_and_ack.node_id.compressed_form, 33);
1393 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1394 uint64_t msg_ref = 0;
1395 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1396 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1397 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1398 msg_ref = (uint64_t)msg_var.inner & ~1;
1399 return 0 /* LDKMessageSendEvent - SendRevokeAndACK */; (void) node_id_arr; (void) msg_ref;
1401 case LDKMessageSendEvent_SendClosingSigned: {
1402 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1403 memcpy((uint8_t*)(node_id_arr + 4), obj->send_closing_signed.node_id.compressed_form, 33);
1404 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1405 uint64_t msg_ref = 0;
1406 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1407 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1408 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1409 msg_ref = (uint64_t)msg_var.inner & ~1;
1410 return 0 /* LDKMessageSendEvent - SendClosingSigned */; (void) node_id_arr; (void) msg_ref;
1412 case LDKMessageSendEvent_SendShutdown: {
1413 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1414 memcpy((uint8_t*)(node_id_arr + 4), obj->send_shutdown.node_id.compressed_form, 33);
1415 LDKShutdown msg_var = obj->send_shutdown.msg;
1416 uint64_t msg_ref = 0;
1417 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1418 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1419 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1420 msg_ref = (uint64_t)msg_var.inner & ~1;
1421 return 0 /* LDKMessageSendEvent - SendShutdown */; (void) node_id_arr; (void) msg_ref;
1423 case LDKMessageSendEvent_SendChannelReestablish: {
1424 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1425 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_reestablish.node_id.compressed_form, 33);
1426 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1427 uint64_t msg_ref = 0;
1428 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1429 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1430 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1431 msg_ref = (uint64_t)msg_var.inner & ~1;
1432 return 0 /* LDKMessageSendEvent - SendChannelReestablish */; (void) node_id_arr; (void) msg_ref;
1434 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1435 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1436 uint64_t msg_ref = 0;
1437 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1438 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1439 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1440 msg_ref = (uint64_t)msg_var.inner & ~1;
1441 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1442 uint64_t update_msg_ref = 0;
1443 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1444 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1445 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
1446 update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
1447 return 0 /* LDKMessageSendEvent - BroadcastChannelAnnouncement */; (void) msg_ref; (void) update_msg_ref;
1449 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1450 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1451 uint64_t msg_ref = 0;
1452 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1453 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1454 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1455 msg_ref = (uint64_t)msg_var.inner & ~1;
1456 return 0 /* LDKMessageSendEvent - BroadcastNodeAnnouncement */; (void) msg_ref;
1458 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1459 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1460 uint64_t msg_ref = 0;
1461 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1462 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1463 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1464 msg_ref = (uint64_t)msg_var.inner & ~1;
1465 return 0 /* LDKMessageSendEvent - BroadcastChannelUpdate */; (void) msg_ref;
1467 case LDKMessageSendEvent_SendChannelUpdate: {
1468 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1469 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_update.node_id.compressed_form, 33);
1470 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
1471 uint64_t msg_ref = 0;
1472 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1473 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1474 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1475 msg_ref = (uint64_t)msg_var.inner & ~1;
1476 return 0 /* LDKMessageSendEvent - SendChannelUpdate */; (void) node_id_arr; (void) msg_ref;
1478 case LDKMessageSendEvent_HandleError: {
1479 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1480 memcpy((uint8_t*)(node_id_arr + 4), obj->handle_error.node_id.compressed_form, 33);
1481 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
1482 return 0 /* LDKMessageSendEvent - HandleError */; (void) node_id_arr; (void) action_ref;
1484 case LDKMessageSendEvent_SendChannelRangeQuery: {
1485 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1486 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_range_query.node_id.compressed_form, 33);
1487 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1488 uint64_t msg_ref = 0;
1489 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1490 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1491 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1492 msg_ref = (uint64_t)msg_var.inner & ~1;
1493 return 0 /* LDKMessageSendEvent - SendChannelRangeQuery */; (void) node_id_arr; (void) msg_ref;
1495 case LDKMessageSendEvent_SendShortIdsQuery: {
1496 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1497 memcpy((uint8_t*)(node_id_arr + 4), obj->send_short_ids_query.node_id.compressed_form, 33);
1498 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1499 uint64_t msg_ref = 0;
1500 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1501 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1502 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1503 msg_ref = (uint64_t)msg_var.inner & ~1;
1504 return 0 /* LDKMessageSendEvent - SendShortIdsQuery */; (void) node_id_arr; (void) msg_ref;
1506 case LDKMessageSendEvent_SendReplyChannelRange: {
1507 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1508 memcpy((uint8_t*)(node_id_arr + 4), obj->send_reply_channel_range.node_id.compressed_form, 33);
1509 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1510 uint64_t msg_ref = 0;
1511 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1512 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1513 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1514 msg_ref = (uint64_t)msg_var.inner & ~1;
1515 return 0 /* LDKMessageSendEvent - SendReplyChannelRange */; (void) node_id_arr; (void) msg_ref;
1520 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1521 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1522 for (size_t i = 0; i < ret.datalen; i++) {
1523 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1527 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1528 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1529 CHECK(val->result_ok);
1530 LDKInitFeatures res_var = (*val->contents.result);
1531 uint64_t res_ref = 0;
1532 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1533 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1534 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1535 res_ref = (uint64_t)res_var.inner & ~1;
1538 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1539 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1540 CHECK(!val->result_ok);
1541 LDKDecodeError err_var = (*val->contents.err);
1542 uint64_t err_ref = 0;
1543 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1544 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1545 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1546 err_ref = (uint64_t)err_var.inner & ~1;
1549 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1550 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1551 CHECK(val->result_ok);
1552 LDKNodeFeatures res_var = (*val->contents.result);
1553 uint64_t res_ref = 0;
1554 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1555 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1556 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1557 res_ref = (uint64_t)res_var.inner & ~1;
1560 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1561 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1562 CHECK(!val->result_ok);
1563 LDKDecodeError err_var = (*val->contents.err);
1564 uint64_t err_ref = 0;
1565 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1566 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1567 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1568 err_ref = (uint64_t)err_var.inner & ~1;
1571 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1572 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1573 CHECK(val->result_ok);
1574 LDKChannelFeatures res_var = (*val->contents.result);
1575 uint64_t res_ref = 0;
1576 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1577 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1578 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1579 res_ref = (uint64_t)res_var.inner & ~1;
1582 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1583 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1584 CHECK(!val->result_ok);
1585 LDKDecodeError err_var = (*val->contents.err);
1586 uint64_t err_ref = 0;
1587 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1588 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1589 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1590 err_ref = (uint64_t)err_var.inner & ~1;
1593 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1594 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1595 CHECK(val->result_ok);
1596 LDKInvoiceFeatures res_var = (*val->contents.result);
1597 uint64_t res_ref = 0;
1598 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1599 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1600 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1601 res_ref = (uint64_t)res_var.inner & ~1;
1604 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1605 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1606 CHECK(!val->result_ok);
1607 LDKDecodeError err_var = (*val->contents.err);
1608 uint64_t err_ref = 0;
1609 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1610 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1611 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1612 err_ref = (uint64_t)err_var.inner & ~1;
1615 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScoringParametersDecodeErrorZ_get_ok(uint32_t arg) {
1616 LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1);
1617 CHECK(val->result_ok);
1618 LDKScoringParameters res_var = (*val->contents.result);
1619 uint64_t res_ref = 0;
1620 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1621 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1622 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1623 res_ref = (uint64_t)res_var.inner & ~1;
1626 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScoringParametersDecodeErrorZ_get_err(uint32_t arg) {
1627 LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1);
1628 CHECK(!val->result_ok);
1629 LDKDecodeError err_var = (*val->contents.err);
1630 uint64_t err_ref = 0;
1631 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1632 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1633 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1634 err_ref = (uint64_t)err_var.inner & ~1;
1637 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScorerDecodeErrorZ_get_ok(uint32_t arg) {
1638 LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1);
1639 CHECK(val->result_ok);
1640 LDKScorer res_var = (*val->contents.result);
1641 uint64_t res_ref = 0;
1642 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1643 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1644 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1645 res_ref = (uint64_t)res_var.inner & ~1;
1648 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScorerDecodeErrorZ_get_err(uint32_t arg) {
1649 LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1);
1650 CHECK(!val->result_ok);
1651 LDKDecodeError err_var = (*val->contents.err);
1652 uint64_t err_ref = 0;
1653 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1654 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1655 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1656 err_ref = (uint64_t)err_var.inner & ~1;
1659 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1660 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1661 CHECK(val->result_ok);
1662 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
1663 uint64_t res_ref = 0;
1664 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1665 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1666 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1667 res_ref = (uint64_t)res_var.inner & ~1;
1670 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1671 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1672 CHECK(!val->result_ok);
1673 LDKDecodeError err_var = (*val->contents.err);
1674 uint64_t err_ref = 0;
1675 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1676 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1677 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1678 err_ref = (uint64_t)err_var.inner & ~1;
1681 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1682 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1683 CHECK(val->result_ok);
1684 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
1685 uint64_t res_ref = 0;
1686 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1687 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1688 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
1689 res_ref = (uint64_t)res_var.inner & ~1;
1692 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1693 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1694 CHECK(!val->result_ok);
1695 LDKDecodeError err_var = (*val->contents.err);
1696 uint64_t err_ref = 0;
1697 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1698 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1699 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1700 err_ref = (uint64_t)err_var.inner & ~1;
1703 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1704 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1705 CHECK(val->result_ok);
1706 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1709 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1710 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1711 CHECK(!val->result_ok);
1712 LDKDecodeError err_var = (*val->contents.err);
1713 uint64_t err_ref = 0;
1714 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1715 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1716 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
1717 err_ref = (uint64_t)err_var.inner & ~1;
1720 void __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_get_ok(uint32_t arg) {
1721 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
1722 CHECK(val->result_ok);
1723 return *val->contents.result;
1725 void __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_get_err(uint32_t arg) {
1726 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
1727 CHECK(!val->result_ok);
1728 return *val->contents.err;
1730 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR tuple){
1733 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t tuple) {
1734 LDKC2Tuple_SignatureCVec_SignatureZZ* tuple_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(tuple & ~1);
1735 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1736 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_SignatureCVec_SignatureZZ_get_a(tuple_conv).compact_form, 64);
1740 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR tuple){
1743 ptrArray __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t tuple) {
1744 LDKC2Tuple_SignatureCVec_SignatureZZ* tuple_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(tuple & ~1);
1745 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(tuple_conv);
1746 ptrArray ret_arr = NULL;
1747 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
1748 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
1749 for (size_t m = 0; m < ret_var.datalen; m++) {
1750 int8_tArray ret_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1751 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].compact_form, 64);
1752 ret_arr_ptr[m] = ret_conv_12_arr;
1759 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t arg) {
1760 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1761 CHECK(val->result_ok);
1762 LDKC2Tuple_SignatureCVec_SignatureZZ* res_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1763 *res_conv = (*val->contents.result);
1764 *res_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(res_conv);
1765 return ((uint64_t)res_conv);
1767 void __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t arg) {
1768 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1769 CHECK(!val->result_ok);
1770 return *val->contents.err;
1772 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_ok(uint32_t arg) {
1773 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1774 CHECK(val->result_ok);
1775 int8_tArray res_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1776 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compact_form, 64);
1779 void __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_err(uint32_t arg) {
1780 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1781 CHECK(!val->result_ok);
1782 return *val->contents.err;
1784 typedef struct LDKBaseSign_JCalls {
1785 atomic_size_t refcnt;
1786 uint32_t get_per_commitment_point_meth;
1787 uint32_t release_commitment_secret_meth;
1788 uint32_t validate_holder_commitment_meth;
1789 uint32_t channel_keys_id_meth;
1790 uint32_t sign_counterparty_commitment_meth;
1791 uint32_t validate_counterparty_revocation_meth;
1792 uint32_t sign_holder_commitment_and_htlcs_meth;
1793 uint32_t sign_justice_revoked_output_meth;
1794 uint32_t sign_justice_revoked_htlc_meth;
1795 uint32_t sign_counterparty_htlc_transaction_meth;
1796 uint32_t sign_closing_transaction_meth;
1797 uint32_t sign_channel_announcement_meth;
1798 uint32_t ready_channel_meth;
1799 } LDKBaseSign_JCalls;
1800 static void LDKBaseSign_JCalls_free(void* this_arg) {
1801 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1802 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1803 js_free(j_calls->get_per_commitment_point_meth);
1804 js_free(j_calls->release_commitment_secret_meth);
1805 js_free(j_calls->validate_holder_commitment_meth);
1806 js_free(j_calls->channel_keys_id_meth);
1807 js_free(j_calls->sign_counterparty_commitment_meth);
1808 js_free(j_calls->validate_counterparty_revocation_meth);
1809 js_free(j_calls->sign_holder_commitment_and_htlcs_meth);
1810 js_free(j_calls->sign_justice_revoked_output_meth);
1811 js_free(j_calls->sign_justice_revoked_htlc_meth);
1812 js_free(j_calls->sign_counterparty_htlc_transaction_meth);
1813 js_free(j_calls->sign_closing_transaction_meth);
1814 js_free(j_calls->sign_channel_announcement_meth);
1815 js_free(j_calls->ready_channel_meth);
1819 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1820 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1821 int8_tArray ret = js_invoke_function_1(j_calls->get_per_commitment_point_meth, idx);
1822 LDKPublicKey ret_ref;
1823 CHECK(*((uint32_t*)ret) == 33);
1824 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
1827 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1828 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1829 int8_tArray ret = js_invoke_function_1(j_calls->release_commitment_secret_meth, idx);
1830 LDKThirtyTwoBytes ret_ref;
1831 CHECK(*((uint32_t*)ret) == 32);
1832 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1835 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx) {
1836 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1837 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1838 uint64_t holder_tx_ref = 0;
1839 holder_tx_var = HolderCommitmentTransaction_clone(holder_tx);
1840 CHECK((((uint64_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1841 CHECK((((uint64_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1842 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
1843 holder_tx_ref = (uint64_t)holder_tx_var.inner;
1844 if (holder_tx_var.is_owned) {
1847 uint32_t ret = js_invoke_function_1(j_calls->validate_holder_commitment_meth, holder_tx_ref);
1848 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1849 CHECK_ACCESS(ret_ptr);
1850 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1854 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
1855 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1856 int8_tArray ret = js_invoke_function_0(j_calls->channel_keys_id_meth);
1857 LDKThirtyTwoBytes ret_ref;
1858 CHECK(*((uint32_t*)ret) == 32);
1859 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1862 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1863 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1864 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1865 uint64_t commitment_tx_ref = 0;
1866 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1867 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1868 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1869 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1870 commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1871 if (commitment_tx_var.is_owned) {
1872 commitment_tx_ref |= 1;
1874 uint32_t ret = js_invoke_function_1(j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
1875 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1876 CHECK_ACCESS(ret_ptr);
1877 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
1881 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
1882 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1883 int8_tArray secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1884 memcpy((uint8_t*)(secret_arr + 4), *secret, 32);
1885 uint32_t ret = js_invoke_function_2(j_calls->validate_counterparty_revocation_meth, idx, secret_arr);
1886 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1887 CHECK_ACCESS(ret_ptr);
1888 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1892 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1893 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1894 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1895 uint64_t commitment_tx_ref = 0;
1896 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1897 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1898 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1899 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1900 commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1901 if (commitment_tx_var.is_owned) {
1902 commitment_tx_ref |= 1;
1904 uint32_t ret = js_invoke_function_1(j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
1905 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1906 CHECK_ACCESS(ret_ptr);
1907 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
1911 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]) {
1912 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1913 LDKTransaction justice_tx_var = justice_tx;
1914 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1915 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1916 Transaction_free(justice_tx_var);
1917 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1918 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1919 uint32_t ret = js_invoke_function_4(j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
1920 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1921 CHECK_ACCESS(ret_ptr);
1922 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1926 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) {
1927 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1928 LDKTransaction justice_tx_var = justice_tx;
1929 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1930 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1931 Transaction_free(justice_tx_var);
1932 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1933 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1934 LDKHTLCOutputInCommitment htlc_var = *htlc;
1935 uint64_t htlc_ref = 0;
1936 htlc_var = HTLCOutputInCommitment_clone(htlc);
1937 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1938 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1939 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
1940 htlc_ref = (uint64_t)htlc_var.inner;
1941 if (htlc_var.is_owned) {
1944 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);
1945 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1946 CHECK_ACCESS(ret_ptr);
1947 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1951 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) {
1952 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1953 LDKTransaction htlc_tx_var = htlc_tx;
1954 int8_tArray htlc_tx_arr = init_arr(htlc_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1955 memcpy((uint8_t*)(htlc_tx_arr + 4), htlc_tx_var.data, htlc_tx_var.datalen);
1956 Transaction_free(htlc_tx_var);
1957 int8_tArray per_commitment_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1958 memcpy((uint8_t*)(per_commitment_point_arr + 4), per_commitment_point.compressed_form, 33);
1959 LDKHTLCOutputInCommitment htlc_var = *htlc;
1960 uint64_t htlc_ref = 0;
1961 htlc_var = HTLCOutputInCommitment_clone(htlc);
1962 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1963 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1964 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
1965 htlc_ref = (uint64_t)htlc_var.inner;
1966 if (htlc_var.is_owned) {
1969 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);
1970 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1971 CHECK_ACCESS(ret_ptr);
1972 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1976 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
1977 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1978 LDKClosingTransaction closing_tx_var = *closing_tx;
1979 uint64_t closing_tx_ref = 0;
1980 closing_tx_var = ClosingTransaction_clone(closing_tx);
1981 CHECK((((uint64_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1982 CHECK((((uint64_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1983 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
1984 closing_tx_ref = (uint64_t)closing_tx_var.inner;
1985 if (closing_tx_var.is_owned) {
1986 closing_tx_ref |= 1;
1988 uint32_t ret = js_invoke_function_1(j_calls->sign_closing_transaction_meth, closing_tx_ref);
1989 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1990 CHECK_ACCESS(ret_ptr);
1991 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1995 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1996 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1997 LDKUnsignedChannelAnnouncement msg_var = *msg;
1998 uint64_t msg_ref = 0;
1999 msg_var = UnsignedChannelAnnouncement_clone(msg);
2000 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2001 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2002 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2003 msg_ref = (uint64_t)msg_var.inner;
2004 if (msg_var.is_owned) {
2007 uint32_t ret = js_invoke_function_1(j_calls->sign_channel_announcement_meth, msg_ref);
2008 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2009 CHECK_ACCESS(ret_ptr);
2010 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2014 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2015 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2016 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2017 uint64_t channel_parameters_ref = 0;
2018 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
2019 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2020 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2021 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
2022 channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
2023 if (channel_parameters_var.is_owned) {
2024 channel_parameters_ref |= 1;
2026 js_invoke_function_1(j_calls->ready_channel_meth, channel_parameters_ref);
2028 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
2029 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
2030 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2032 static inline LDKBaseSign LDKBaseSign_init (/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
2033 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
2034 atomic_init(&calls->refcnt, 1);
2035 //TODO: Assign calls->o from o
2037 LDKChannelPublicKeys pubkeys_conv;
2038 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2039 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2040 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2043 .this_arg = (void*) calls,
2044 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
2045 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
2046 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
2047 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
2048 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
2049 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
2050 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
2051 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
2052 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
2053 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
2054 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
2055 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
2056 .ready_channel = ready_channel_LDKBaseSign_jcall,
2057 .free = LDKBaseSign_JCalls_free,
2058 .pubkeys = pubkeys_conv,
2059 .set_pubkeys = NULL,
2063 long __attribute__((visibility("default"))) TS_LDKBaseSign_new(/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
2064 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
2065 *res_ptr = LDKBaseSign_init(o, pubkeys);
2066 return (long)res_ptr;
2068 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
2069 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2070 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2071 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2072 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
2073 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
2077 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
2078 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2079 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2080 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2081 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2082 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
2086 uint32_t __attribute__((visibility("default"))) TS_BaseSign_validate_holder_commitment(uint32_t this_arg, uint32_t holder_tx) {
2087 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2088 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2089 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2090 LDKHolderCommitmentTransaction holder_tx_conv;
2091 holder_tx_conv.inner = (void*)(holder_tx & (~1));
2092 holder_tx_conv.is_owned = false;
2093 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
2094 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2095 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv);
2096 return (uint64_t)ret_conv;
2099 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_channel_keys_id(uint32_t this_arg) {
2100 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2101 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2102 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2103 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2104 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
2108 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_counterparty_commitment(uint32_t this_arg, uint32_t commitment_tx) {
2109 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2110 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2111 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2112 LDKCommitmentTransaction commitment_tx_conv;
2113 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2114 commitment_tx_conv.is_owned = false;
2115 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2116 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2117 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2118 return (uint64_t)ret_conv;
2121 uint32_t __attribute__((visibility("default"))) TS_BaseSign_validate_counterparty_revocation(uint32_t this_arg, int64_t idx, int8_tArray secret) {
2122 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2123 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2124 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2125 unsigned char secret_arr[32];
2126 CHECK(*((uint32_t*)secret) == 32);
2127 memcpy(secret_arr, (uint8_t*)(secret + 4), 32);
2128 unsigned char (*secret_ref)[32] = &secret_arr;
2129 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2130 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
2131 return (uint64_t)ret_conv;
2134 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_holder_commitment_and_htlcs(uint32_t this_arg, uint32_t commitment_tx) {
2135 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2136 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2137 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2138 LDKHolderCommitmentTransaction commitment_tx_conv;
2139 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2140 commitment_tx_conv.is_owned = false;
2141 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2142 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2143 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2144 return (uint64_t)ret_conv;
2147 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) {
2148 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2149 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2150 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2151 LDKTransaction justice_tx_ref;
2152 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
2153 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2154 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
2155 justice_tx_ref.data_is_owned = true;
2156 unsigned char per_commitment_key_arr[32];
2157 CHECK(*((uint32_t*)per_commitment_key) == 32);
2158 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
2159 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2160 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2161 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2162 return (uint64_t)ret_conv;
2165 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) {
2166 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2167 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2168 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2169 LDKTransaction justice_tx_ref;
2170 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
2171 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2172 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
2173 justice_tx_ref.data_is_owned = true;
2174 unsigned char per_commitment_key_arr[32];
2175 CHECK(*((uint32_t*)per_commitment_key) == 32);
2176 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
2177 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2178 LDKHTLCOutputInCommitment htlc_conv;
2179 htlc_conv.inner = (void*)(htlc & (~1));
2180 htlc_conv.is_owned = false;
2181 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2182 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2183 *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);
2184 return (uint64_t)ret_conv;
2187 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) {
2188 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2189 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2190 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2191 LDKTransaction htlc_tx_ref;
2192 htlc_tx_ref.datalen = *((uint32_t*)htlc_tx);
2193 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2194 memcpy(htlc_tx_ref.data, (uint8_t*)(htlc_tx + 4), htlc_tx_ref.datalen);
2195 htlc_tx_ref.data_is_owned = true;
2196 LDKPublicKey per_commitment_point_ref;
2197 CHECK(*((uint32_t*)per_commitment_point) == 33);
2198 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
2199 LDKHTLCOutputInCommitment htlc_conv;
2200 htlc_conv.inner = (void*)(htlc & (~1));
2201 htlc_conv.is_owned = false;
2202 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2203 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2204 *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);
2205 return (uint64_t)ret_conv;
2208 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_closing_transaction(uint32_t this_arg, uint32_t closing_tx) {
2209 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2210 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2211 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2212 LDKClosingTransaction closing_tx_conv;
2213 closing_tx_conv.inner = (void*)(closing_tx & (~1));
2214 closing_tx_conv.is_owned = false;
2215 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
2216 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2217 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
2218 return (uint64_t)ret_conv;
2221 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
2222 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2223 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2224 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2225 LDKUnsignedChannelAnnouncement msg_conv;
2226 msg_conv.inner = (void*)(msg & (~1));
2227 msg_conv.is_owned = false;
2228 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
2229 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2230 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2231 return (uint64_t)ret_conv;
2234 void __attribute__((visibility("default"))) TS_BaseSign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
2235 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2236 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2237 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2238 LDKChannelTransactionParameters channel_parameters_conv;
2239 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2240 channel_parameters_conv.is_owned = false;
2241 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
2242 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2245 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
2246 if (this_arg->set_pubkeys != NULL)
2247 this_arg->set_pubkeys(this_arg);
2248 return this_arg->pubkeys;
2250 uint32_t __attribute__((visibility("default"))) TS_BaseSign_get_pubkeys(uint32_t this_arg) {
2251 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2252 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2253 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2254 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
2255 uint64_t ret_ref = 0;
2256 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2257 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2258 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2259 ret_ref = (uint64_t)ret_var.inner;
2260 if (ret_var.is_owned) {
2266 typedef struct LDKSign_JCalls {
2267 atomic_size_t refcnt;
2268 LDKBaseSign_JCalls* BaseSign;
2269 uint32_t write_meth;
2271 static void LDKSign_JCalls_free(void* this_arg) {
2272 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2273 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2274 js_free(j_calls->write_meth);
2278 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
2279 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2280 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
2281 LDKCVec_u8Z ret_ref;
2282 ret_ref.datalen = *((uint32_t*)ret);
2283 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2284 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
2287 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
2288 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
2289 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2290 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
2292 static inline LDKSign LDKSign_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* BaseSign, uint32_t pubkeys) {
2293 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2294 atomic_init(&calls->refcnt, 1);
2295 //TODO: Assign calls->o from o
2297 LDKChannelPublicKeys pubkeys_conv;
2298 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2299 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2300 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2303 .this_arg = (void*) calls,
2304 .write = write_LDKSign_jcall,
2305 .cloned = LDKSign_JCalls_cloned,
2306 .free = LDKSign_JCalls_free,
2307 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
2309 calls->BaseSign = ret.BaseSign.this_arg;
2312 long __attribute__((visibility("default"))) TS_LDKSign_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* BaseSign, uint32_t pubkeys) {
2313 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2314 *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
2315 return (long)res_ptr;
2317 int8_tArray __attribute__((visibility("default"))) TS_Sign_write(uint32_t this_arg) {
2318 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2319 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2320 LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
2321 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2322 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2323 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
2324 CVec_u8Z_free(ret_var);
2328 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_ok(uint32_t arg) {
2329 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2330 CHECK(val->result_ok);
2331 LDKSign* res_ret = MALLOC(sizeof(LDKSign), "LDKSign");
2332 *res_ret = Sign_clone(&(*val->contents.result));
2333 return (uint64_t)res_ret;
2335 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_err(uint32_t arg) {
2336 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2337 CHECK(!val->result_ok);
2338 LDKDecodeError err_var = (*val->contents.err);
2339 uint64_t err_ref = 0;
2340 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2341 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2342 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
2343 err_ref = (uint64_t)err_var.inner & ~1;
2346 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_get_ok(uint32_t arg) {
2347 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2348 CHECK(val->result_ok);
2349 int8_tArray es_arr = init_arr(68, sizeof(uint8_t), "Native int8_tArray Bytes");
2350 memcpy((uint8_t*)(es_arr + 4), (*val->contents.result).serialized_form, 68);
2353 void __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_get_err(uint32_t arg) {
2354 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2355 CHECK(!val->result_ok);
2356 return *val->contents.err;
2358 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2359 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2360 for (size_t i = 0; i < ret.datalen; i++) {
2361 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2365 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t arg) {
2366 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2367 CHECK(val->result_ok);
2368 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
2369 ptrArray res_arr = NULL;
2370 res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
2371 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
2372 for (size_t m = 0; m < res_var.datalen; m++) {
2373 LDKCVec_u8Z res_conv_12_var = res_var.data[m];
2374 int8_tArray res_conv_12_arr = init_arr(res_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2375 memcpy((uint8_t*)(res_conv_12_arr + 4), res_conv_12_var.data, res_conv_12_var.datalen);
2376 res_arr_ptr[m] = res_conv_12_arr;
2381 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t arg) {
2382 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2383 CHECK(!val->result_ok);
2384 return *val->contents.err;
2386 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t arg) {
2387 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2388 CHECK(val->result_ok);
2389 LDKInMemorySigner res_var = (*val->contents.result);
2390 uint64_t res_ref = 0;
2391 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2392 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2393 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
2394 res_ref = (uint64_t)res_var.inner & ~1;
2397 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_err(uint32_t arg) {
2398 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2399 CHECK(!val->result_ok);
2400 LDKDecodeError err_var = (*val->contents.err);
2401 uint64_t err_ref = 0;
2402 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2403 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2404 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
2405 err_ref = (uint64_t)err_var.inner & ~1;
2408 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2409 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2410 for (size_t i = 0; i < ret.datalen; i++) {
2411 ret.data[i] = TxOut_clone(&orig->data[i]);
2415 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_ok(uint32_t arg) {
2416 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2417 CHECK(val->result_ok);
2418 LDKTransaction res_var = (*val->contents.result);
2419 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2420 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
2423 void __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_err(uint32_t arg) {
2424 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2425 CHECK(!val->result_ok);
2426 return *val->contents.err;
2428 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR tuple){
2429 return ThirtyTwoBytes_clone(&tuple->a);
2431 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t tuple) {
2432 LDKC2Tuple_BlockHashChannelMonitorZ* tuple_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(tuple & ~1);
2433 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2434 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_BlockHashChannelMonitorZ_get_a(tuple_conv).data, 32);
2438 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR tuple){
2439 return ChannelMonitor_clone(&tuple->b);
2441 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t tuple) {
2442 LDKC2Tuple_BlockHashChannelMonitorZ* tuple_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(tuple & ~1);
2443 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(tuple_conv);
2444 uint64_t ret_ref = 0;
2445 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2446 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2447 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2448 ret_ref = (uint64_t)ret_var.inner;
2449 if (ret_var.is_owned) {
2455 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
2456 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
2457 for (size_t i = 0; i < ret.datalen; i++) {
2458 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
2462 uint32_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(uint32_t arg) {
2463 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2464 CHECK(val->result_ok);
2465 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
2466 uint32_tArray res_arr = NULL;
2467 res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2468 uint32_t *res_arr_ptr = (uint32_t*)(res_arr + 4);
2469 for (size_t j = 0; j < res_var.datalen; j++) {
2470 LDKC2Tuple_BlockHashChannelMonitorZ* res_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2471 *res_conv_35_conv = res_var.data[j];
2472 *res_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone(res_conv_35_conv);
2473 res_arr_ptr[j] = ((uint64_t)res_conv_35_conv);
2478 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(uint32_t arg) {
2479 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2480 CHECK(!val->result_ok);
2481 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
2484 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u16Z_ref_from_ptr(uint32_t ptr) {
2485 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
2487 case LDKCOption_u16Z_Some: {
2488 return 0 /* LDKCOption_u16Z - Some */; (void) obj->some;
2490 case LDKCOption_u16Z_None: {
2491 return 0 /* LDKCOption_u16Z - None */;
2496 uint32_t __attribute__((visibility("default"))) TS_LDKAPIError_ref_from_ptr(uint32_t ptr) {
2497 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
2499 case LDKAPIError_APIMisuseError: {
2500 LDKStr err_str = obj->api_misuse_error.err;
2501 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2502 return 0 /* LDKAPIError - APIMisuseError */; (void) err_conv;
2504 case LDKAPIError_FeeRateTooHigh: {
2505 LDKStr err_str = obj->fee_rate_too_high.err;
2506 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2507 return 0 /* LDKAPIError - FeeRateTooHigh */; (void) err_conv; (void) obj->fee_rate_too_high.feerate;
2509 case LDKAPIError_RouteError: {
2510 LDKStr err_str = obj->route_error.err;
2511 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2512 return 0 /* LDKAPIError - RouteError */; (void) err_conv;
2514 case LDKAPIError_ChannelUnavailable: {
2515 LDKStr err_str = obj->channel_unavailable.err;
2516 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2517 return 0 /* LDKAPIError - ChannelUnavailable */; (void) err_conv;
2519 case LDKAPIError_MonitorUpdateFailed: {
2520 return 0 /* LDKAPIError - MonitorUpdateFailed */;
2522 case LDKAPIError_IncompatibleShutdownScript: {
2523 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
2524 uint64_t script_ref = 0;
2525 CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2526 CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2527 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
2528 script_ref = (uint64_t)script_var.inner & ~1;
2529 return 0 /* LDKAPIError - IncompatibleShutdownScript */; (void) script_ref;
2534 void __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_ok(uint32_t arg) {
2535 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2536 CHECK(val->result_ok);
2537 return *val->contents.result;
2539 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_err(uint32_t arg) {
2540 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2541 CHECK(!val->result_ok);
2542 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2545 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2546 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2547 for (size_t i = 0; i < ret.datalen; i++) {
2548 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
2552 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
2553 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
2554 for (size_t i = 0; i < ret.datalen; i++) {
2555 ret.data[i] = APIError_clone(&orig->data[i]);
2559 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult__u832APIErrorZ_get_ok(uint32_t arg) {
2560 LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1);
2561 CHECK(val->result_ok);
2562 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2563 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2566 uint32_t __attribute__((visibility("default"))) TS_LDKCResult__u832APIErrorZ_get_err(uint32_t arg) {
2567 LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1);
2568 CHECK(!val->result_ok);
2569 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2572 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentSendFailure_ref_from_ptr(uint32_t ptr) {
2573 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
2575 case LDKPaymentSendFailure_ParameterError: {
2576 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
2577 return 0 /* LDKPaymentSendFailure - ParameterError */; (void) parameter_error_ref;
2579 case LDKPaymentSendFailure_PathParameterError: {
2580 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
2581 uint32_tArray path_parameter_error_arr = NULL;
2582 path_parameter_error_arr = init_arr(path_parameter_error_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2583 uint32_t *path_parameter_error_arr_ptr = (uint32_t*)(path_parameter_error_arr + 4);
2584 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
2585 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2586 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
2587 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
2588 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
2591 return 0 /* LDKPaymentSendFailure - PathParameterError */; (void) path_parameter_error_arr;
2593 case LDKPaymentSendFailure_AllFailedRetrySafe: {
2594 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
2595 uint32_tArray all_failed_retry_safe_arr = NULL;
2596 all_failed_retry_safe_arr = init_arr(all_failed_retry_safe_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2597 uint32_t *all_failed_retry_safe_arr_ptr = (uint32_t*)(all_failed_retry_safe_arr + 4);
2598 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
2599 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
2600 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
2603 return 0 /* LDKPaymentSendFailure - AllFailedRetrySafe */; (void) all_failed_retry_safe_arr;
2605 case LDKPaymentSendFailure_PartialFailure: {
2606 LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
2607 uint32_tArray results_arr = NULL;
2608 results_arr = init_arr(results_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2609 uint32_t *results_arr_ptr = (uint32_t*)(results_arr + 4);
2610 for (size_t w = 0; w < results_var.datalen; w++) {
2611 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2612 *results_conv_22_conv = results_var.data[w];
2613 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
2614 results_arr_ptr[w] = (uint64_t)results_conv_22_conv;
2617 LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
2618 uint64_t failed_paths_retry_ref = 0;
2619 if ((uint64_t)failed_paths_retry_var.inner > 4096) {
2620 CHECK((((uint64_t)failed_paths_retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2621 CHECK((((uint64_t)&failed_paths_retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2622 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
2623 failed_paths_retry_ref = (uint64_t)failed_paths_retry_var.inner & ~1;
2625 int8_tArray payment_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2626 memcpy((uint8_t*)(payment_id_arr + 4), obj->partial_failure.payment_id.data, 32);
2627 return 0 /* LDKPaymentSendFailure - PartialFailure */; (void) results_arr; (void) failed_paths_retry_ref; (void) payment_id_arr;
2632 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentSendFailureZ_get_ok(uint32_t arg) {
2633 LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
2634 CHECK(val->result_ok);
2635 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2636 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2639 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentSendFailureZ_get_err(uint32_t arg) {
2640 LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
2641 CHECK(!val->result_ok);
2642 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2645 void __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_ok(uint32_t arg) {
2646 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2647 CHECK(val->result_ok);
2648 return *val->contents.result;
2650 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_err(uint32_t arg) {
2651 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2652 CHECK(!val->result_ok);
2653 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2656 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){
2657 return ThirtyTwoBytes_clone(&tuple->a);
2659 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint32_t tuple) {
2660 LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1);
2661 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2662 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentIdZ_get_a(tuple_conv).data, 32);
2666 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){
2667 return ThirtyTwoBytes_clone(&tuple->b);
2669 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint32_t tuple) {
2670 LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1);
2671 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2672 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentIdZ_get_b(tuple_conv).data, 32);
2676 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint32_t arg) {
2677 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
2678 CHECK(val->result_ok);
2679 LDKC2Tuple_PaymentHashPaymentIdZ* res_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
2680 *res_conv = (*val->contents.result);
2681 *res_conv = C2Tuple_PaymentHashPaymentIdZ_clone(res_conv);
2682 return ((uint64_t)res_conv);
2684 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint32_t arg) {
2685 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
2686 CHECK(!val->result_ok);
2687 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2690 uint32_t __attribute__((visibility("default"))) TS_LDKNetAddress_ref_from_ptr(uint32_t ptr) {
2691 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
2693 case LDKNetAddress_IPv4: {
2694 int8_tArray addr_arr = init_arr(4, sizeof(uint8_t), "Native int8_tArray Bytes");
2695 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv4.addr.data, 4);
2696 return 0 /* LDKNetAddress - IPv4 */; (void) addr_arr; (void) obj->i_pv4.port;
2698 case LDKNetAddress_IPv6: {
2699 int8_tArray addr_arr = init_arr(16, sizeof(uint8_t), "Native int8_tArray Bytes");
2700 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv6.addr.data, 16);
2701 return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port;
2703 case LDKNetAddress_OnionV2: {
2704 int8_tArray addr_arr = init_arr(10, sizeof(uint8_t), "Native int8_tArray Bytes");
2705 memcpy((uint8_t*)(addr_arr + 4), obj->onion_v2.addr.data, 10);
2706 return 0 /* LDKNetAddress - OnionV2 */; (void) addr_arr; (void) obj->onion_v2.port;
2708 case LDKNetAddress_OnionV3: {
2709 int8_tArray ed25519_pubkey_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2710 memcpy((uint8_t*)(ed25519_pubkey_arr + 4), obj->onion_v3.ed25519_pubkey.data, 32);
2711 return 0 /* LDKNetAddress - OnionV3 */; (void) ed25519_pubkey_arr; (void) obj->onion_v3.checksum; (void) obj->onion_v3.version; (void) obj->onion_v3.port;
2716 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
2717 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
2718 for (size_t i = 0; i < ret.datalen; i++) {
2719 ret.data[i] = NetAddress_clone(&orig->data[i]);
2723 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR tuple){
2724 return ThirtyTwoBytes_clone(&tuple->a);
2726 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint32_t tuple) {
2727 LDKC2Tuple_PaymentHashPaymentSecretZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(tuple & ~1);
2728 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2729 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentSecretZ_get_a(tuple_conv).data, 32);
2733 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR tuple){
2734 return ThirtyTwoBytes_clone(&tuple->b);
2736 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint32_t tuple) {
2737 LDKC2Tuple_PaymentHashPaymentSecretZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(tuple & ~1);
2738 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2739 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentSecretZ_get_b(tuple_conv).data, 32);
2743 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_ok(uint32_t arg) {
2744 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
2745 CHECK(val->result_ok);
2746 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2747 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2750 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_err(uint32_t arg) {
2751 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
2752 CHECK(!val->result_ok);
2753 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2756 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
2757 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
2758 for (size_t i = 0; i < ret.datalen; i++) {
2759 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
2763 typedef struct LDKWatch_JCalls {
2764 atomic_size_t refcnt;
2765 uint32_t watch_channel_meth;
2766 uint32_t update_channel_meth;
2767 uint32_t release_pending_monitor_events_meth;
2769 static void LDKWatch_JCalls_free(void* this_arg) {
2770 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2771 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2772 js_free(j_calls->watch_channel_meth);
2773 js_free(j_calls->update_channel_meth);
2774 js_free(j_calls->release_pending_monitor_events_meth);
2778 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2779 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2780 LDKOutPoint funding_txo_var = funding_txo;
2781 uint64_t funding_txo_ref = 0;
2782 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2783 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2784 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2785 funding_txo_ref = (uint64_t)funding_txo_var.inner;
2786 if (funding_txo_var.is_owned) {
2787 funding_txo_ref |= 1;
2789 LDKChannelMonitor monitor_var = monitor;
2790 uint64_t monitor_ref = 0;
2791 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2792 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2793 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
2794 monitor_ref = (uint64_t)monitor_var.inner;
2795 if (monitor_var.is_owned) {
2798 uint32_t ret = js_invoke_function_2(j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2799 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2800 CHECK_ACCESS(ret_ptr);
2801 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
2805 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2806 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2807 LDKOutPoint funding_txo_var = funding_txo;
2808 uint64_t funding_txo_ref = 0;
2809 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2810 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2811 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2812 funding_txo_ref = (uint64_t)funding_txo_var.inner;
2813 if (funding_txo_var.is_owned) {
2814 funding_txo_ref |= 1;
2816 LDKChannelMonitorUpdate update_var = update;
2817 uint64_t update_ref = 0;
2818 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2819 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2820 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
2821 update_ref = (uint64_t)update_var.inner;
2822 if (update_var.is_owned) {
2825 uint32_t ret = js_invoke_function_2(j_calls->update_channel_meth, funding_txo_ref, update_ref);
2826 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2827 CHECK_ACCESS(ret_ptr);
2828 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
2832 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
2833 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2834 uint32_tArray ret = js_invoke_function_0(j_calls->release_pending_monitor_events_meth);
2835 LDKCVec_MonitorEventZ ret_constr;
2836 ret_constr.datalen = *((uint32_t*)ret);
2837 if (ret_constr.datalen > 0)
2838 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2840 ret_constr.data = NULL;
2841 uint32_t* ret_vals = (uint32_t*)(ret + 4);
2842 for (size_t o = 0; o < ret_constr.datalen; o++) {
2843 uint32_t ret_conv_14 = ret_vals[o];
2844 void* ret_conv_14_ptr = (void*)(((uint64_t)ret_conv_14) & ~1);
2845 CHECK_ACCESS(ret_conv_14_ptr);
2846 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(ret_conv_14_ptr);
2847 FREE((void*)ret_conv_14);
2848 ret_constr.data[o] = ret_conv_14_conv;
2852 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
2853 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
2854 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2856 static inline LDKWatch LDKWatch_init (/*TODO: JS Object Reference */void* o) {
2857 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2858 atomic_init(&calls->refcnt, 1);
2859 //TODO: Assign calls->o from o
2862 .this_arg = (void*) calls,
2863 .watch_channel = watch_channel_LDKWatch_jcall,
2864 .update_channel = update_channel_LDKWatch_jcall,
2865 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
2866 .free = LDKWatch_JCalls_free,
2870 long __attribute__((visibility("default"))) TS_LDKWatch_new(/*TODO: JS Object Reference */void* o) {
2871 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2872 *res_ptr = LDKWatch_init(o);
2873 return (long)res_ptr;
2875 uint32_t __attribute__((visibility("default"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
2876 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2877 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2878 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
2879 LDKOutPoint funding_txo_conv;
2880 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2881 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2882 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
2883 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2884 LDKChannelMonitor monitor_conv;
2885 monitor_conv.inner = (void*)(monitor & (~1));
2886 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2887 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
2888 monitor_conv = ChannelMonitor_clone(&monitor_conv);
2889 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2890 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2891 return (uint64_t)ret_conv;
2894 uint32_t __attribute__((visibility("default"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
2895 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2896 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2897 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
2898 LDKOutPoint funding_txo_conv;
2899 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2900 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2901 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
2902 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2903 LDKChannelMonitorUpdate update_conv;
2904 update_conv.inner = (void*)(update & (~1));
2905 update_conv.is_owned = (update & 1) || (update == 0);
2906 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
2907 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2908 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2909 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2910 return (uint64_t)ret_conv;
2913 uint32_tArray __attribute__((visibility("default"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
2914 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2915 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2916 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
2917 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2918 uint32_tArray ret_arr = NULL;
2919 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2920 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
2921 for (size_t o = 0; o < ret_var.datalen; o++) {
2922 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2923 *ret_conv_14_copy = ret_var.data[o];
2924 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
2925 ret_arr_ptr[o] = ret_conv_14_ref;
2932 typedef struct LDKBroadcasterInterface_JCalls {
2933 atomic_size_t refcnt;
2934 uint32_t broadcast_transaction_meth;
2935 } LDKBroadcasterInterface_JCalls;
2936 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2937 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2938 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2939 js_free(j_calls->broadcast_transaction_meth);
2943 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
2944 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2945 LDKTransaction tx_var = tx;
2946 int8_tArray tx_arr = init_arr(tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2947 memcpy((uint8_t*)(tx_arr + 4), tx_var.data, tx_var.datalen);
2948 Transaction_free(tx_var);
2949 js_invoke_function_1(j_calls->broadcast_transaction_meth, tx_arr);
2951 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
2952 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
2953 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2955 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (/*TODO: JS Object Reference */void* o) {
2956 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2957 atomic_init(&calls->refcnt, 1);
2958 //TODO: Assign calls->o from o
2960 LDKBroadcasterInterface ret = {
2961 .this_arg = (void*) calls,
2962 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
2963 .free = LDKBroadcasterInterface_JCalls_free,
2967 long __attribute__((visibility("default"))) TS_LDKBroadcasterInterface_new(/*TODO: JS Object Reference */void* o) {
2968 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2969 *res_ptr = LDKBroadcasterInterface_init(o);
2970 return (long)res_ptr;
2972 void __attribute__((visibility("default"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
2973 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2974 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2975 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
2976 LDKTransaction tx_ref;
2977 tx_ref.datalen = *((uint32_t*)tx);
2978 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
2979 memcpy(tx_ref.data, (uint8_t*)(tx + 4), tx_ref.datalen);
2980 tx_ref.data_is_owned = true;
2981 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
2984 typedef struct LDKKeysInterface_JCalls {
2985 atomic_size_t refcnt;
2986 uint32_t get_node_secret_meth;
2987 uint32_t get_destination_script_meth;
2988 uint32_t get_shutdown_scriptpubkey_meth;
2989 uint32_t get_channel_signer_meth;
2990 uint32_t get_secure_random_bytes_meth;
2991 uint32_t read_chan_signer_meth;
2992 uint32_t sign_invoice_meth;
2993 } LDKKeysInterface_JCalls;
2994 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2995 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2996 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2997 js_free(j_calls->get_node_secret_meth);
2998 js_free(j_calls->get_destination_script_meth);
2999 js_free(j_calls->get_shutdown_scriptpubkey_meth);
3000 js_free(j_calls->get_channel_signer_meth);
3001 js_free(j_calls->get_secure_random_bytes_meth);
3002 js_free(j_calls->read_chan_signer_meth);
3003 js_free(j_calls->sign_invoice_meth);
3007 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
3008 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3009 int8_tArray ret = js_invoke_function_0(j_calls->get_node_secret_meth);
3010 LDKSecretKey ret_ref;
3011 CHECK(*((uint32_t*)ret) == 32);
3012 memcpy(ret_ref.bytes, (uint8_t*)(ret + 4), 32);
3015 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
3016 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3017 int8_tArray ret = js_invoke_function_0(j_calls->get_destination_script_meth);
3018 LDKCVec_u8Z ret_ref;
3019 ret_ref.datalen = *((uint32_t*)ret);
3020 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3021 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
3024 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
3025 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3026 uint32_t ret = js_invoke_function_0(j_calls->get_shutdown_scriptpubkey_meth);
3027 LDKShutdownScript ret_conv;
3028 ret_conv.inner = (void*)(ret & (~1));
3029 ret_conv.is_owned = (ret & 1) || (ret == 0);
3030 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
3033 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
3034 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3035 uint32_t ret = js_invoke_function_2(j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
3036 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
3037 CHECK_ACCESS(ret_ptr);
3038 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
3042 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
3043 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3044 int8_tArray ret = js_invoke_function_0(j_calls->get_secure_random_bytes_meth);
3045 LDKThirtyTwoBytes ret_ref;
3046 CHECK(*((uint32_t*)ret) == 32);
3047 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
3050 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
3051 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3052 LDKu8slice reader_var = reader;
3053 int8_tArray reader_arr = init_arr(reader_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3054 memcpy((uint8_t*)(reader_arr + 4), reader_var.data, reader_var.datalen);
3055 uint32_t ret = js_invoke_function_1(j_calls->read_chan_signer_meth, reader_arr);
3056 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
3057 CHECK_ACCESS(ret_ptr);
3058 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
3062 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
3063 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3064 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
3065 int8_tArray invoice_preimage_arr = init_arr(invoice_preimage_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3066 memcpy((uint8_t*)(invoice_preimage_arr + 4), invoice_preimage_var.data, invoice_preimage_var.datalen);
3067 CVec_u8Z_free(invoice_preimage_var);
3068 uint32_t ret = js_invoke_function_1(j_calls->sign_invoice_meth, invoice_preimage_arr);
3069 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
3070 CHECK_ACCESS(ret_ptr);
3071 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
3075 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
3076 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
3077 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3079 static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Reference */void* o) {
3080 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
3081 atomic_init(&calls->refcnt, 1);
3082 //TODO: Assign calls->o from o
3084 LDKKeysInterface ret = {
3085 .this_arg = (void*) calls,
3086 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
3087 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
3088 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
3089 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
3090 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
3091 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
3092 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
3093 .free = LDKKeysInterface_JCalls_free,
3097 long __attribute__((visibility("default"))) TS_LDKKeysInterface_new(/*TODO: JS Object Reference */void* o) {
3098 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
3099 *res_ptr = LDKKeysInterface_init(o);
3100 return (long)res_ptr;
3102 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_node_secret(uint32_t this_arg) {
3103 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3104 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3105 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3106 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3107 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
3111 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
3112 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3113 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3114 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3115 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
3116 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3117 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3118 CVec_u8Z_free(ret_var);
3122 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint32_t this_arg) {
3123 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3124 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3125 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3126 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
3127 uint64_t ret_ref = 0;
3128 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3129 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3130 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3131 ret_ref = (uint64_t)ret_var.inner;
3132 if (ret_var.is_owned) {
3138 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
3139 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3140 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3141 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3142 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
3143 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
3144 return (uint64_t)ret_ret;
3147 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
3148 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3149 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3150 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3151 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3152 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
3156 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
3157 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3158 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3159 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3160 LDKu8slice reader_ref;
3161 reader_ref.datalen = *((uint32_t*)reader);
3162 reader_ref.data = (int8_t*)(reader + 4);
3163 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
3164 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
3165 return (uint64_t)ret_conv;
3168 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_sign_invoice(uint32_t this_arg, int8_tArray invoice_preimage) {
3169 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3170 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3171 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3172 LDKCVec_u8Z invoice_preimage_ref;
3173 invoice_preimage_ref.datalen = *((uint32_t*)invoice_preimage);
3174 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
3175 memcpy(invoice_preimage_ref.data, (uint8_t*)(invoice_preimage + 4), invoice_preimage_ref.datalen);
3176 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
3177 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
3178 return (uint64_t)ret_conv;
3181 typedef struct LDKFeeEstimator_JCalls {
3182 atomic_size_t refcnt;
3183 uint32_t get_est_sat_per_1000_weight_meth;
3184 } LDKFeeEstimator_JCalls;
3185 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
3186 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3187 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3188 js_free(j_calls->get_est_sat_per_1000_weight_meth);
3192 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
3193 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3194 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
3195 return js_invoke_function_1(j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
3197 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
3198 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
3199 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3201 static inline LDKFeeEstimator LDKFeeEstimator_init (/*TODO: JS Object Reference */void* o) {
3202 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
3203 atomic_init(&calls->refcnt, 1);
3204 //TODO: Assign calls->o from o
3206 LDKFeeEstimator ret = {
3207 .this_arg = (void*) calls,
3208 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
3209 .free = LDKFeeEstimator_JCalls_free,
3213 long __attribute__((visibility("default"))) TS_LDKFeeEstimator_new(/*TODO: JS Object Reference */void* o) {
3214 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
3215 *res_ptr = LDKFeeEstimator_init(o);
3216 return (long)res_ptr;
3218 int32_t __attribute__((visibility("default"))) TS_FeeEstimator_get_est_sat_per_1000_weight(uint32_t this_arg, uint32_t confirmation_target) {
3219 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3220 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3221 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
3222 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
3223 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
3227 typedef struct LDKLogger_JCalls {
3228 atomic_size_t refcnt;
3231 static void LDKLogger_JCalls_free(void* this_arg) {
3232 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3233 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3234 js_free(j_calls->log_meth);
3238 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
3239 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3240 LDKRecord record_var = *record;
3241 uint64_t record_ref = 0;
3242 record_var = Record_clone(record);
3243 CHECK((((uint64_t)record_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3244 CHECK((((uint64_t)&record_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3245 CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
3246 record_ref = (uint64_t)record_var.inner;
3247 if (record_var.is_owned) {
3250 js_invoke_function_1(j_calls->log_meth, record_ref);
3252 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
3253 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
3254 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3256 static inline LDKLogger LDKLogger_init (/*TODO: JS Object Reference */void* o) {
3257 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3258 atomic_init(&calls->refcnt, 1);
3259 //TODO: Assign calls->o from o
3262 .this_arg = (void*) calls,
3263 .log = log_LDKLogger_jcall,
3264 .free = LDKLogger_JCalls_free,
3268 long __attribute__((visibility("default"))) TS_LDKLogger_new(/*TODO: JS Object Reference */void* o) {
3269 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3270 *res_ptr = LDKLogger_init(o);
3271 return (long)res_ptr;
3273 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR tuple){
3274 return ThirtyTwoBytes_clone(&tuple->a);
3276 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint32_t tuple) {
3277 LDKC2Tuple_BlockHashChannelManagerZ* tuple_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(tuple & ~1);
3278 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3279 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_BlockHashChannelManagerZ_get_a(tuple_conv).data, 32);
3283 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR tuple){
3286 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint32_t tuple) {
3287 LDKC2Tuple_BlockHashChannelManagerZ* tuple_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(tuple & ~1);
3288 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(tuple_conv);
3289 uint64_t ret_ref = 0;
3290 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3291 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3292 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3293 ret_ref = (uint64_t)ret_var.inner & ~1;
3297 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t arg) {
3298 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3299 CHECK(val->result_ok);
3300 LDKC2Tuple_BlockHashChannelManagerZ* res_conv = &(*val->contents.result);
3301 // Warning: we really need to clone here, but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
3302 return ((uint64_t)res_conv) | 1;
3304 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t arg) {
3305 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3306 CHECK(!val->result_ok);
3307 LDKDecodeError err_var = (*val->contents.err);
3308 uint64_t err_ref = 0;
3309 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3310 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3311 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
3312 err_ref = (uint64_t)err_var.inner & ~1;
3315 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t arg) {
3316 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
3317 CHECK(val->result_ok);
3318 LDKChannelConfig res_var = (*val->contents.result);
3319 uint64_t res_ref = 0;
3320 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3321 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3322 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3323 res_ref = (uint64_t)res_var.inner & ~1;
3326 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_err(uint32_t arg) {
3327 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
3328 CHECK(!val->result_ok);
3329 LDKDecodeError err_var = (*val->contents.err);
3330 uint64_t err_ref = 0;
3331 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3332 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3333 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
3334 err_ref = (uint64_t)err_var.inner & ~1;
3337 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_ok(uint32_t arg) {
3338 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
3339 CHECK(val->result_ok);
3340 LDKOutPoint res_var = (*val->contents.result);
3341 uint64_t res_ref = 0;
3342 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3343 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3344 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3345 res_ref = (uint64_t)res_var.inner & ~1;
3348 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_err(uint32_t arg) {
3349 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
3350 CHECK(!val->result_ok);
3351 LDKDecodeError err_var = (*val->contents.err);
3352 uint64_t err_ref = 0;
3353 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3354 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3355 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
3356 err_ref = (uint64_t)err_var.inner & ~1;
3359 typedef struct LDKType_JCalls {
3360 atomic_size_t refcnt;
3361 uint32_t type_id_meth;
3362 uint32_t debug_str_meth;
3363 uint32_t write_meth;
3365 static void LDKType_JCalls_free(void* this_arg) {
3366 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3367 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3368 js_free(j_calls->type_id_meth);
3369 js_free(j_calls->debug_str_meth);
3370 js_free(j_calls->write_meth);
3374 uint16_t type_id_LDKType_jcall(const void* this_arg) {
3375 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3376 return js_invoke_function_0(j_calls->type_id_meth);
3378 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
3379 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3380 uint32_t ret = js_invoke_function_0(j_calls->debug_str_meth);
3381 LDKStr ret_conv = str_ref_to_owned_c(ret);
3384 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
3385 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3386 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
3387 LDKCVec_u8Z ret_ref;
3388 ret_ref.datalen = *((uint32_t*)ret);
3389 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3390 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
3393 static void LDKType_JCalls_cloned(LDKType* new_obj) {
3394 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
3395 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3397 static inline LDKType LDKType_init (/*TODO: JS Object Reference */void* o) {
3398 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
3399 atomic_init(&calls->refcnt, 1);
3400 //TODO: Assign calls->o from o
3403 .this_arg = (void*) calls,
3404 .type_id = type_id_LDKType_jcall,
3405 .debug_str = debug_str_LDKType_jcall,
3406 .write = write_LDKType_jcall,
3407 .cloned = LDKType_JCalls_cloned,
3408 .free = LDKType_JCalls_free,
3412 long __attribute__((visibility("default"))) TS_LDKType_new(/*TODO: JS Object Reference */void* o) {
3413 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
3414 *res_ptr = LDKType_init(o);
3415 return (long)res_ptr;
3417 int16_t __attribute__((visibility("default"))) TS_Type_type_id(uint32_t this_arg) {
3418 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3419 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3420 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
3421 int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
3425 jstring __attribute__((visibility("default"))) TS_Type_debug_str(uint32_t this_arg) {
3426 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3427 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3428 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
3429 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
3430 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
3435 int8_tArray __attribute__((visibility("default"))) TS_Type_write(uint32_t this_arg) {
3436 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3437 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3438 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
3439 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3440 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3441 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3442 CVec_u8Z_free(ret_var);
3446 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_TypeZ_ref_from_ptr(uint32_t ptr) {
3447 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
3449 case LDKCOption_TypeZ_Some: {
3450 LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
3451 *some_ret = Type_clone(&obj->some);
3452 return 0 /* LDKCOption_TypeZ - Some */; (void) (uint64_t)some_ret;
3454 case LDKCOption_TypeZ_None: {
3455 return 0 /* LDKCOption_TypeZ - None */;
3460 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_get_ok(uint32_t arg) {
3461 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
3462 CHECK(val->result_ok);
3463 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
3466 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_get_err(uint32_t arg) {
3467 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
3468 CHECK(!val->result_ok);
3469 LDKDecodeError err_var = (*val->contents.err);
3470 uint64_t err_ref = 0;
3471 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3472 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3473 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
3474 err_ref = (uint64_t)err_var.inner & ~1;
3477 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentError_ref_from_ptr(uint32_t ptr) {
3478 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
3480 case LDKPaymentError_Invoice: {
3481 LDKStr invoice_str = obj->invoice;
3482 jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
3483 return 0 /* LDKPaymentError - Invoice */; (void) invoice_conv;
3485 case LDKPaymentError_Routing: {
3486 LDKLightningError routing_var = obj->routing;
3487 uint64_t routing_ref = 0;
3488 CHECK((((uint64_t)routing_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3489 CHECK((((uint64_t)&routing_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3490 CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
3491 routing_ref = (uint64_t)routing_var.inner & ~1;
3492 return 0 /* LDKPaymentError - Routing */; (void) routing_ref;
3494 case LDKPaymentError_Sending: {
3495 uint64_t sending_ref = ((uint64_t)&obj->sending) | 1;
3496 return 0 /* LDKPaymentError - Sending */; (void) sending_ref;
3501 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentErrorZ_get_ok(uint32_t arg) {
3502 LDKCResult_PaymentIdPaymentErrorZ *val = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
3503 CHECK(val->result_ok);
3504 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3505 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
3508 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentErrorZ_get_err(uint32_t arg) {
3509 LDKCResult_PaymentIdPaymentErrorZ *val = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
3510 CHECK(!val->result_ok);
3511 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3514 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_get_ok(uint32_t arg) {
3515 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
3516 CHECK(val->result_ok);
3517 uint32_t res_conv = LDKSiPrefix_to_js((*val->contents.result));
3520 void __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_get_err(uint32_t arg) {
3521 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
3522 CHECK(!val->result_ok);
3523 return *val->contents.err;
3525 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_get_ok(uint32_t arg) {
3526 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
3527 CHECK(val->result_ok);
3528 LDKInvoice res_var = (*val->contents.result);
3529 uint64_t res_ref = 0;
3530 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3531 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3532 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3533 res_ref = (uint64_t)res_var.inner & ~1;
3536 void __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_get_err(uint32_t arg) {
3537 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
3538 CHECK(!val->result_ok);
3539 return *val->contents.err;
3541 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_get_ok(uint32_t arg) {
3542 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
3543 CHECK(val->result_ok);
3544 LDKSignedRawInvoice res_var = (*val->contents.result);
3545 uint64_t res_ref = 0;
3546 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3547 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3548 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3549 res_ref = (uint64_t)res_var.inner & ~1;
3552 void __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_get_err(uint32_t arg) {
3553 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
3554 CHECK(!val->result_ok);
3555 return *val->contents.err;
3557 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
3558 return RawInvoice_clone(&tuple->a);
3560 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint32_t tuple) {
3561 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
3562 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(tuple_conv);
3563 uint64_t ret_ref = 0;
3564 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3565 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3566 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3567 ret_ref = (uint64_t)ret_var.inner;
3568 if (ret_var.is_owned) {
3574 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
3575 return ThirtyTwoBytes_clone(&tuple->b);
3577 int8_tArray __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint32_t tuple) {
3578 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
3579 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3580 memcpy((uint8_t*)(ret_arr + 4), C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(tuple_conv).data, 32);
3584 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
3585 return InvoiceSignature_clone(&tuple->c);
3587 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint32_t tuple) {
3588 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
3589 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(tuple_conv);
3590 uint64_t ret_ref = 0;
3591 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3592 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3593 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3594 ret_ref = (uint64_t)ret_var.inner;
3595 if (ret_var.is_owned) {
3601 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_get_ok(uint32_t arg) {
3602 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
3603 CHECK(val->result_ok);
3604 LDKPayeePubKey res_var = (*val->contents.result);
3605 uint64_t res_ref = 0;
3606 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3607 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3608 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3609 res_ref = (uint64_t)res_var.inner & ~1;
3612 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_get_err(uint32_t arg) {
3613 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
3614 CHECK(!val->result_ok);
3615 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
3618 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
3619 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
3620 for (size_t i = 0; i < ret.datalen; i++) {
3621 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
3625 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_get_ok(uint32_t arg) {
3626 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
3627 CHECK(val->result_ok);
3628 LDKPositiveTimestamp res_var = (*val->contents.result);
3629 uint64_t res_ref = 0;
3630 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3631 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3632 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3633 res_ref = (uint64_t)res_var.inner & ~1;
3636 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_get_err(uint32_t arg) {
3637 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
3638 CHECK(!val->result_ok);
3639 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3642 void __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_get_ok(uint32_t arg) {
3643 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
3644 CHECK(val->result_ok);
3645 return *val->contents.result;
3647 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_get_err(uint32_t arg) {
3648 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
3649 CHECK(!val->result_ok);
3650 uint32_t err_conv = LDKSemanticError_to_js((*val->contents.err));
3653 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_get_ok(uint32_t arg) {
3654 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
3655 CHECK(val->result_ok);
3656 LDKInvoice res_var = (*val->contents.result);
3657 uint64_t res_ref = 0;
3658 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3659 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3660 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3661 res_ref = (uint64_t)res_var.inner & ~1;
3664 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_get_err(uint32_t arg) {
3665 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
3666 CHECK(!val->result_ok);
3667 uint32_t err_conv = LDKSemanticError_to_js((*val->contents.err));
3670 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_get_ok(uint32_t arg) {
3671 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
3672 CHECK(val->result_ok);
3673 LDKDescription res_var = (*val->contents.result);
3674 uint64_t res_ref = 0;
3675 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3676 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3677 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3678 res_ref = (uint64_t)res_var.inner & ~1;
3681 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_get_err(uint32_t arg) {
3682 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
3683 CHECK(!val->result_ok);
3684 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3687 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_get_ok(uint32_t arg) {
3688 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
3689 CHECK(val->result_ok);
3690 LDKExpiryTime res_var = (*val->contents.result);
3691 uint64_t res_ref = 0;
3692 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3693 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3694 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3695 res_ref = (uint64_t)res_var.inner & ~1;
3698 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_get_err(uint32_t arg) {
3699 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
3700 CHECK(!val->result_ok);
3701 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3704 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_get_ok(uint32_t arg) {
3705 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
3706 CHECK(val->result_ok);
3707 LDKPrivateRoute res_var = (*val->contents.result);
3708 uint64_t res_ref = 0;
3709 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3710 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3711 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3712 res_ref = (uint64_t)res_var.inner & ~1;
3715 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_get_err(uint32_t arg) {
3716 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
3717 CHECK(!val->result_ok);
3718 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3721 jstring __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_get_ok(uint32_t arg) {
3722 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
3723 CHECK(val->result_ok);
3724 LDKStr res_str = (*val->contents.result);
3725 jstring res_conv = str_ref_to_ts(res_str.chars, res_str.len);
3728 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_get_err(uint32_t arg) {
3729 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
3730 CHECK(!val->result_ok);
3731 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
3734 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3735 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
3736 CHECK(val->result_ok);
3737 LDKChannelMonitorUpdate res_var = (*val->contents.result);
3738 uint64_t res_ref = 0;
3739 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3740 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3741 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3742 res_ref = (uint64_t)res_var.inner & ~1;
3745 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t arg) {
3746 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
3747 CHECK(!val->result_ok);
3748 LDKDecodeError err_var = (*val->contents.err);
3749 uint64_t err_ref = 0;
3750 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3751 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3752 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
3753 err_ref = (uint64_t)err_var.inner & ~1;
3756 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_MonitorEventZ_ref_from_ptr(uint32_t ptr) {
3757 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
3759 case LDKCOption_MonitorEventZ_Some: {
3760 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
3761 return 0 /* LDKCOption_MonitorEventZ - Some */; (void) some_ref;
3763 case LDKCOption_MonitorEventZ_None: {
3764 return 0 /* LDKCOption_MonitorEventZ - None */;
3769 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint32_t arg) {
3770 LDKCResult_COption_MonitorEventZDecodeErrorZ *val = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
3771 CHECK(val->result_ok);
3772 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
3775 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_MonitorEventZDecodeErrorZ_get_err(uint32_t arg) {
3776 LDKCResult_COption_MonitorEventZDecodeErrorZ *val = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
3777 CHECK(!val->result_ok);
3778 LDKDecodeError err_var = (*val->contents.err);
3779 uint64_t err_ref = 0;
3780 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3781 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3782 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
3783 err_ref = (uint64_t)err_var.inner & ~1;
3786 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3787 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
3788 CHECK(val->result_ok);
3789 LDKHTLCUpdate res_var = (*val->contents.result);
3790 uint64_t res_ref = 0;
3791 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3792 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3793 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
3794 res_ref = (uint64_t)res_var.inner & ~1;
3797 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t arg) {
3798 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
3799 CHECK(!val->result_ok);
3800 LDKDecodeError err_var = (*val->contents.err);
3801 uint64_t err_ref = 0;
3802 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3803 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3804 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
3805 err_ref = (uint64_t)err_var.inner & ~1;
3808 void __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_ok(uint32_t arg) {
3809 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
3810 CHECK(val->result_ok);
3811 return *val->contents.result;
3813 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_err(uint32_t arg) {
3814 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
3815 CHECK(!val->result_ok);
3816 LDKMonitorUpdateError err_var = (*val->contents.err);
3817 uint64_t err_ref = 0;
3818 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3819 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3820 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
3821 err_ref = (uint64_t)err_var.inner & ~1;
3824 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){
3825 return OutPoint_clone(&tuple->a);
3827 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_get_a(uint32_t tuple) {
3828 LDKC2Tuple_OutPointScriptZ* tuple_conv = (LDKC2Tuple_OutPointScriptZ*)(tuple & ~1);
3829 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(tuple_conv);
3830 uint64_t ret_ref = 0;
3831 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3832 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3833 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3834 ret_ref = (uint64_t)ret_var.inner;
3835 if (ret_var.is_owned) {
3841 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){
3842 return CVec_u8Z_clone(&tuple->b);
3844 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_get_b(uint32_t tuple) {
3845 LDKC2Tuple_OutPointScriptZ* tuple_conv = (LDKC2Tuple_OutPointScriptZ*)(tuple & ~1);
3846 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(tuple_conv);
3847 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3848 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3849 CVec_u8Z_free(ret_var);
3853 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR tuple){
3856 int32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_get_a(uint32_t tuple) {
3857 LDKC2Tuple_u32ScriptZ* tuple_conv = (LDKC2Tuple_u32ScriptZ*)(tuple & ~1);
3858 int32_t ret_val = C2Tuple_u32ScriptZ_get_a(tuple_conv);
3862 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR tuple){
3863 return CVec_u8Z_clone(&tuple->b);
3865 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_get_b(uint32_t tuple) {
3866 LDKC2Tuple_u32ScriptZ* tuple_conv = (LDKC2Tuple_u32ScriptZ*)(tuple & ~1);
3867 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(tuple_conv);
3868 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3869 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3870 CVec_u8Z_free(ret_var);
3874 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
3875 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
3876 for (size_t i = 0; i < ret.datalen; i++) {
3877 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
3881 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR tuple){
3882 return ThirtyTwoBytes_clone(&tuple->a);
3884 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint32_t tuple) {
3885 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(tuple & ~1);
3886 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3887 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(tuple_conv).data, 32);
3891 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR tuple){
3892 return CVec_C2Tuple_u32ScriptZZ_clone(&tuple->b);
3894 uint32_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint32_t tuple) {
3895 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(tuple & ~1);
3896 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(tuple_conv);
3897 uint32_tArray ret_arr = NULL;
3898 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3899 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
3900 for (size_t v = 0; v < ret_var.datalen; v++) {
3901 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
3902 *ret_conv_21_conv = ret_var.data[v];
3903 ret_arr_ptr[v] = ((uint64_t)ret_conv_21_conv);
3910 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
3911 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 };
3912 for (size_t i = 0; i < ret.datalen; i++) {
3913 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
3917 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
3918 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
3919 for (size_t i = 0; i < ret.datalen; i++) {
3920 ret.data[i] = Event_clone(&orig->data[i]);
3924 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR tuple){
3927 int32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_get_a(uint32_t tuple) {
3928 LDKC2Tuple_u32TxOutZ* tuple_conv = (LDKC2Tuple_u32TxOutZ*)(tuple & ~1);
3929 int32_t ret_val = C2Tuple_u32TxOutZ_get_a(tuple_conv);
3933 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR tuple){
3934 return TxOut_clone(&tuple->b);
3936 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_get_b(uint32_t tuple) {
3937 LDKC2Tuple_u32TxOutZ* tuple_conv = (LDKC2Tuple_u32TxOutZ*)(tuple & ~1);
3938 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3939 *ret_ref = C2Tuple_u32TxOutZ_get_b(tuple_conv);
3940 return (uint64_t)ret_ref;
3943 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
3944 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
3945 for (size_t i = 0; i < ret.datalen; i++) {
3946 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
3950 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR tuple){
3951 return ThirtyTwoBytes_clone(&tuple->a);
3953 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t tuple) {
3954 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(tuple & ~1);
3955 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3956 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(tuple_conv).data, 32);
3960 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR tuple){
3961 return CVec_C2Tuple_u32TxOutZZ_clone(&tuple->b);
3963 uint32_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t tuple) {
3964 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(tuple & ~1);
3965 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(tuple_conv);
3966 uint32_tArray ret_arr = NULL;
3967 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3968 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
3969 for (size_t u = 0; u < ret_var.datalen; u++) {
3970 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
3971 *ret_conv_20_conv = ret_var.data[u];
3972 ret_arr_ptr[u] = ((uint64_t)ret_conv_20_conv);
3979 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
3980 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 };
3981 for (size_t i = 0; i < ret.datalen; i++) {
3982 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
3986 uint32_t __attribute__((visibility("default"))) TS_LDKBalance_ref_from_ptr(uint32_t ptr) {
3987 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
3989 case LDKBalance_ClaimableOnChannelClose: {
3990 return 0 /* LDKBalance - ClaimableOnChannelClose */; (void) obj->claimable_on_channel_close.claimable_amount_satoshis;
3992 case LDKBalance_ClaimableAwaitingConfirmations: {
3993 return 0 /* LDKBalance - ClaimableAwaitingConfirmations */; (void) obj->claimable_awaiting_confirmations.claimable_amount_satoshis; (void) obj->claimable_awaiting_confirmations.confirmation_height;
3995 case LDKBalance_ContentiousClaimable: {
3996 return 0 /* LDKBalance - ContentiousClaimable */; (void) obj->contentious_claimable.claimable_amount_satoshis; (void) obj->contentious_claimable.timeout_height;
3998 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
3999 return 0 /* LDKBalance - MaybeClaimableHTLCAwaitingTimeout */; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
4004 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
4005 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
4006 for (size_t i = 0; i < ret.datalen; i++) {
4007 ret.data[i] = Balance_clone(&orig->data[i]);
4011 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t arg) {
4012 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
4013 CHECK(val->result_ok);
4014 LDKC2Tuple_BlockHashChannelMonitorZ* res_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
4015 *res_conv = (*val->contents.result);
4016 *res_conv = C2Tuple_BlockHashChannelMonitorZ_clone(res_conv);
4017 return ((uint64_t)res_conv);
4019 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t arg) {
4020 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
4021 CHECK(!val->result_ok);
4022 LDKDecodeError err_var = (*val->contents.err);
4023 uint64_t err_ref = 0;
4024 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4025 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4026 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4027 err_ref = (uint64_t)err_var.inner & ~1;
4030 void __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_ok(uint32_t arg) {
4031 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4032 CHECK(val->result_ok);
4033 return *val->contents.result;
4035 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_err(uint32_t arg) {
4036 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4037 CHECK(!val->result_ok);
4038 LDKLightningError err_var = (*val->contents.err);
4039 uint64_t err_ref = 0;
4040 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4041 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4042 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4043 err_ref = (uint64_t)err_var.inner & ~1;
4046 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR tuple){
4049 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint32_t tuple) {
4050 LDKC2Tuple_PublicKeyTypeZ* tuple_conv = (LDKC2Tuple_PublicKeyTypeZ*)(tuple & ~1);
4051 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4052 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PublicKeyTypeZ_get_a(tuple_conv).compressed_form, 33);
4056 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR tuple){
4057 return Type_clone(&tuple->b);
4059 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint32_t tuple) {
4060 LDKC2Tuple_PublicKeyTypeZ* tuple_conv = (LDKC2Tuple_PublicKeyTypeZ*)(tuple & ~1);
4061 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
4062 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(tuple_conv);
4063 return (uint64_t)ret_ret;
4066 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
4067 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
4068 for (size_t i = 0; i < ret.datalen; i++) {
4069 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
4073 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_ok(uint32_t arg) {
4074 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4075 CHECK(val->result_ok);
4076 return *val->contents.result;
4078 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_err(uint32_t arg) {
4079 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4080 CHECK(!val->result_ok);
4081 LDKLightningError err_var = (*val->contents.err);
4082 uint64_t err_ref = 0;
4083 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4084 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4085 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4086 err_ref = (uint64_t)err_var.inner & ~1;
4089 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
4090 return ChannelAnnouncement_clone(&tuple->a);
4092 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t tuple) {
4093 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
4094 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(tuple_conv);
4095 uint64_t ret_ref = 0;
4096 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4097 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4098 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4099 ret_ref = (uint64_t)ret_var.inner;
4100 if (ret_var.is_owned) {
4106 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
4107 return ChannelUpdate_clone(&tuple->b);
4109 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t tuple) {
4110 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
4111 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(tuple_conv);
4112 uint64_t ret_ref = 0;
4113 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4114 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4115 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4116 ret_ref = (uint64_t)ret_var.inner;
4117 if (ret_var.is_owned) {
4123 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
4124 return ChannelUpdate_clone(&tuple->c);
4126 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t tuple) {
4127 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
4128 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(tuple_conv);
4129 uint64_t ret_ref = 0;
4130 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4131 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4132 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4133 ret_ref = (uint64_t)ret_var.inner;
4134 if (ret_var.is_owned) {
4140 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
4141 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
4142 for (size_t i = 0; i < ret.datalen; i++) {
4143 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
4147 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
4148 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
4149 for (size_t i = 0; i < ret.datalen; i++) {
4150 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
4154 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t arg) {
4155 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4156 CHECK(val->result_ok);
4157 LDKCVec_u8Z res_var = (*val->contents.result);
4158 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
4159 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
4162 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t arg) {
4163 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4164 CHECK(!val->result_ok);
4165 LDKPeerHandleError err_var = (*val->contents.err);
4166 uint64_t err_ref = 0;
4167 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4168 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4169 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4170 err_ref = (uint64_t)err_var.inner & ~1;
4173 void __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_ok(uint32_t arg) {
4174 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4175 CHECK(val->result_ok);
4176 return *val->contents.result;
4178 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_err(uint32_t arg) {
4179 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4180 CHECK(!val->result_ok);
4181 LDKPeerHandleError err_var = (*val->contents.err);
4182 uint64_t err_ref = 0;
4183 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4184 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4185 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4186 err_ref = (uint64_t)err_var.inner & ~1;
4189 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_ok(uint32_t arg) {
4190 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4191 CHECK(val->result_ok);
4192 return *val->contents.result;
4194 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_err(uint32_t arg) {
4195 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4196 CHECK(!val->result_ok);
4197 LDKPeerHandleError err_var = (*val->contents.err);
4198 uint64_t err_ref = 0;
4199 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4200 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4201 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4202 err_ref = (uint64_t)err_var.inner & ~1;
4205 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeIdDecodeErrorZ_get_ok(uint32_t arg) {
4206 LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
4207 CHECK(val->result_ok);
4208 LDKNodeId res_var = (*val->contents.result);
4209 uint64_t res_ref = 0;
4210 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4211 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4212 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4213 res_ref = (uint64_t)res_var.inner & ~1;
4216 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeIdDecodeErrorZ_get_err(uint32_t arg) {
4217 LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
4218 CHECK(!val->result_ok);
4219 LDKDecodeError err_var = (*val->contents.err);
4220 uint64_t err_ref = 0;
4221 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4222 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4223 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4224 err_ref = (uint64_t)err_var.inner & ~1;
4227 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint32_t arg) {
4228 LDKCResult_COption_NetworkUpdateZDecodeErrorZ *val = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
4229 CHECK(val->result_ok);
4230 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
4233 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint32_t arg) {
4234 LDKCResult_COption_NetworkUpdateZDecodeErrorZ *val = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
4235 CHECK(!val->result_ok);
4236 LDKDecodeError err_var = (*val->contents.err);
4237 uint64_t err_ref = 0;
4238 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4239 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4240 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4241 err_ref = (uint64_t)err_var.inner & ~1;
4244 typedef struct LDKAccess_JCalls {
4245 atomic_size_t refcnt;
4246 uint32_t get_utxo_meth;
4248 static void LDKAccess_JCalls_free(void* this_arg) {
4249 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4250 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4251 js_free(j_calls->get_utxo_meth);
4255 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
4256 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4257 int8_tArray genesis_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4258 memcpy((uint8_t*)(genesis_hash_arr + 4), *genesis_hash, 32);
4259 uint32_t ret = js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
4260 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
4261 CHECK_ACCESS(ret_ptr);
4262 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
4266 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
4267 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
4268 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4270 static inline LDKAccess LDKAccess_init (/*TODO: JS Object Reference */void* o) {
4271 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
4272 atomic_init(&calls->refcnt, 1);
4273 //TODO: Assign calls->o from o
4276 .this_arg = (void*) calls,
4277 .get_utxo = get_utxo_LDKAccess_jcall,
4278 .free = LDKAccess_JCalls_free,
4282 long __attribute__((visibility("default"))) TS_LDKAccess_new(/*TODO: JS Object Reference */void* o) {
4283 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
4284 *res_ptr = LDKAccess_init(o);
4285 return (long)res_ptr;
4287 uint32_t __attribute__((visibility("default"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
4288 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4289 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4290 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
4291 unsigned char genesis_hash_arr[32];
4292 CHECK(*((uint32_t*)genesis_hash) == 32);
4293 memcpy(genesis_hash_arr, (uint8_t*)(genesis_hash + 4), 32);
4294 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
4295 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4296 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
4297 return (uint64_t)ret_conv;
4300 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_AccessZ_ref_from_ptr(uint32_t ptr) {
4301 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
4303 case LDKCOption_AccessZ_Some: {
4304 LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
4305 *some_ret = obj->some;
4306 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
4307 return 0 /* LDKCOption_AccessZ - Some */; (void) (uint64_t)some_ret;
4309 case LDKCOption_AccessZ_None: {
4310 return 0 /* LDKCOption_AccessZ - None */;
4315 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
4316 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4317 CHECK(val->result_ok);
4318 LDKDirectionalChannelInfo res_var = (*val->contents.result);
4319 uint64_t res_ref = 0;
4320 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4321 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4322 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4323 res_ref = (uint64_t)res_var.inner & ~1;
4326 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
4327 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4328 CHECK(!val->result_ok);
4329 LDKDecodeError err_var = (*val->contents.err);
4330 uint64_t err_ref = 0;
4331 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4332 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4333 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4334 err_ref = (uint64_t)err_var.inner & ~1;
4337 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
4338 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4339 CHECK(val->result_ok);
4340 LDKChannelInfo res_var = (*val->contents.result);
4341 uint64_t res_ref = 0;
4342 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4343 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4344 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4345 res_ref = (uint64_t)res_var.inner & ~1;
4348 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
4349 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4350 CHECK(!val->result_ok);
4351 LDKDecodeError err_var = (*val->contents.err);
4352 uint64_t err_ref = 0;
4353 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4354 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4355 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4356 err_ref = (uint64_t)err_var.inner & ~1;
4359 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t arg) {
4360 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4361 CHECK(val->result_ok);
4362 LDKRoutingFees res_var = (*val->contents.result);
4363 uint64_t res_ref = 0;
4364 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4365 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4366 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4367 res_ref = (uint64_t)res_var.inner & ~1;
4370 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_err(uint32_t arg) {
4371 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4372 CHECK(!val->result_ok);
4373 LDKDecodeError err_var = (*val->contents.err);
4374 uint64_t err_ref = 0;
4375 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4376 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4377 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4378 err_ref = (uint64_t)err_var.inner & ~1;
4381 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t arg) {
4382 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
4383 CHECK(val->result_ok);
4384 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
4385 uint64_t res_ref = 0;
4386 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4387 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4388 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4389 res_ref = (uint64_t)res_var.inner & ~1;
4392 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t arg) {
4393 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
4394 CHECK(!val->result_ok);
4395 LDKDecodeError err_var = (*val->contents.err);
4396 uint64_t err_ref = 0;
4397 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4398 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4399 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4400 err_ref = (uint64_t)err_var.inner & ~1;
4403 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
4404 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
4405 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
4408 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_ok(uint32_t arg) {
4409 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
4410 CHECK(val->result_ok);
4411 LDKNodeInfo res_var = (*val->contents.result);
4412 uint64_t res_ref = 0;
4413 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4414 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4415 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4416 res_ref = (uint64_t)res_var.inner & ~1;
4419 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_err(uint32_t arg) {
4420 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
4421 CHECK(!val->result_ok);
4422 LDKDecodeError err_var = (*val->contents.err);
4423 uint64_t err_ref = 0;
4424 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4425 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4426 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4427 err_ref = (uint64_t)err_var.inner & ~1;
4430 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t arg) {
4431 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
4432 CHECK(val->result_ok);
4433 LDKNetworkGraph res_var = (*val->contents.result);
4434 uint64_t res_ref = 0;
4435 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4436 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4437 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4438 res_ref = (uint64_t)res_var.inner & ~1;
4441 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_err(uint32_t arg) {
4442 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
4443 CHECK(!val->result_ok);
4444 LDKDecodeError err_var = (*val->contents.err);
4445 uint64_t err_ref = 0;
4446 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4447 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4448 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4449 err_ref = (uint64_t)err_var.inner & ~1;
4452 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_CVec_NetAddressZZ_ref_from_ptr(uint32_t ptr) {
4453 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
4455 case LDKCOption_CVec_NetAddressZZ_Some: {
4456 LDKCVec_NetAddressZ some_var = obj->some;
4457 uint32_tArray some_arr = NULL;
4458 some_arr = init_arr(some_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
4459 uint32_t *some_arr_ptr = (uint32_t*)(some_arr + 4);
4460 for (size_t m = 0; m < some_var.datalen; m++) {
4461 uint64_t some_conv_12_ref = ((uint64_t)&some_var.data[m]) | 1;
4462 some_arr_ptr[m] = some_conv_12_ref;
4465 return 0 /* LDKCOption_CVec_NetAddressZZ - Some */; (void) some_arr;
4467 case LDKCOption_CVec_NetAddressZZ_None: {
4468 return 0 /* LDKCOption_CVec_NetAddressZZ - None */;
4473 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_get_ok(uint32_t arg) {
4474 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
4475 CHECK(val->result_ok);
4476 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
4479 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_get_err(uint32_t arg) {
4480 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
4481 CHECK(!val->result_ok);
4482 LDKDecodeError err_var = (*val->contents.err);
4483 uint64_t err_ref = 0;
4484 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4485 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4486 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4487 err_ref = (uint64_t)err_var.inner & ~1;
4490 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
4491 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
4492 for (size_t i = 0; i < ret.datalen; i++) {
4493 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
4497 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
4498 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
4499 for (size_t i = 0; i < ret.datalen; i++) {
4500 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
4504 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
4505 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
4506 for (size_t i = 0; i < ret.datalen; i++) {
4507 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
4511 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
4512 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
4513 for (size_t i = 0; i < ret.datalen; i++) {
4514 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
4518 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t arg) {
4519 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
4520 CHECK(val->result_ok);
4521 LDKAcceptChannel res_var = (*val->contents.result);
4522 uint64_t res_ref = 0;
4523 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4524 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4525 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4526 res_ref = (uint64_t)res_var.inner & ~1;
4529 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_err(uint32_t arg) {
4530 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
4531 CHECK(!val->result_ok);
4532 LDKDecodeError err_var = (*val->contents.err);
4533 uint64_t err_ref = 0;
4534 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4535 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4536 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4537 err_ref = (uint64_t)err_var.inner & ~1;
4540 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t arg) {
4541 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
4542 CHECK(val->result_ok);
4543 LDKAnnouncementSignatures res_var = (*val->contents.result);
4544 uint64_t res_ref = 0;
4545 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4546 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4547 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4548 res_ref = (uint64_t)res_var.inner & ~1;
4551 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t arg) {
4552 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
4553 CHECK(!val->result_ok);
4554 LDKDecodeError err_var = (*val->contents.err);
4555 uint64_t err_ref = 0;
4556 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4557 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4558 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4559 err_ref = (uint64_t)err_var.inner & ~1;
4562 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t arg) {
4563 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
4564 CHECK(val->result_ok);
4565 LDKChannelReestablish res_var = (*val->contents.result);
4566 uint64_t res_ref = 0;
4567 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4568 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4569 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4570 res_ref = (uint64_t)res_var.inner & ~1;
4573 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t arg) {
4574 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
4575 CHECK(!val->result_ok);
4576 LDKDecodeError err_var = (*val->contents.err);
4577 uint64_t err_ref = 0;
4578 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4579 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4580 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4581 err_ref = (uint64_t)err_var.inner & ~1;
4584 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t arg) {
4585 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4586 CHECK(val->result_ok);
4587 LDKClosingSigned res_var = (*val->contents.result);
4588 uint64_t res_ref = 0;
4589 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4590 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4591 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4592 res_ref = (uint64_t)res_var.inner & ~1;
4595 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_err(uint32_t arg) {
4596 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4597 CHECK(!val->result_ok);
4598 LDKDecodeError err_var = (*val->contents.err);
4599 uint64_t err_ref = 0;
4600 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4601 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4602 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4603 err_ref = (uint64_t)err_var.inner & ~1;
4606 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint32_t arg) {
4607 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
4608 CHECK(val->result_ok);
4609 LDKClosingSignedFeeRange res_var = (*val->contents.result);
4610 uint64_t res_ref = 0;
4611 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4612 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4613 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4614 res_ref = (uint64_t)res_var.inner & ~1;
4617 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint32_t arg) {
4618 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
4619 CHECK(!val->result_ok);
4620 LDKDecodeError err_var = (*val->contents.err);
4621 uint64_t err_ref = 0;
4622 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4623 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4624 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4625 err_ref = (uint64_t)err_var.inner & ~1;
4628 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t arg) {
4629 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4630 CHECK(val->result_ok);
4631 LDKCommitmentSigned res_var = (*val->contents.result);
4632 uint64_t res_ref = 0;
4633 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4634 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4635 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4636 res_ref = (uint64_t)res_var.inner & ~1;
4639 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t arg) {
4640 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4641 CHECK(!val->result_ok);
4642 LDKDecodeError err_var = (*val->contents.err);
4643 uint64_t err_ref = 0;
4644 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4645 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4646 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4647 err_ref = (uint64_t)err_var.inner & ~1;
4650 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t arg) {
4651 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4652 CHECK(val->result_ok);
4653 LDKFundingCreated res_var = (*val->contents.result);
4654 uint64_t res_ref = 0;
4655 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4656 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4657 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4658 res_ref = (uint64_t)res_var.inner & ~1;
4661 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_err(uint32_t arg) {
4662 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4663 CHECK(!val->result_ok);
4664 LDKDecodeError err_var = (*val->contents.err);
4665 uint64_t err_ref = 0;
4666 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4667 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4668 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4669 err_ref = (uint64_t)err_var.inner & ~1;
4672 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_ok(uint32_t arg) {
4673 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4674 CHECK(val->result_ok);
4675 LDKFundingSigned res_var = (*val->contents.result);
4676 uint64_t res_ref = 0;
4677 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4678 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4679 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4680 res_ref = (uint64_t)res_var.inner & ~1;
4683 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_err(uint32_t arg) {
4684 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4685 CHECK(!val->result_ok);
4686 LDKDecodeError err_var = (*val->contents.err);
4687 uint64_t err_ref = 0;
4688 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4689 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4690 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4691 err_ref = (uint64_t)err_var.inner & ~1;
4694 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_ok(uint32_t arg) {
4695 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4696 CHECK(val->result_ok);
4697 LDKFundingLocked res_var = (*val->contents.result);
4698 uint64_t res_ref = 0;
4699 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4700 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4701 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4702 res_ref = (uint64_t)res_var.inner & ~1;
4705 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_err(uint32_t arg) {
4706 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4707 CHECK(!val->result_ok);
4708 LDKDecodeError err_var = (*val->contents.err);
4709 uint64_t err_ref = 0;
4710 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4711 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4712 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4713 err_ref = (uint64_t)err_var.inner & ~1;
4716 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_ok(uint32_t arg) {
4717 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4718 CHECK(val->result_ok);
4719 LDKInit res_var = (*val->contents.result);
4720 uint64_t res_ref = 0;
4721 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4722 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4723 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4724 res_ref = (uint64_t)res_var.inner & ~1;
4727 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_err(uint32_t arg) {
4728 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4729 CHECK(!val->result_ok);
4730 LDKDecodeError err_var = (*val->contents.err);
4731 uint64_t err_ref = 0;
4732 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4733 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4734 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4735 err_ref = (uint64_t)err_var.inner & ~1;
4738 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_ok(uint32_t arg) {
4739 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4740 CHECK(val->result_ok);
4741 LDKOpenChannel res_var = (*val->contents.result);
4742 uint64_t res_ref = 0;
4743 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4744 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4745 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4746 res_ref = (uint64_t)res_var.inner & ~1;
4749 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_err(uint32_t arg) {
4750 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4751 CHECK(!val->result_ok);
4752 LDKDecodeError err_var = (*val->contents.err);
4753 uint64_t err_ref = 0;
4754 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4755 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4756 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4757 err_ref = (uint64_t)err_var.inner & ~1;
4760 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t arg) {
4761 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4762 CHECK(val->result_ok);
4763 LDKRevokeAndACK res_var = (*val->contents.result);
4764 uint64_t res_ref = 0;
4765 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4766 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4767 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4768 res_ref = (uint64_t)res_var.inner & ~1;
4771 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t arg) {
4772 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4773 CHECK(!val->result_ok);
4774 LDKDecodeError err_var = (*val->contents.err);
4775 uint64_t err_ref = 0;
4776 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4777 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4778 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4779 err_ref = (uint64_t)err_var.inner & ~1;
4782 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_ok(uint32_t arg) {
4783 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4784 CHECK(val->result_ok);
4785 LDKShutdown res_var = (*val->contents.result);
4786 uint64_t res_ref = 0;
4787 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4788 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4789 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4790 res_ref = (uint64_t)res_var.inner & ~1;
4793 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_err(uint32_t arg) {
4794 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4795 CHECK(!val->result_ok);
4796 LDKDecodeError err_var = (*val->contents.err);
4797 uint64_t err_ref = 0;
4798 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4799 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4800 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4801 err_ref = (uint64_t)err_var.inner & ~1;
4804 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4805 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4806 CHECK(val->result_ok);
4807 LDKUpdateFailHTLC res_var = (*val->contents.result);
4808 uint64_t res_ref = 0;
4809 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4810 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4811 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4812 res_ref = (uint64_t)res_var.inner & ~1;
4815 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t arg) {
4816 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4817 CHECK(!val->result_ok);
4818 LDKDecodeError err_var = (*val->contents.err);
4819 uint64_t err_ref = 0;
4820 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4821 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4822 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4823 err_ref = (uint64_t)err_var.inner & ~1;
4826 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4827 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
4828 CHECK(val->result_ok);
4829 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
4830 uint64_t res_ref = 0;
4831 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4832 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4833 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4834 res_ref = (uint64_t)res_var.inner & ~1;
4837 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t arg) {
4838 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
4839 CHECK(!val->result_ok);
4840 LDKDecodeError err_var = (*val->contents.err);
4841 uint64_t err_ref = 0;
4842 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4843 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4844 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4845 err_ref = (uint64_t)err_var.inner & ~1;
4848 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t arg) {
4849 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
4850 CHECK(val->result_ok);
4851 LDKUpdateFee res_var = (*val->contents.result);
4852 uint64_t res_ref = 0;
4853 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4854 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4855 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4856 res_ref = (uint64_t)res_var.inner & ~1;
4859 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_err(uint32_t arg) {
4860 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
4861 CHECK(!val->result_ok);
4862 LDKDecodeError err_var = (*val->contents.err);
4863 uint64_t err_ref = 0;
4864 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4865 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4866 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4867 err_ref = (uint64_t)err_var.inner & ~1;
4870 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4871 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
4872 CHECK(val->result_ok);
4873 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
4874 uint64_t res_ref = 0;
4875 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4876 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4877 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4878 res_ref = (uint64_t)res_var.inner & ~1;
4881 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t arg) {
4882 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
4883 CHECK(!val->result_ok);
4884 LDKDecodeError err_var = (*val->contents.err);
4885 uint64_t err_ref = 0;
4886 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4887 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4888 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4889 err_ref = (uint64_t)err_var.inner & ~1;
4892 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4893 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
4894 CHECK(val->result_ok);
4895 LDKUpdateAddHTLC res_var = (*val->contents.result);
4896 uint64_t res_ref = 0;
4897 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4898 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4899 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4900 res_ref = (uint64_t)res_var.inner & ~1;
4903 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t arg) {
4904 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
4905 CHECK(!val->result_ok);
4906 LDKDecodeError err_var = (*val->contents.err);
4907 uint64_t err_ref = 0;
4908 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4909 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4910 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4911 err_ref = (uint64_t)err_var.inner & ~1;
4914 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_ok(uint32_t arg) {
4915 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
4916 CHECK(val->result_ok);
4917 LDKPing res_var = (*val->contents.result);
4918 uint64_t res_ref = 0;
4919 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4920 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4921 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4922 res_ref = (uint64_t)res_var.inner & ~1;
4925 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_err(uint32_t arg) {
4926 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
4927 CHECK(!val->result_ok);
4928 LDKDecodeError err_var = (*val->contents.err);
4929 uint64_t err_ref = 0;
4930 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4931 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4932 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4933 err_ref = (uint64_t)err_var.inner & ~1;
4936 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_ok(uint32_t arg) {
4937 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
4938 CHECK(val->result_ok);
4939 LDKPong res_var = (*val->contents.result);
4940 uint64_t res_ref = 0;
4941 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4942 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4943 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4944 res_ref = (uint64_t)res_var.inner & ~1;
4947 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_err(uint32_t arg) {
4948 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
4949 CHECK(!val->result_ok);
4950 LDKDecodeError err_var = (*val->contents.err);
4951 uint64_t err_ref = 0;
4952 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4953 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4954 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4955 err_ref = (uint64_t)err_var.inner & ~1;
4958 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
4959 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4960 CHECK(val->result_ok);
4961 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
4962 uint64_t res_ref = 0;
4963 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4964 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4965 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4966 res_ref = (uint64_t)res_var.inner & ~1;
4969 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
4970 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4971 CHECK(!val->result_ok);
4972 LDKDecodeError err_var = (*val->contents.err);
4973 uint64_t err_ref = 0;
4974 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4975 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4976 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4977 err_ref = (uint64_t)err_var.inner & ~1;
4980 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
4981 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4982 CHECK(val->result_ok);
4983 LDKChannelAnnouncement res_var = (*val->contents.result);
4984 uint64_t res_ref = 0;
4985 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4986 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4987 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
4988 res_ref = (uint64_t)res_var.inner & ~1;
4991 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
4992 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4993 CHECK(!val->result_ok);
4994 LDKDecodeError err_var = (*val->contents.err);
4995 uint64_t err_ref = 0;
4996 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4997 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4998 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
4999 err_ref = (uint64_t)err_var.inner & ~1;
5002 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
5003 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5004 CHECK(val->result_ok);
5005 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
5006 uint64_t res_ref = 0;
5007 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5008 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5009 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5010 res_ref = (uint64_t)res_var.inner & ~1;
5013 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
5014 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5015 CHECK(!val->result_ok);
5016 LDKDecodeError err_var = (*val->contents.err);
5017 uint64_t err_ref = 0;
5018 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5019 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5020 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5021 err_ref = (uint64_t)err_var.inner & ~1;
5024 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
5025 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
5026 CHECK(val->result_ok);
5027 LDKChannelUpdate res_var = (*val->contents.result);
5028 uint64_t res_ref = 0;
5029 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5030 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5031 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5032 res_ref = (uint64_t)res_var.inner & ~1;
5035 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
5036 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
5037 CHECK(!val->result_ok);
5038 LDKDecodeError err_var = (*val->contents.err);
5039 uint64_t err_ref = 0;
5040 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5041 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5042 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5043 err_ref = (uint64_t)err_var.inner & ~1;
5046 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t arg) {
5047 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
5048 CHECK(val->result_ok);
5049 LDKErrorMessage res_var = (*val->contents.result);
5050 uint64_t res_ref = 0;
5051 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5052 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5053 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5054 res_ref = (uint64_t)res_var.inner & ~1;
5057 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_err(uint32_t arg) {
5058 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
5059 CHECK(!val->result_ok);
5060 LDKDecodeError err_var = (*val->contents.err);
5061 uint64_t err_ref = 0;
5062 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5063 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5064 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5065 err_ref = (uint64_t)err_var.inner & ~1;
5068 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5069 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5070 CHECK(val->result_ok);
5071 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
5072 uint64_t res_ref = 0;
5073 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5074 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5075 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5076 res_ref = (uint64_t)res_var.inner & ~1;
5079 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5080 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5081 CHECK(!val->result_ok);
5082 LDKDecodeError err_var = (*val->contents.err);
5083 uint64_t err_ref = 0;
5084 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5085 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5086 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5087 err_ref = (uint64_t)err_var.inner & ~1;
5090 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5091 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5092 CHECK(val->result_ok);
5093 LDKNodeAnnouncement res_var = (*val->contents.result);
5094 uint64_t res_ref = 0;
5095 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5096 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5097 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5098 res_ref = (uint64_t)res_var.inner & ~1;
5101 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5102 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5103 CHECK(!val->result_ok);
5104 LDKDecodeError err_var = (*val->contents.err);
5105 uint64_t err_ref = 0;
5106 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5107 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5108 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5109 err_ref = (uint64_t)err_var.inner & ~1;
5112 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t arg) {
5113 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5114 CHECK(val->result_ok);
5115 LDKQueryShortChannelIds res_var = (*val->contents.result);
5116 uint64_t res_ref = 0;
5117 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5118 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5119 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5120 res_ref = (uint64_t)res_var.inner & ~1;
5123 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t arg) {
5124 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5125 CHECK(!val->result_ok);
5126 LDKDecodeError err_var = (*val->contents.err);
5127 uint64_t err_ref = 0;
5128 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5129 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5130 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5131 err_ref = (uint64_t)err_var.inner & ~1;
5134 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t arg) {
5135 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5136 CHECK(val->result_ok);
5137 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
5138 uint64_t res_ref = 0;
5139 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5140 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5141 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5142 res_ref = (uint64_t)res_var.inner & ~1;
5145 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t arg) {
5146 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5147 CHECK(!val->result_ok);
5148 LDKDecodeError err_var = (*val->contents.err);
5149 uint64_t err_ref = 0;
5150 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5151 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5152 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5153 err_ref = (uint64_t)err_var.inner & ~1;
5156 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
5157 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5158 CHECK(val->result_ok);
5159 LDKQueryChannelRange res_var = (*val->contents.result);
5160 uint64_t res_ref = 0;
5161 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5162 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5163 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5164 res_ref = (uint64_t)res_var.inner & ~1;
5167 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
5168 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5169 CHECK(!val->result_ok);
5170 LDKDecodeError err_var = (*val->contents.err);
5171 uint64_t err_ref = 0;
5172 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5173 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5174 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5175 err_ref = (uint64_t)err_var.inner & ~1;
5178 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
5179 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5180 CHECK(val->result_ok);
5181 LDKReplyChannelRange res_var = (*val->contents.result);
5182 uint64_t res_ref = 0;
5183 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5184 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5185 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5186 res_ref = (uint64_t)res_var.inner & ~1;
5189 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
5190 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5191 CHECK(!val->result_ok);
5192 LDKDecodeError err_var = (*val->contents.err);
5193 uint64_t err_ref = 0;
5194 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5195 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5196 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5197 err_ref = (uint64_t)err_var.inner & ~1;
5200 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t arg) {
5201 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5202 CHECK(val->result_ok);
5203 LDKGossipTimestampFilter res_var = (*val->contents.result);
5204 uint64_t res_ref = 0;
5205 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5206 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5207 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5208 res_ref = (uint64_t)res_var.inner & ~1;
5211 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t arg) {
5212 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5213 CHECK(!val->result_ok);
5214 LDKDecodeError err_var = (*val->contents.err);
5215 uint64_t err_ref = 0;
5216 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5217 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5218 CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var);
5219 err_ref = (uint64_t)err_var.inner & ~1;
5222 uint32_t __attribute__((visibility("default"))) TS_LDKSignOrCreationError_ref_from_ptr(uint32_t ptr) {
5223 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
5225 case LDKSignOrCreationError_SignError: {
5226 return 0 /* LDKSignOrCreationError - SignError */;
5228 case LDKSignOrCreationError_CreationError: {
5229 uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
5230 return 0 /* LDKSignOrCreationError - CreationError */; (void) creation_error_conv;
5235 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_get_ok(uint32_t arg) {
5236 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5237 CHECK(val->result_ok);
5238 LDKInvoice res_var = (*val->contents.result);
5239 uint64_t res_ref = 0;
5240 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5241 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5242 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5243 res_ref = (uint64_t)res_var.inner & ~1;
5246 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_get_err(uint32_t arg) {
5247 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5248 CHECK(!val->result_ok);
5249 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
5252 typedef struct LDKFilter_JCalls {
5253 atomic_size_t refcnt;
5254 uint32_t register_tx_meth;
5255 uint32_t register_output_meth;
5257 static void LDKFilter_JCalls_free(void* this_arg) {
5258 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5259 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5260 js_free(j_calls->register_tx_meth);
5261 js_free(j_calls->register_output_meth);
5265 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
5266 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5267 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5268 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
5269 LDKu8slice script_pubkey_var = script_pubkey;
5270 int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5271 memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
5272 js_invoke_function_2(j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
5274 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
5275 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5276 LDKWatchedOutput output_var = output;
5277 uint64_t output_ref = 0;
5278 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5279 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5280 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
5281 output_ref = (uint64_t)output_var.inner;
5282 if (output_var.is_owned) {
5285 uint32_t ret = js_invoke_function_1(j_calls->register_output_meth, output_ref);
5286 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
5287 CHECK_ACCESS(ret_ptr);
5288 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
5292 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
5293 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
5294 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5296 static inline LDKFilter LDKFilter_init (/*TODO: JS Object Reference */void* o) {
5297 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
5298 atomic_init(&calls->refcnt, 1);
5299 //TODO: Assign calls->o from o
5302 .this_arg = (void*) calls,
5303 .register_tx = register_tx_LDKFilter_jcall,
5304 .register_output = register_output_LDKFilter_jcall,
5305 .free = LDKFilter_JCalls_free,
5309 long __attribute__((visibility("default"))) TS_LDKFilter_new(/*TODO: JS Object Reference */void* o) {
5310 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
5311 *res_ptr = LDKFilter_init(o);
5312 return (long)res_ptr;
5314 void __attribute__((visibility("default"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
5315 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5316 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5317 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
5318 unsigned char txid_arr[32];
5319 CHECK(*((uint32_t*)txid) == 32);
5320 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
5321 unsigned char (*txid_ref)[32] = &txid_arr;
5322 LDKu8slice script_pubkey_ref;
5323 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
5324 script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
5325 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
5328 uint32_t __attribute__((visibility("default"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
5329 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5330 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5331 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
5332 LDKWatchedOutput output_conv;
5333 output_conv.inner = (void*)(output & (~1));
5334 output_conv.is_owned = (output & 1) || (output == 0);
5335 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
5336 output_conv = WatchedOutput_clone(&output_conv);
5337 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
5338 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
5339 uint64_t ret_ref = (uint64_t)ret_copy;
5343 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_FilterZ_ref_from_ptr(uint32_t ptr) {
5344 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
5346 case LDKCOption_FilterZ_Some: {
5347 LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
5348 *some_ret = obj->some;
5349 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
5350 return 0 /* LDKCOption_FilterZ - Some */; (void) (uint64_t)some_ret;
5352 case LDKCOption_FilterZ_None: {
5353 return 0 /* LDKCOption_FilterZ - None */;
5358 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_LockedChannelMonitorNoneZ_get_ok(uint32_t arg) {
5359 LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1);
5360 CHECK(val->result_ok);
5361 LDKLockedChannelMonitor res_var = (*val->contents.result);
5362 uint64_t res_ref = 0;
5363 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5364 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5365 CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var);
5366 res_ref = (uint64_t)res_var.inner & ~1;
5369 void __attribute__((visibility("default"))) TS_LDKCResult_LockedChannelMonitorNoneZ_get_err(uint32_t arg) {
5370 LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1);
5371 CHECK(!val->result_ok);
5372 return *val->contents.err;
5374 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
5375 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
5376 for (size_t i = 0; i < ret.datalen; i++) {
5377 ret.data[i] = OutPoint_clone(&orig->data[i]);
5381 typedef struct LDKMessageSendEventsProvider_JCalls {
5382 atomic_size_t refcnt;
5383 uint32_t get_and_clear_pending_msg_events_meth;
5384 } LDKMessageSendEventsProvider_JCalls;
5385 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
5386 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5387 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5388 js_free(j_calls->get_and_clear_pending_msg_events_meth);
5392 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
5393 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5394 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_events_meth);
5395 LDKCVec_MessageSendEventZ ret_constr;
5396 ret_constr.datalen = *((uint32_t*)ret);
5397 if (ret_constr.datalen > 0)
5398 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5400 ret_constr.data = NULL;
5401 uint32_t* ret_vals = (uint32_t*)(ret + 4);
5402 for (size_t s = 0; s < ret_constr.datalen; s++) {
5403 uint32_t ret_conv_18 = ret_vals[s];
5404 void* ret_conv_18_ptr = (void*)(((uint64_t)ret_conv_18) & ~1);
5405 CHECK_ACCESS(ret_conv_18_ptr);
5406 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
5407 FREE((void*)ret_conv_18);
5408 ret_constr.data[s] = ret_conv_18_conv;
5412 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
5413 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
5414 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5416 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (/*TODO: JS Object Reference */void* o) {
5417 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
5418 atomic_init(&calls->refcnt, 1);
5419 //TODO: Assign calls->o from o
5421 LDKMessageSendEventsProvider ret = {
5422 .this_arg = (void*) calls,
5423 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
5424 .free = LDKMessageSendEventsProvider_JCalls_free,
5428 long __attribute__((visibility("default"))) TS_LDKMessageSendEventsProvider_new(/*TODO: JS Object Reference */void* o) {
5429 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
5430 *res_ptr = LDKMessageSendEventsProvider_init(o);
5431 return (long)res_ptr;
5433 uint32_tArray __attribute__((visibility("default"))) TS_MessageSendEventsProvider_get_and_clear_pending_msg_events(uint32_t this_arg) {
5434 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5435 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5436 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
5437 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
5438 uint32_tArray ret_arr = NULL;
5439 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5440 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
5441 for (size_t s = 0; s < ret_var.datalen; s++) {
5442 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
5443 *ret_conv_18_copy = ret_var.data[s];
5444 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
5445 ret_arr_ptr[s] = ret_conv_18_ref;
5452 typedef struct LDKEventHandler_JCalls {
5453 atomic_size_t refcnt;
5454 uint32_t handle_event_meth;
5455 } LDKEventHandler_JCalls;
5456 static void LDKEventHandler_JCalls_free(void* this_arg) {
5457 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
5458 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5459 js_free(j_calls->handle_event_meth);
5463 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
5464 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
5465 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
5466 *ret_event = Event_clone(event);
5467 js_invoke_function_1(j_calls->handle_event_meth, (uint64_t)ret_event);
5469 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
5470 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
5471 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5473 static inline LDKEventHandler LDKEventHandler_init (/*TODO: JS Object Reference */void* o) {
5474 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
5475 atomic_init(&calls->refcnt, 1);
5476 //TODO: Assign calls->o from o
5478 LDKEventHandler ret = {
5479 .this_arg = (void*) calls,
5480 .handle_event = handle_event_LDKEventHandler_jcall,
5481 .free = LDKEventHandler_JCalls_free,
5485 long __attribute__((visibility("default"))) TS_LDKEventHandler_new(/*TODO: JS Object Reference */void* o) {
5486 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
5487 *res_ptr = LDKEventHandler_init(o);
5488 return (long)res_ptr;
5490 void __attribute__((visibility("default"))) TS_EventHandler_handle_event(uint32_t this_arg, uint32_t event) {
5491 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5492 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5493 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
5494 LDKEvent* event_conv = (LDKEvent*)event;
5495 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
5498 typedef struct LDKEventsProvider_JCalls {
5499 atomic_size_t refcnt;
5500 uint32_t process_pending_events_meth;
5501 } LDKEventsProvider_JCalls;
5502 static void LDKEventsProvider_JCalls_free(void* this_arg) {
5503 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
5504 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5505 js_free(j_calls->process_pending_events_meth);
5509 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
5510 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
5511 LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
5512 *handler_ret = handler;
5513 js_invoke_function_1(j_calls->process_pending_events_meth, (uint64_t)handler_ret);
5515 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
5516 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
5517 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5519 static inline LDKEventsProvider LDKEventsProvider_init (/*TODO: JS Object Reference */void* o) {
5520 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
5521 atomic_init(&calls->refcnt, 1);
5522 //TODO: Assign calls->o from o
5524 LDKEventsProvider ret = {
5525 .this_arg = (void*) calls,
5526 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
5527 .free = LDKEventsProvider_JCalls_free,
5531 long __attribute__((visibility("default"))) TS_LDKEventsProvider_new(/*TODO: JS Object Reference */void* o) {
5532 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
5533 *res_ptr = LDKEventsProvider_init(o);
5534 return (long)res_ptr;
5536 void __attribute__((visibility("default"))) TS_EventsProvider_process_pending_events(uint32_t this_arg, uint32_t handler) {
5537 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5538 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5539 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
5540 void* handler_ptr = (void*)(((uint64_t)handler) & ~1);
5541 CHECK_ACCESS(handler_ptr);
5542 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
5543 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
5546 typedef struct LDKListen_JCalls {
5547 atomic_size_t refcnt;
5548 uint32_t block_connected_meth;
5549 uint32_t block_disconnected_meth;
5551 static void LDKListen_JCalls_free(void* this_arg) {
5552 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
5553 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5554 js_free(j_calls->block_connected_meth);
5555 js_free(j_calls->block_disconnected_meth);
5559 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
5560 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
5561 LDKu8slice block_var = block;
5562 int8_tArray block_arr = init_arr(block_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5563 memcpy((uint8_t*)(block_arr + 4), block_var.data, block_var.datalen);
5564 js_invoke_function_2(j_calls->block_connected_meth, block_arr, height);
5566 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
5567 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
5568 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5569 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5570 js_invoke_function_2(j_calls->block_disconnected_meth, header_arr, height);
5572 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
5573 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
5574 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5576 static inline LDKListen LDKListen_init (/*TODO: JS Object Reference */void* o) {
5577 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
5578 atomic_init(&calls->refcnt, 1);
5579 //TODO: Assign calls->o from o
5582 .this_arg = (void*) calls,
5583 .block_connected = block_connected_LDKListen_jcall,
5584 .block_disconnected = block_disconnected_LDKListen_jcall,
5585 .free = LDKListen_JCalls_free,
5589 long __attribute__((visibility("default"))) TS_LDKListen_new(/*TODO: JS Object Reference */void* o) {
5590 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
5591 *res_ptr = LDKListen_init(o);
5592 return (long)res_ptr;
5594 void __attribute__((visibility("default"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
5595 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5596 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5597 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
5598 LDKu8slice block_ref;
5599 block_ref.datalen = *((uint32_t*)block);
5600 block_ref.data = (int8_t*)(block + 4);
5601 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
5604 void __attribute__((visibility("default"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
5605 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5606 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5607 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
5608 unsigned char header_arr[80];
5609 CHECK(*((uint32_t*)header) == 80);
5610 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5611 unsigned char (*header_ref)[80] = &header_arr;
5612 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
5615 typedef struct LDKConfirm_JCalls {
5616 atomic_size_t refcnt;
5617 uint32_t transactions_confirmed_meth;
5618 uint32_t transaction_unconfirmed_meth;
5619 uint32_t best_block_updated_meth;
5620 uint32_t get_relevant_txids_meth;
5621 } LDKConfirm_JCalls;
5622 static void LDKConfirm_JCalls_free(void* this_arg) {
5623 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5624 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5625 js_free(j_calls->transactions_confirmed_meth);
5626 js_free(j_calls->transaction_unconfirmed_meth);
5627 js_free(j_calls->best_block_updated_meth);
5628 js_free(j_calls->get_relevant_txids_meth);
5632 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
5633 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5634 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5635 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5636 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
5637 uint32_tArray txdata_arr = NULL;
5638 txdata_arr = init_arr(txdata_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5639 uint32_t *txdata_arr_ptr = (uint32_t*)(txdata_arr + 4);
5640 for (size_t c = 0; c < txdata_var.datalen; c++) {
5641 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5642 *txdata_conv_28_conv = txdata_var.data[c];
5643 txdata_arr_ptr[c] = ((uint64_t)txdata_conv_28_conv);
5646 FREE(txdata_var.data);
5647 js_invoke_function_3(j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
5649 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
5650 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5651 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5652 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
5653 js_invoke_function_1(j_calls->transaction_unconfirmed_meth, txid_arr);
5655 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
5656 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5657 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5658 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5659 js_invoke_function_2(j_calls->best_block_updated_meth, header_arr, height);
5661 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
5662 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5663 ptrArray ret = js_invoke_function_0(j_calls->get_relevant_txids_meth);
5664 LDKCVec_TxidZ ret_constr;
5665 ret_constr.datalen = *((uint32_t*)ret);
5666 if (ret_constr.datalen > 0)
5667 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
5669 ret_constr.data = NULL;
5670 int8_tArray* ret_vals = (int8_tArray*)(ret + 4);
5671 for (size_t m = 0; m < ret_constr.datalen; m++) {
5672 int8_tArray ret_conv_12 = ret_vals[m];
5673 LDKThirtyTwoBytes ret_conv_12_ref;
5674 CHECK(*((uint32_t*)ret_conv_12) == 32);
5675 memcpy(ret_conv_12_ref.data, (uint8_t*)(ret_conv_12 + 4), 32);
5676 ret_constr.data[m] = ret_conv_12_ref;
5680 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
5681 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
5682 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5684 static inline LDKConfirm LDKConfirm_init (/*TODO: JS Object Reference */void* o) {
5685 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
5686 atomic_init(&calls->refcnt, 1);
5687 //TODO: Assign calls->o from o
5690 .this_arg = (void*) calls,
5691 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
5692 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
5693 .best_block_updated = best_block_updated_LDKConfirm_jcall,
5694 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
5695 .free = LDKConfirm_JCalls_free,
5699 long __attribute__((visibility("default"))) TS_LDKConfirm_new(/*TODO: JS Object Reference */void* o) {
5700 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
5701 *res_ptr = LDKConfirm_init(o);
5702 return (long)res_ptr;
5704 void __attribute__((visibility("default"))) TS_Confirm_transactions_confirmed(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
5705 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5706 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5707 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
5708 unsigned char header_arr[80];
5709 CHECK(*((uint32_t*)header) == 80);
5710 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5711 unsigned char (*header_ref)[80] = &header_arr;
5712 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
5713 txdata_constr.datalen = *((uint32_t*)txdata);
5714 if (txdata_constr.datalen > 0)
5715 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5717 txdata_constr.data = NULL;
5718 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
5719 for (size_t c = 0; c < txdata_constr.datalen; c++) {
5720 uint32_t txdata_conv_28 = txdata_vals[c];
5721 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
5722 CHECK_ACCESS(txdata_conv_28_ptr);
5723 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
5724 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
5725 txdata_constr.data[c] = txdata_conv_28_conv;
5727 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
5730 void __attribute__((visibility("default"))) TS_Confirm_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid) {
5731 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5732 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5733 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
5734 unsigned char txid_arr[32];
5735 CHECK(*((uint32_t*)txid) == 32);
5736 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
5737 unsigned char (*txid_ref)[32] = &txid_arr;
5738 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
5741 void __attribute__((visibility("default"))) TS_Confirm_best_block_updated(uint32_t this_arg, int8_tArray header, int32_t height) {
5742 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5743 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5744 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
5745 unsigned char header_arr[80];
5746 CHECK(*((uint32_t*)header) == 80);
5747 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5748 unsigned char (*header_ref)[80] = &header_arr;
5749 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
5752 ptrArray __attribute__((visibility("default"))) TS_Confirm_get_relevant_txids(uint32_t this_arg) {
5753 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5754 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5755 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
5756 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
5757 ptrArray ret_arr = NULL;
5758 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
5759 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
5760 for (size_t m = 0; m < ret_var.datalen; m++) {
5761 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5762 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
5763 ret_arr_ptr[m] = ret_conv_12_arr;
5770 typedef struct LDKPersist_JCalls {
5771 atomic_size_t refcnt;
5772 uint32_t persist_new_channel_meth;
5773 uint32_t update_persisted_channel_meth;
5774 } LDKPersist_JCalls;
5775 static void LDKPersist_JCalls_free(void* this_arg) {
5776 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5777 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5778 js_free(j_calls->persist_new_channel_meth);
5779 js_free(j_calls->update_persisted_channel_meth);
5783 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
5784 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5785 LDKOutPoint channel_id_var = channel_id;
5786 uint64_t channel_id_ref = 0;
5787 CHECK((((uint64_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5788 CHECK((((uint64_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5789 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
5790 channel_id_ref = (uint64_t)channel_id_var.inner;
5791 if (channel_id_var.is_owned) {
5792 channel_id_ref |= 1;
5794 LDKChannelMonitor data_var = *data;
5795 uint64_t data_ref = 0;
5796 data_var = ChannelMonitor_clone(data);
5797 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5798 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5799 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
5800 data_ref = (uint64_t)data_var.inner;
5801 if (data_var.is_owned) {
5804 LDKMonitorUpdateId update_id_var = update_id;
5805 uint64_t update_id_ref = 0;
5806 CHECK((((uint64_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5807 CHECK((((uint64_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5808 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
5809 update_id_ref = (uint64_t)update_id_var.inner;
5810 if (update_id_var.is_owned) {
5813 uint32_t ret = js_invoke_function_3(j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
5814 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
5815 CHECK_ACCESS(ret_ptr);
5816 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5820 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
5821 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5822 LDKOutPoint channel_id_var = channel_id;
5823 uint64_t channel_id_ref = 0;
5824 CHECK((((uint64_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5825 CHECK((((uint64_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5826 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
5827 channel_id_ref = (uint64_t)channel_id_var.inner;
5828 if (channel_id_var.is_owned) {
5829 channel_id_ref |= 1;
5831 LDKChannelMonitorUpdate update_var = *update;
5832 uint64_t update_ref = 0;
5833 if ((uint64_t)update_var.inner > 4096) {
5834 update_var = ChannelMonitorUpdate_clone(update);
5835 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5836 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5837 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
5838 update_ref = (uint64_t)update_var.inner;
5839 if (update_var.is_owned) {
5843 LDKChannelMonitor data_var = *data;
5844 uint64_t data_ref = 0;
5845 data_var = ChannelMonitor_clone(data);
5846 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5847 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5848 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
5849 data_ref = (uint64_t)data_var.inner;
5850 if (data_var.is_owned) {
5853 LDKMonitorUpdateId update_id_var = update_id;
5854 uint64_t update_id_ref = 0;
5855 CHECK((((uint64_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5856 CHECK((((uint64_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5857 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
5858 update_id_ref = (uint64_t)update_id_var.inner;
5859 if (update_id_var.is_owned) {
5862 uint32_t ret = js_invoke_function_4(j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
5863 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
5864 CHECK_ACCESS(ret_ptr);
5865 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5869 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
5870 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
5871 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5873 static inline LDKPersist LDKPersist_init (/*TODO: JS Object Reference */void* o) {
5874 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
5875 atomic_init(&calls->refcnt, 1);
5876 //TODO: Assign calls->o from o
5879 .this_arg = (void*) calls,
5880 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
5881 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
5882 .free = LDKPersist_JCalls_free,
5886 long __attribute__((visibility("default"))) TS_LDKPersist_new(/*TODO: JS Object Reference */void* o) {
5887 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
5888 *res_ptr = LDKPersist_init(o);
5889 return (long)res_ptr;
5891 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) {
5892 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5893 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5894 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
5895 LDKOutPoint channel_id_conv;
5896 channel_id_conv.inner = (void*)(channel_id & (~1));
5897 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
5898 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
5899 channel_id_conv = OutPoint_clone(&channel_id_conv);
5900 LDKChannelMonitor data_conv;
5901 data_conv.inner = (void*)(data & (~1));
5902 data_conv.is_owned = false;
5903 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
5904 LDKMonitorUpdateId update_id_conv;
5905 update_id_conv.inner = (void*)(update_id & (~1));
5906 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
5907 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
5908 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
5909 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5910 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
5911 return (uint64_t)ret_conv;
5914 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) {
5915 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5916 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5917 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
5918 LDKOutPoint channel_id_conv;
5919 channel_id_conv.inner = (void*)(channel_id & (~1));
5920 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
5921 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
5922 channel_id_conv = OutPoint_clone(&channel_id_conv);
5923 LDKChannelMonitorUpdate update_conv;
5924 update_conv.inner = (void*)(update & (~1));
5925 update_conv.is_owned = false;
5926 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5927 LDKChannelMonitor data_conv;
5928 data_conv.inner = (void*)(data & (~1));
5929 data_conv.is_owned = false;
5930 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
5931 LDKMonitorUpdateId update_id_conv;
5932 update_id_conv.inner = (void*)(update_id & (~1));
5933 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
5934 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
5935 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
5936 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5937 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
5938 return (uint64_t)ret_conv;
5941 typedef struct LDKChannelMessageHandler_JCalls {
5942 atomic_size_t refcnt;
5943 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
5944 uint32_t handle_open_channel_meth;
5945 uint32_t handle_accept_channel_meth;
5946 uint32_t handle_funding_created_meth;
5947 uint32_t handle_funding_signed_meth;
5948 uint32_t handle_funding_locked_meth;
5949 uint32_t handle_shutdown_meth;
5950 uint32_t handle_closing_signed_meth;
5951 uint32_t handle_update_add_htlc_meth;
5952 uint32_t handle_update_fulfill_htlc_meth;
5953 uint32_t handle_update_fail_htlc_meth;
5954 uint32_t handle_update_fail_malformed_htlc_meth;
5955 uint32_t handle_commitment_signed_meth;
5956 uint32_t handle_revoke_and_ack_meth;
5957 uint32_t handle_update_fee_meth;
5958 uint32_t handle_announcement_signatures_meth;
5959 uint32_t peer_disconnected_meth;
5960 uint32_t peer_connected_meth;
5961 uint32_t handle_channel_reestablish_meth;
5962 uint32_t handle_channel_update_meth;
5963 uint32_t handle_error_meth;
5964 } LDKChannelMessageHandler_JCalls;
5965 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
5966 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5967 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5968 js_free(j_calls->handle_open_channel_meth);
5969 js_free(j_calls->handle_accept_channel_meth);
5970 js_free(j_calls->handle_funding_created_meth);
5971 js_free(j_calls->handle_funding_signed_meth);
5972 js_free(j_calls->handle_funding_locked_meth);
5973 js_free(j_calls->handle_shutdown_meth);
5974 js_free(j_calls->handle_closing_signed_meth);
5975 js_free(j_calls->handle_update_add_htlc_meth);
5976 js_free(j_calls->handle_update_fulfill_htlc_meth);
5977 js_free(j_calls->handle_update_fail_htlc_meth);
5978 js_free(j_calls->handle_update_fail_malformed_htlc_meth);
5979 js_free(j_calls->handle_commitment_signed_meth);
5980 js_free(j_calls->handle_revoke_and_ack_meth);
5981 js_free(j_calls->handle_update_fee_meth);
5982 js_free(j_calls->handle_announcement_signatures_meth);
5983 js_free(j_calls->peer_disconnected_meth);
5984 js_free(j_calls->peer_connected_meth);
5985 js_free(j_calls->handle_channel_reestablish_meth);
5986 js_free(j_calls->handle_channel_update_meth);
5987 js_free(j_calls->handle_error_meth);
5991 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
5992 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5993 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5994 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5995 LDKInitFeatures their_features_var = their_features;
5996 uint64_t their_features_ref = 0;
5997 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5998 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5999 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
6000 their_features_ref = (uint64_t)their_features_var.inner;
6001 if (their_features_var.is_owned) {
6002 their_features_ref |= 1;
6004 LDKOpenChannel msg_var = *msg;
6005 uint64_t msg_ref = 0;
6006 msg_var = OpenChannel_clone(msg);
6007 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6008 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6009 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6010 msg_ref = (uint64_t)msg_var.inner;
6011 if (msg_var.is_owned) {
6014 js_invoke_function_3(j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
6016 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
6017 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6018 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6019 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6020 LDKInitFeatures their_features_var = their_features;
6021 uint64_t their_features_ref = 0;
6022 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6023 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6024 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
6025 their_features_ref = (uint64_t)their_features_var.inner;
6026 if (their_features_var.is_owned) {
6027 their_features_ref |= 1;
6029 LDKAcceptChannel msg_var = *msg;
6030 uint64_t msg_ref = 0;
6031 msg_var = AcceptChannel_clone(msg);
6032 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6033 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6034 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6035 msg_ref = (uint64_t)msg_var.inner;
6036 if (msg_var.is_owned) {
6039 js_invoke_function_3(j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
6041 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
6042 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6043 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6044 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6045 LDKFundingCreated msg_var = *msg;
6046 uint64_t msg_ref = 0;
6047 msg_var = FundingCreated_clone(msg);
6048 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6049 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6050 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6051 msg_ref = (uint64_t)msg_var.inner;
6052 if (msg_var.is_owned) {
6055 js_invoke_function_2(j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
6057 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
6058 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6059 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6060 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6061 LDKFundingSigned msg_var = *msg;
6062 uint64_t msg_ref = 0;
6063 msg_var = FundingSigned_clone(msg);
6064 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6065 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6066 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6067 msg_ref = (uint64_t)msg_var.inner;
6068 if (msg_var.is_owned) {
6071 js_invoke_function_2(j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
6073 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
6074 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6075 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6076 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6077 LDKFundingLocked msg_var = *msg;
6078 uint64_t msg_ref = 0;
6079 msg_var = FundingLocked_clone(msg);
6080 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6081 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6082 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6083 msg_ref = (uint64_t)msg_var.inner;
6084 if (msg_var.is_owned) {
6087 js_invoke_function_2(j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
6089 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
6090 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6091 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6092 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6093 LDKInitFeatures their_features_var = *their_features;
6094 uint64_t their_features_ref = 0;
6095 their_features_var = InitFeatures_clone(their_features);
6096 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6097 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6098 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
6099 their_features_ref = (uint64_t)their_features_var.inner;
6100 if (their_features_var.is_owned) {
6101 their_features_ref |= 1;
6103 LDKShutdown msg_var = *msg;
6104 uint64_t msg_ref = 0;
6105 msg_var = Shutdown_clone(msg);
6106 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6107 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6108 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6109 msg_ref = (uint64_t)msg_var.inner;
6110 if (msg_var.is_owned) {
6113 js_invoke_function_3(j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
6115 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
6116 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6117 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6118 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6119 LDKClosingSigned msg_var = *msg;
6120 uint64_t msg_ref = 0;
6121 msg_var = ClosingSigned_clone(msg);
6122 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6123 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6124 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6125 msg_ref = (uint64_t)msg_var.inner;
6126 if (msg_var.is_owned) {
6129 js_invoke_function_2(j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
6131 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
6132 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6133 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6134 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6135 LDKUpdateAddHTLC msg_var = *msg;
6136 uint64_t msg_ref = 0;
6137 msg_var = UpdateAddHTLC_clone(msg);
6138 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6139 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6140 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6141 msg_ref = (uint64_t)msg_var.inner;
6142 if (msg_var.is_owned) {
6145 js_invoke_function_2(j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
6147 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
6148 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6149 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6150 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6151 LDKUpdateFulfillHTLC msg_var = *msg;
6152 uint64_t msg_ref = 0;
6153 msg_var = UpdateFulfillHTLC_clone(msg);
6154 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6155 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6156 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6157 msg_ref = (uint64_t)msg_var.inner;
6158 if (msg_var.is_owned) {
6161 js_invoke_function_2(j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
6163 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
6164 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6165 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6166 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6167 LDKUpdateFailHTLC msg_var = *msg;
6168 uint64_t msg_ref = 0;
6169 msg_var = UpdateFailHTLC_clone(msg);
6170 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6171 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6172 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6173 msg_ref = (uint64_t)msg_var.inner;
6174 if (msg_var.is_owned) {
6177 js_invoke_function_2(j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
6179 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
6180 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6181 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6182 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6183 LDKUpdateFailMalformedHTLC msg_var = *msg;
6184 uint64_t msg_ref = 0;
6185 msg_var = UpdateFailMalformedHTLC_clone(msg);
6186 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6187 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6188 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6189 msg_ref = (uint64_t)msg_var.inner;
6190 if (msg_var.is_owned) {
6193 js_invoke_function_2(j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
6195 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
6196 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6197 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6198 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6199 LDKCommitmentSigned msg_var = *msg;
6200 uint64_t msg_ref = 0;
6201 msg_var = CommitmentSigned_clone(msg);
6202 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6203 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6204 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6205 msg_ref = (uint64_t)msg_var.inner;
6206 if (msg_var.is_owned) {
6209 js_invoke_function_2(j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
6211 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
6212 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6213 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6214 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6215 LDKRevokeAndACK msg_var = *msg;
6216 uint64_t msg_ref = 0;
6217 msg_var = RevokeAndACK_clone(msg);
6218 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6219 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6220 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6221 msg_ref = (uint64_t)msg_var.inner;
6222 if (msg_var.is_owned) {
6225 js_invoke_function_2(j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
6227 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
6228 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6229 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6230 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6231 LDKUpdateFee msg_var = *msg;
6232 uint64_t msg_ref = 0;
6233 msg_var = UpdateFee_clone(msg);
6234 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6235 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6236 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6237 msg_ref = (uint64_t)msg_var.inner;
6238 if (msg_var.is_owned) {
6241 js_invoke_function_2(j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
6243 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
6244 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6245 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6246 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6247 LDKAnnouncementSignatures msg_var = *msg;
6248 uint64_t msg_ref = 0;
6249 msg_var = AnnouncementSignatures_clone(msg);
6250 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6251 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6252 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6253 msg_ref = (uint64_t)msg_var.inner;
6254 if (msg_var.is_owned) {
6257 js_invoke_function_2(j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
6259 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
6260 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6261 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6262 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6263 js_invoke_function_2(j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
6265 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
6266 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6267 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6268 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6269 LDKInit msg_var = *msg;
6270 uint64_t msg_ref = 0;
6271 msg_var = Init_clone(msg);
6272 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6273 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6274 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6275 msg_ref = (uint64_t)msg_var.inner;
6276 if (msg_var.is_owned) {
6279 js_invoke_function_2(j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
6281 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
6282 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6283 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6284 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6285 LDKChannelReestablish msg_var = *msg;
6286 uint64_t msg_ref = 0;
6287 msg_var = ChannelReestablish_clone(msg);
6288 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6289 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6290 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6291 msg_ref = (uint64_t)msg_var.inner;
6292 if (msg_var.is_owned) {
6295 js_invoke_function_2(j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
6297 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
6298 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6299 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6300 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6301 LDKChannelUpdate msg_var = *msg;
6302 uint64_t msg_ref = 0;
6303 msg_var = ChannelUpdate_clone(msg);
6304 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6305 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6306 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6307 msg_ref = (uint64_t)msg_var.inner;
6308 if (msg_var.is_owned) {
6311 js_invoke_function_2(j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
6313 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
6314 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6315 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6316 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6317 LDKErrorMessage msg_var = *msg;
6318 uint64_t msg_ref = 0;
6319 msg_var = ErrorMessage_clone(msg);
6320 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6321 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6322 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6323 msg_ref = (uint64_t)msg_var.inner;
6324 if (msg_var.is_owned) {
6327 js_invoke_function_2(j_calls->handle_error_meth, their_node_id_arr, msg_ref);
6329 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
6330 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
6331 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6332 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
6334 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
6335 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
6336 atomic_init(&calls->refcnt, 1);
6337 //TODO: Assign calls->o from o
6339 LDKChannelMessageHandler ret = {
6340 .this_arg = (void*) calls,
6341 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
6342 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
6343 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
6344 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
6345 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
6346 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
6347 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
6348 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
6349 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
6350 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
6351 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
6352 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
6353 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
6354 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
6355 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
6356 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
6357 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
6358 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
6359 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
6360 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
6361 .free = LDKChannelMessageHandler_JCalls_free,
6362 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
6364 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
6367 long __attribute__((visibility("default"))) TS_LDKChannelMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
6368 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
6369 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
6370 return (long)res_ptr;
6372 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) {
6373 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6374 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6375 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6376 LDKPublicKey their_node_id_ref;
6377 CHECK(*((uint32_t*)their_node_id) == 33);
6378 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6379 LDKInitFeatures their_features_conv;
6380 their_features_conv.inner = (void*)(their_features & (~1));
6381 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
6382 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
6383 their_features_conv = InitFeatures_clone(&their_features_conv);
6384 LDKOpenChannel msg_conv;
6385 msg_conv.inner = (void*)(msg & (~1));
6386 msg_conv.is_owned = false;
6387 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6388 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
6391 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) {
6392 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6393 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6394 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6395 LDKPublicKey their_node_id_ref;
6396 CHECK(*((uint32_t*)their_node_id) == 33);
6397 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6398 LDKInitFeatures their_features_conv;
6399 their_features_conv.inner = (void*)(their_features & (~1));
6400 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
6401 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
6402 their_features_conv = InitFeatures_clone(&their_features_conv);
6403 LDKAcceptChannel msg_conv;
6404 msg_conv.inner = (void*)(msg & (~1));
6405 msg_conv.is_owned = false;
6406 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6407 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
6410 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_created(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6411 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6412 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6413 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6414 LDKPublicKey their_node_id_ref;
6415 CHECK(*((uint32_t*)their_node_id) == 33);
6416 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6417 LDKFundingCreated msg_conv;
6418 msg_conv.inner = (void*)(msg & (~1));
6419 msg_conv.is_owned = false;
6420 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6421 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6424 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6425 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6426 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6427 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6428 LDKPublicKey their_node_id_ref;
6429 CHECK(*((uint32_t*)their_node_id) == 33);
6430 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6431 LDKFundingSigned msg_conv;
6432 msg_conv.inner = (void*)(msg & (~1));
6433 msg_conv.is_owned = false;
6434 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6435 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6438 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_locked(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6439 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6440 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6441 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6442 LDKPublicKey their_node_id_ref;
6443 CHECK(*((uint32_t*)their_node_id) == 33);
6444 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6445 LDKFundingLocked msg_conv;
6446 msg_conv.inner = (void*)(msg & (~1));
6447 msg_conv.is_owned = false;
6448 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6449 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6452 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_shutdown(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
6453 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6454 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6455 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6456 LDKPublicKey their_node_id_ref;
6457 CHECK(*((uint32_t*)their_node_id) == 33);
6458 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6459 LDKInitFeatures their_features_conv;
6460 their_features_conv.inner = (void*)(their_features & (~1));
6461 their_features_conv.is_owned = false;
6462 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
6463 LDKShutdown msg_conv;
6464 msg_conv.inner = (void*)(msg & (~1));
6465 msg_conv.is_owned = false;
6466 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6467 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
6470 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_closing_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6471 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6472 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6473 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6474 LDKPublicKey their_node_id_ref;
6475 CHECK(*((uint32_t*)their_node_id) == 33);
6476 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6477 LDKClosingSigned msg_conv;
6478 msg_conv.inner = (void*)(msg & (~1));
6479 msg_conv.is_owned = false;
6480 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6481 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6484 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_add_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6485 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6486 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6487 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6488 LDKPublicKey their_node_id_ref;
6489 CHECK(*((uint32_t*)their_node_id) == 33);
6490 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6491 LDKUpdateAddHTLC msg_conv;
6492 msg_conv.inner = (void*)(msg & (~1));
6493 msg_conv.is_owned = false;
6494 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6495 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6498 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fulfill_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6499 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6500 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6501 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6502 LDKPublicKey their_node_id_ref;
6503 CHECK(*((uint32_t*)their_node_id) == 33);
6504 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6505 LDKUpdateFulfillHTLC msg_conv;
6506 msg_conv.inner = (void*)(msg & (~1));
6507 msg_conv.is_owned = false;
6508 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6509 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6512 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6513 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6514 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6515 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6516 LDKPublicKey their_node_id_ref;
6517 CHECK(*((uint32_t*)their_node_id) == 33);
6518 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6519 LDKUpdateFailHTLC msg_conv;
6520 msg_conv.inner = (void*)(msg & (~1));
6521 msg_conv.is_owned = false;
6522 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6523 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6526 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_malformed_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6527 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6528 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6529 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6530 LDKPublicKey their_node_id_ref;
6531 CHECK(*((uint32_t*)their_node_id) == 33);
6532 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6533 LDKUpdateFailMalformedHTLC msg_conv;
6534 msg_conv.inner = (void*)(msg & (~1));
6535 msg_conv.is_owned = false;
6536 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6537 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6540 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_commitment_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6541 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6542 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6543 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6544 LDKPublicKey their_node_id_ref;
6545 CHECK(*((uint32_t*)their_node_id) == 33);
6546 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6547 LDKCommitmentSigned msg_conv;
6548 msg_conv.inner = (void*)(msg & (~1));
6549 msg_conv.is_owned = false;
6550 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6551 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6554 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_revoke_and_ack(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6555 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6556 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6557 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6558 LDKPublicKey their_node_id_ref;
6559 CHECK(*((uint32_t*)their_node_id) == 33);
6560 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6561 LDKRevokeAndACK msg_conv;
6562 msg_conv.inner = (void*)(msg & (~1));
6563 msg_conv.is_owned = false;
6564 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6565 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6568 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fee(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6569 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6570 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6571 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6572 LDKPublicKey their_node_id_ref;
6573 CHECK(*((uint32_t*)their_node_id) == 33);
6574 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6575 LDKUpdateFee msg_conv;
6576 msg_conv.inner = (void*)(msg & (~1));
6577 msg_conv.is_owned = false;
6578 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6579 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6582 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_announcement_signatures(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6583 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6584 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6585 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6586 LDKPublicKey their_node_id_ref;
6587 CHECK(*((uint32_t*)their_node_id) == 33);
6588 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6589 LDKAnnouncementSignatures msg_conv;
6590 msg_conv.inner = (void*)(msg & (~1));
6591 msg_conv.is_owned = false;
6592 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6593 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6596 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_disconnected(uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
6597 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6598 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6599 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6600 LDKPublicKey their_node_id_ref;
6601 CHECK(*((uint32_t*)their_node_id) == 33);
6602 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6603 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
6606 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6607 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6608 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6609 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6610 LDKPublicKey their_node_id_ref;
6611 CHECK(*((uint32_t*)their_node_id) == 33);
6612 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6614 msg_conv.inner = (void*)(msg & (~1));
6615 msg_conv.is_owned = false;
6616 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6617 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6620 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_reestablish(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6621 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6622 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6623 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6624 LDKPublicKey their_node_id_ref;
6625 CHECK(*((uint32_t*)their_node_id) == 33);
6626 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6627 LDKChannelReestablish msg_conv;
6628 msg_conv.inner = (void*)(msg & (~1));
6629 msg_conv.is_owned = false;
6630 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6631 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6634 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_update(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6635 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6636 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6637 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6638 LDKPublicKey their_node_id_ref;
6639 CHECK(*((uint32_t*)their_node_id) == 33);
6640 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6641 LDKChannelUpdate msg_conv;
6642 msg_conv.inner = (void*)(msg & (~1));
6643 msg_conv.is_owned = false;
6644 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6645 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6648 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6649 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6650 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6651 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6652 LDKPublicKey their_node_id_ref;
6653 CHECK(*((uint32_t*)their_node_id) == 33);
6654 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6655 LDKErrorMessage msg_conv;
6656 msg_conv.inner = (void*)(msg & (~1));
6657 msg_conv.is_owned = false;
6658 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6659 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6662 typedef struct LDKRoutingMessageHandler_JCalls {
6663 atomic_size_t refcnt;
6664 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
6665 uint32_t handle_node_announcement_meth;
6666 uint32_t handle_channel_announcement_meth;
6667 uint32_t handle_channel_update_meth;
6668 uint32_t get_next_channel_announcements_meth;
6669 uint32_t get_next_node_announcements_meth;
6670 uint32_t sync_routing_table_meth;
6671 uint32_t handle_reply_channel_range_meth;
6672 uint32_t handle_reply_short_channel_ids_end_meth;
6673 uint32_t handle_query_channel_range_meth;
6674 uint32_t handle_query_short_channel_ids_meth;
6675 } LDKRoutingMessageHandler_JCalls;
6676 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
6677 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6678 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6679 js_free(j_calls->handle_node_announcement_meth);
6680 js_free(j_calls->handle_channel_announcement_meth);
6681 js_free(j_calls->handle_channel_update_meth);
6682 js_free(j_calls->get_next_channel_announcements_meth);
6683 js_free(j_calls->get_next_node_announcements_meth);
6684 js_free(j_calls->sync_routing_table_meth);
6685 js_free(j_calls->handle_reply_channel_range_meth);
6686 js_free(j_calls->handle_reply_short_channel_ids_end_meth);
6687 js_free(j_calls->handle_query_channel_range_meth);
6688 js_free(j_calls->handle_query_short_channel_ids_meth);
6692 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
6693 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6694 LDKNodeAnnouncement msg_var = *msg;
6695 uint64_t msg_ref = 0;
6696 msg_var = NodeAnnouncement_clone(msg);
6697 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6698 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6699 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6700 msg_ref = (uint64_t)msg_var.inner;
6701 if (msg_var.is_owned) {
6704 uint32_t ret = js_invoke_function_1(j_calls->handle_node_announcement_meth, msg_ref);
6705 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6706 CHECK_ACCESS(ret_ptr);
6707 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
6711 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
6712 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6713 LDKChannelAnnouncement msg_var = *msg;
6714 uint64_t msg_ref = 0;
6715 msg_var = ChannelAnnouncement_clone(msg);
6716 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6717 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6718 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6719 msg_ref = (uint64_t)msg_var.inner;
6720 if (msg_var.is_owned) {
6723 uint32_t ret = js_invoke_function_1(j_calls->handle_channel_announcement_meth, msg_ref);
6724 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6725 CHECK_ACCESS(ret_ptr);
6726 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
6730 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
6731 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6732 LDKChannelUpdate msg_var = *msg;
6733 uint64_t msg_ref = 0;
6734 msg_var = ChannelUpdate_clone(msg);
6735 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6736 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6737 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6738 msg_ref = (uint64_t)msg_var.inner;
6739 if (msg_var.is_owned) {
6742 uint32_t ret = js_invoke_function_1(j_calls->handle_channel_update_meth, msg_ref);
6743 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6744 CHECK_ACCESS(ret_ptr);
6745 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
6749 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
6750 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6751 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
6752 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
6753 ret_constr.datalen = *((uint32_t*)ret);
6754 if (ret_constr.datalen > 0)
6755 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
6757 ret_constr.data = NULL;
6758 uint32_t* ret_vals = (uint32_t*)(ret + 4);
6759 for (size_t h = 0; h < ret_constr.datalen; h++) {
6760 uint32_t ret_conv_59 = ret_vals[h];
6761 void* ret_conv_59_ptr = (void*)(((uint64_t)ret_conv_59) & ~1);
6762 CHECK_ACCESS(ret_conv_59_ptr);
6763 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
6764 FREE((void*)ret_conv_59);
6765 ret_constr.data[h] = ret_conv_59_conv;
6769 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
6770 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6771 int8_tArray starting_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6772 memcpy((uint8_t*)(starting_point_arr + 4), starting_point.compressed_form, 33);
6773 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
6774 LDKCVec_NodeAnnouncementZ ret_constr;
6775 ret_constr.datalen = *((uint32_t*)ret);
6776 if (ret_constr.datalen > 0)
6777 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
6779 ret_constr.data = NULL;
6780 uint32_t* ret_vals = (uint32_t*)(ret + 4);
6781 for (size_t s = 0; s < ret_constr.datalen; s++) {
6782 uint32_t ret_conv_18 = ret_vals[s];
6783 LDKNodeAnnouncement ret_conv_18_conv;
6784 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
6785 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
6786 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
6787 ret_constr.data[s] = ret_conv_18_conv;
6791 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
6792 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6793 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6794 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6795 LDKInit init_var = *init;
6796 uint64_t init_ref = 0;
6797 init_var = Init_clone(init);
6798 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6799 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6800 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
6801 init_ref = (uint64_t)init_var.inner;
6802 if (init_var.is_owned) {
6805 js_invoke_function_2(j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
6807 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
6808 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6809 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6810 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6811 LDKReplyChannelRange msg_var = msg;
6812 uint64_t msg_ref = 0;
6813 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6814 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6815 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6816 msg_ref = (uint64_t)msg_var.inner;
6817 if (msg_var.is_owned) {
6820 uint32_t ret = js_invoke_function_2(j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
6821 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6822 CHECK_ACCESS(ret_ptr);
6823 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
6827 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
6828 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6829 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6830 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6831 LDKReplyShortChannelIdsEnd msg_var = msg;
6832 uint64_t msg_ref = 0;
6833 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6834 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6835 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6836 msg_ref = (uint64_t)msg_var.inner;
6837 if (msg_var.is_owned) {
6840 uint32_t ret = js_invoke_function_2(j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
6841 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6842 CHECK_ACCESS(ret_ptr);
6843 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
6847 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
6848 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6849 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6850 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6851 LDKQueryChannelRange msg_var = msg;
6852 uint64_t msg_ref = 0;
6853 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6854 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6855 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6856 msg_ref = (uint64_t)msg_var.inner;
6857 if (msg_var.is_owned) {
6860 uint32_t ret = js_invoke_function_2(j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
6861 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6862 CHECK_ACCESS(ret_ptr);
6863 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
6867 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
6868 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6869 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6870 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6871 LDKQueryShortChannelIds msg_var = msg;
6872 uint64_t msg_ref = 0;
6873 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6874 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6875 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6876 msg_ref = (uint64_t)msg_var.inner;
6877 if (msg_var.is_owned) {
6880 uint32_t ret = js_invoke_function_2(j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
6881 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6882 CHECK_ACCESS(ret_ptr);
6883 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
6887 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
6888 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
6889 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6890 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
6892 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
6893 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
6894 atomic_init(&calls->refcnt, 1);
6895 //TODO: Assign calls->o from o
6897 LDKRoutingMessageHandler ret = {
6898 .this_arg = (void*) calls,
6899 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
6900 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
6901 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
6902 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
6903 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
6904 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
6905 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
6906 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
6907 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
6908 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
6909 .free = LDKRoutingMessageHandler_JCalls_free,
6910 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
6912 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
6915 long __attribute__((visibility("default"))) TS_LDKRoutingMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
6916 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
6917 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
6918 return (long)res_ptr;
6920 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
6921 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6922 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6923 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
6924 LDKNodeAnnouncement msg_conv;
6925 msg_conv.inner = (void*)(msg & (~1));
6926 msg_conv.is_owned = false;
6927 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6928 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6929 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
6930 return (uint64_t)ret_conv;
6933 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
6934 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6935 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6936 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
6937 LDKChannelAnnouncement msg_conv;
6938 msg_conv.inner = (void*)(msg & (~1));
6939 msg_conv.is_owned = false;
6940 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6941 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6942 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
6943 return (uint64_t)ret_conv;
6946 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
6947 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6948 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6949 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
6950 LDKChannelUpdate msg_conv;
6951 msg_conv.inner = (void*)(msg & (~1));
6952 msg_conv.is_owned = false;
6953 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6954 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6955 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
6956 return (uint64_t)ret_conv;
6959 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_channel_announcements(uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
6960 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6961 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6962 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
6963 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
6964 uint32_tArray ret_arr = NULL;
6965 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
6966 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
6967 for (size_t h = 0; h < ret_var.datalen; h++) {
6968 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6969 *ret_conv_59_conv = ret_var.data[h];
6970 ret_arr_ptr[h] = ((uint64_t)ret_conv_59_conv);
6977 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_node_announcements(uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
6978 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6979 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6980 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
6981 LDKPublicKey starting_point_ref;
6982 CHECK(*((uint32_t*)starting_point) == 33);
6983 memcpy(starting_point_ref.compressed_form, (uint8_t*)(starting_point + 4), 33);
6984 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
6985 uint32_tArray ret_arr = NULL;
6986 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
6987 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
6988 for (size_t s = 0; s < ret_var.datalen; s++) {
6989 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
6990 uint64_t ret_conv_18_ref = 0;
6991 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6992 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6993 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
6994 ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
6995 if (ret_conv_18_var.is_owned) {
6996 ret_conv_18_ref |= 1;
6998 ret_arr_ptr[s] = ret_conv_18_ref;
7005 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_sync_routing_table(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
7006 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7007 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7008 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7009 LDKPublicKey their_node_id_ref;
7010 CHECK(*((uint32_t*)their_node_id) == 33);
7011 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7013 init_conv.inner = (void*)(init & (~1));
7014 init_conv.is_owned = false;
7015 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
7016 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
7019 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_reply_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7020 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7021 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7022 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7023 LDKPublicKey their_node_id_ref;
7024 CHECK(*((uint32_t*)their_node_id) == 33);
7025 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7026 LDKReplyChannelRange msg_conv;
7027 msg_conv.inner = (void*)(msg & (~1));
7028 msg_conv.is_owned = (msg & 1) || (msg == 0);
7029 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7030 msg_conv = ReplyChannelRange_clone(&msg_conv);
7031 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7032 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7033 return (uint64_t)ret_conv;
7036 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) {
7037 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7038 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7039 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7040 LDKPublicKey their_node_id_ref;
7041 CHECK(*((uint32_t*)their_node_id) == 33);
7042 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7043 LDKReplyShortChannelIdsEnd msg_conv;
7044 msg_conv.inner = (void*)(msg & (~1));
7045 msg_conv.is_owned = (msg & 1) || (msg == 0);
7046 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7047 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
7048 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7049 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7050 return (uint64_t)ret_conv;
7053 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7054 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7055 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7056 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7057 LDKPublicKey their_node_id_ref;
7058 CHECK(*((uint32_t*)their_node_id) == 33);
7059 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7060 LDKQueryChannelRange msg_conv;
7061 msg_conv.inner = (void*)(msg & (~1));
7062 msg_conv.is_owned = (msg & 1) || (msg == 0);
7063 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7064 msg_conv = QueryChannelRange_clone(&msg_conv);
7065 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7066 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7067 return (uint64_t)ret_conv;
7070 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_short_channel_ids(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7071 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7072 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7073 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7074 LDKPublicKey their_node_id_ref;
7075 CHECK(*((uint32_t*)their_node_id) == 33);
7076 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7077 LDKQueryShortChannelIds msg_conv;
7078 msg_conv.inner = (void*)(msg & (~1));
7079 msg_conv.is_owned = (msg & 1) || (msg == 0);
7080 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7081 msg_conv = QueryShortChannelIds_clone(&msg_conv);
7082 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7083 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7084 return (uint64_t)ret_conv;
7087 typedef struct LDKCustomMessageReader_JCalls {
7088 atomic_size_t refcnt;
7090 } LDKCustomMessageReader_JCalls;
7091 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
7092 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
7093 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7094 js_free(j_calls->read_meth);
7098 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
7099 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
7100 LDKu8slice buffer_var = buffer;
7101 int8_tArray buffer_arr = init_arr(buffer_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7102 memcpy((uint8_t*)(buffer_arr + 4), buffer_var.data, buffer_var.datalen);
7103 uint32_t ret = js_invoke_function_2(j_calls->read_meth, message_type, buffer_arr);
7104 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7105 CHECK_ACCESS(ret_ptr);
7106 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
7110 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
7111 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
7112 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7114 static inline LDKCustomMessageReader LDKCustomMessageReader_init (/*TODO: JS Object Reference */void* o) {
7115 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
7116 atomic_init(&calls->refcnt, 1);
7117 //TODO: Assign calls->o from o
7119 LDKCustomMessageReader ret = {
7120 .this_arg = (void*) calls,
7121 .read = read_LDKCustomMessageReader_jcall,
7122 .free = LDKCustomMessageReader_JCalls_free,
7126 long __attribute__((visibility("default"))) TS_LDKCustomMessageReader_new(/*TODO: JS Object Reference */void* o) {
7127 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
7128 *res_ptr = LDKCustomMessageReader_init(o);
7129 return (long)res_ptr;
7131 uint32_t __attribute__((visibility("default"))) TS_CustomMessageReader_read(uint32_t this_arg, int16_t message_type, int8_tArray buffer) {
7132 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7133 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7134 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
7135 LDKu8slice buffer_ref;
7136 buffer_ref.datalen = *((uint32_t*)buffer);
7137 buffer_ref.data = (int8_t*)(buffer + 4);
7138 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
7139 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
7140 return (uint64_t)ret_conv;
7143 typedef struct LDKCustomMessageHandler_JCalls {
7144 atomic_size_t refcnt;
7145 LDKCustomMessageReader_JCalls* CustomMessageReader;
7146 uint32_t handle_custom_message_meth;
7147 uint32_t get_and_clear_pending_msg_meth;
7148 } LDKCustomMessageHandler_JCalls;
7149 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
7150 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
7151 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7152 js_free(j_calls->handle_custom_message_meth);
7153 js_free(j_calls->get_and_clear_pending_msg_meth);
7157 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
7158 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
7159 LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
7161 int8_tArray sender_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
7162 memcpy((uint8_t*)(sender_node_id_arr + 4), sender_node_id.compressed_form, 33);
7163 uint32_t ret = js_invoke_function_2(j_calls->handle_custom_message_meth, (uint64_t)msg_ret, sender_node_id_arr);
7164 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7165 CHECK_ACCESS(ret_ptr);
7166 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
7170 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
7171 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
7172 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_meth);
7173 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
7174 ret_constr.datalen = *((uint32_t*)ret);
7175 if (ret_constr.datalen > 0)
7176 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
7178 ret_constr.data = NULL;
7179 uint32_t* ret_vals = (uint32_t*)(ret + 4);
7180 for (size_t z = 0; z < ret_constr.datalen; z++) {
7181 uint32_t ret_conv_25 = ret_vals[z];
7182 void* ret_conv_25_ptr = (void*)(((uint64_t)ret_conv_25) & ~1);
7183 CHECK_ACCESS(ret_conv_25_ptr);
7184 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
7185 FREE((void*)ret_conv_25);
7186 ret_constr.data[z] = ret_conv_25_conv;
7190 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
7191 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
7192 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7193 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
7195 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* CustomMessageReader) {
7196 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
7197 atomic_init(&calls->refcnt, 1);
7198 //TODO: Assign calls->o from o
7200 LDKCustomMessageHandler ret = {
7201 .this_arg = (void*) calls,
7202 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
7203 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
7204 .free = LDKCustomMessageHandler_JCalls_free,
7205 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
7207 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
7210 long __attribute__((visibility("default"))) TS_LDKCustomMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* CustomMessageReader) {
7211 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
7212 *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
7213 return (long)res_ptr;
7215 uint32_t __attribute__((visibility("default"))) TS_CustomMessageHandler_handle_custom_message(uint32_t this_arg, uint32_t msg, int8_tArray sender_node_id) {
7216 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7217 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7218 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
7219 void* msg_ptr = (void*)(((uint64_t)msg) & ~1);
7220 CHECK_ACCESS(msg_ptr);
7221 LDKType msg_conv = *(LDKType*)(msg_ptr);
7222 LDKPublicKey sender_node_id_ref;
7223 CHECK(*((uint32_t*)sender_node_id) == 33);
7224 memcpy(sender_node_id_ref.compressed_form, (uint8_t*)(sender_node_id + 4), 33);
7225 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7226 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
7227 return (uint64_t)ret_conv;
7230 uint32_tArray __attribute__((visibility("default"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint32_t this_arg) {
7231 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7232 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7233 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
7234 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
7235 uint32_tArray ret_arr = NULL;
7236 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
7237 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
7238 for (size_t z = 0; z < ret_var.datalen; z++) {
7239 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
7240 *ret_conv_25_conv = ret_var.data[z];
7241 ret_arr_ptr[z] = ((uint64_t)ret_conv_25_conv);
7248 typedef struct LDKSocketDescriptor_JCalls {
7249 atomic_size_t refcnt;
7250 uint32_t send_data_meth;
7251 uint32_t disconnect_socket_meth;
7254 } LDKSocketDescriptor_JCalls;
7255 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
7256 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7257 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7258 js_free(j_calls->send_data_meth);
7259 js_free(j_calls->disconnect_socket_meth);
7260 js_free(j_calls->eq_meth);
7261 js_free(j_calls->hash_meth);
7265 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
7266 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7267 LDKu8slice data_var = data;
7268 int8_tArray data_arr = init_arr(data_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7269 memcpy((uint8_t*)(data_arr + 4), data_var.data, data_var.datalen);
7270 return js_invoke_function_2(j_calls->send_data_meth, data_arr, resume_read);
7272 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
7273 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7274 js_invoke_function_0(j_calls->disconnect_socket_meth);
7276 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
7277 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7278 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
7279 *other_arg_clone = SocketDescriptor_clone(other_arg);
7280 return js_invoke_function_1(j_calls->eq_meth, (uint64_t)other_arg_clone);
7282 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
7283 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7284 return js_invoke_function_0(j_calls->hash_meth);
7286 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
7287 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
7288 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7290 static inline LDKSocketDescriptor LDKSocketDescriptor_init (/*TODO: JS Object Reference */void* o) {
7291 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
7292 atomic_init(&calls->refcnt, 1);
7293 //TODO: Assign calls->o from o
7295 LDKSocketDescriptor ret = {
7296 .this_arg = (void*) calls,
7297 .send_data = send_data_LDKSocketDescriptor_jcall,
7298 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
7299 .eq = eq_LDKSocketDescriptor_jcall,
7300 .hash = hash_LDKSocketDescriptor_jcall,
7301 .cloned = LDKSocketDescriptor_JCalls_cloned,
7302 .free = LDKSocketDescriptor_JCalls_free,
7306 long __attribute__((visibility("default"))) TS_LDKSocketDescriptor_new(/*TODO: JS Object Reference */void* o) {
7307 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
7308 *res_ptr = LDKSocketDescriptor_init(o);
7309 return (long)res_ptr;
7311 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
7312 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7313 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7314 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
7315 LDKu8slice data_ref;
7316 data_ref.datalen = *((uint32_t*)data);
7317 data_ref.data = (int8_t*)(data + 4);
7318 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
7322 void __attribute__((visibility("default"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
7323 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7324 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7325 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
7326 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
7329 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
7330 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7331 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7332 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
7333 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
7337 typedef struct LDKScore_JCalls {
7338 atomic_size_t refcnt;
7339 uint32_t channel_penalty_msat_meth;
7340 uint32_t payment_path_failed_meth;
7341 uint32_t write_meth;
7343 static void LDKScore_JCalls_free(void* this_arg) {
7344 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7345 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7346 js_free(j_calls->channel_penalty_msat_meth);
7347 js_free(j_calls->payment_path_failed_meth);
7348 js_free(j_calls->write_meth);
7352 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target) {
7353 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7354 LDKNodeId source_var = *source;
7355 uint64_t source_ref = 0;
7356 source_var = NodeId_clone(source);
7357 CHECK((((uint64_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7358 CHECK((((uint64_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7359 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
7360 source_ref = (uint64_t)source_var.inner;
7361 if (source_var.is_owned) {
7364 LDKNodeId target_var = *target;
7365 uint64_t target_ref = 0;
7366 target_var = NodeId_clone(target);
7367 CHECK((((uint64_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7368 CHECK((((uint64_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7369 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
7370 target_ref = (uint64_t)target_var.inner;
7371 if (target_var.is_owned) {
7374 return js_invoke_function_3(j_calls->channel_penalty_msat_meth, short_channel_id, source_ref, target_ref);
7376 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
7377 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7378 LDKCVec_RouteHopZ path_var = path;
7379 uint32_tArray path_arr = NULL;
7380 path_arr = init_arr(path_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
7381 uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4);
7382 for (size_t k = 0; k < path_var.datalen; k++) {
7383 LDKRouteHop path_conv_10_var = path_var.data[k];
7384 uint64_t path_conv_10_ref = 0;
7385 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7386 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7387 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
7388 path_conv_10_ref = (uint64_t)path_conv_10_var.inner;
7389 if (path_conv_10_var.is_owned) {
7390 path_conv_10_ref |= 1;
7392 path_arr_ptr[k] = path_conv_10_ref;
7395 FREE(path_var.data);
7396 js_invoke_function_2(j_calls->payment_path_failed_meth, path_arr, short_channel_id);
7398 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
7399 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7400 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
7401 LDKCVec_u8Z ret_ref;
7402 ret_ref.datalen = *((uint32_t*)ret);
7403 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
7404 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
7407 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
7408 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
7409 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7411 static inline LDKScore LDKScore_init (/*TODO: JS Object Reference */void* o) {
7412 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
7413 atomic_init(&calls->refcnt, 1);
7414 //TODO: Assign calls->o from o
7417 .this_arg = (void*) calls,
7418 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
7419 .payment_path_failed = payment_path_failed_LDKScore_jcall,
7420 .write = write_LDKScore_jcall,
7421 .free = LDKScore_JCalls_free,
7425 long __attribute__((visibility("default"))) TS_LDKScore_new(/*TODO: JS Object Reference */void* o) {
7426 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
7427 *res_ptr = LDKScore_init(o);
7428 return (long)res_ptr;
7430 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) {
7431 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7432 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7433 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
7434 LDKNodeId source_conv;
7435 source_conv.inner = (void*)(source & (~1));
7436 source_conv.is_owned = false;
7437 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
7438 LDKNodeId target_conv;
7439 target_conv.inner = (void*)(target & (~1));
7440 target_conv.is_owned = false;
7441 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
7442 int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv);
7446 void __attribute__((visibility("default"))) TS_Score_payment_path_failed(uint32_t this_arg, uint32_tArray path, int64_t short_channel_id) {
7447 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7448 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7449 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
7450 LDKCVec_RouteHopZ path_constr;
7451 path_constr.datalen = *((uint32_t*)path);
7452 if (path_constr.datalen > 0)
7453 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7455 path_constr.data = NULL;
7456 uint32_t* path_vals = (uint32_t*)(path + 4);
7457 for (size_t k = 0; k < path_constr.datalen; k++) {
7458 uint32_t path_conv_10 = path_vals[k];
7459 LDKRouteHop path_conv_10_conv;
7460 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
7461 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
7462 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
7463 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
7464 path_constr.data[k] = path_conv_10_conv;
7466 (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
7469 int8_tArray __attribute__((visibility("default"))) TS_Score_write(uint32_t this_arg) {
7470 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7471 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7472 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
7473 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
7474 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7475 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
7476 CVec_u8Z_free(ret_var);
7480 typedef struct LDKChannelManagerPersister_JCalls {
7481 atomic_size_t refcnt;
7482 uint32_t persist_manager_meth;
7483 } LDKChannelManagerPersister_JCalls;
7484 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
7485 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
7486 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7487 js_free(j_calls->persist_manager_meth);
7491 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
7492 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
7493 LDKChannelManager channel_manager_var = *channel_manager;
7494 uint64_t channel_manager_ref = 0;
7495 // Warning: we may need a move here but no clone is available for LDKChannelManager
7496 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7497 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7498 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
7499 channel_manager_ref = (uint64_t)channel_manager_var.inner;
7500 if (channel_manager_var.is_owned) {
7501 channel_manager_ref |= 1;
7503 uint32_t ret = js_invoke_function_1(j_calls->persist_manager_meth, channel_manager_ref);
7504 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7505 CHECK_ACCESS(ret_ptr);
7506 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
7510 static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) {
7511 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg;
7512 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7514 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (/*TODO: JS Object Reference */void* o) {
7515 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
7516 atomic_init(&calls->refcnt, 1);
7517 //TODO: Assign calls->o from o
7519 LDKChannelManagerPersister ret = {
7520 .this_arg = (void*) calls,
7521 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
7522 .free = LDKChannelManagerPersister_JCalls_free,
7526 long __attribute__((visibility("default"))) TS_LDKChannelManagerPersister_new(/*TODO: JS Object Reference */void* o) {
7527 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
7528 *res_ptr = LDKChannelManagerPersister_init(o);
7529 return (long)res_ptr;
7531 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerPersister_persist_manager(uint32_t this_arg, uint32_t channel_manager) {
7532 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7533 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7534 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)this_arg_ptr;
7535 LDKChannelManager channel_manager_conv;
7536 channel_manager_conv.inner = (void*)(channel_manager & (~1));
7537 channel_manager_conv.is_owned = false;
7538 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
7539 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
7540 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
7541 return (uint64_t)ret_conv;
7544 uint32_t __attribute__((visibility("default"))) TS_LDKFallback_ref_from_ptr(uint32_t ptr) {
7545 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
7547 case LDKFallback_SegWitProgram: {
7548 uint8_t version_val = obj->seg_wit_program.version._0;
7549 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
7550 int8_tArray program_arr = init_arr(program_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7551 memcpy((uint8_t*)(program_arr + 4), program_var.data, program_var.datalen);
7552 return 0 /* LDKFallback - SegWitProgram */; (void) version_val; (void) program_arr;
7554 case LDKFallback_PubKeyHash: {
7555 int8_tArray pub_key_hash_arr = init_arr(20, sizeof(uint8_t), "Native int8_tArray Bytes");
7556 memcpy((uint8_t*)(pub_key_hash_arr + 4), obj->pub_key_hash.data, 20);
7557 return 0 /* LDKFallback - PubKeyHash */; (void) pub_key_hash_arr;
7559 case LDKFallback_ScriptHash: {
7560 int8_tArray script_hash_arr = init_arr(20, sizeof(uint8_t), "Native int8_tArray Bytes");
7561 memcpy((uint8_t*)(script_hash_arr + 4), obj->script_hash.data, 20);
7562 return 0 /* LDKFallback - ScriptHash */; (void) script_hash_arr;
7567 typedef struct LDKPayer_JCalls {
7568 atomic_size_t refcnt;
7569 uint32_t node_id_meth;
7570 uint32_t first_hops_meth;
7571 uint32_t send_payment_meth;
7572 uint32_t retry_payment_meth;
7574 static void LDKPayer_JCalls_free(void* this_arg) {
7575 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
7576 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7577 js_free(j_calls->node_id_meth);
7578 js_free(j_calls->first_hops_meth);
7579 js_free(j_calls->send_payment_meth);
7580 js_free(j_calls->retry_payment_meth);
7584 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
7585 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
7586 int8_tArray ret = js_invoke_function_0(j_calls->node_id_meth);
7587 LDKPublicKey ret_ref;
7588 CHECK(*((uint32_t*)ret) == 33);
7589 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
7592 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
7593 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
7594 uint32_tArray ret = js_invoke_function_0(j_calls->first_hops_meth);
7595 LDKCVec_ChannelDetailsZ ret_constr;
7596 ret_constr.datalen = *((uint32_t*)ret);
7597 if (ret_constr.datalen > 0)
7598 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7600 ret_constr.data = NULL;
7601 uint32_t* ret_vals = (uint32_t*)(ret + 4);
7602 for (size_t q = 0; q < ret_constr.datalen; q++) {
7603 uint32_t ret_conv_16 = ret_vals[q];
7604 LDKChannelDetails ret_conv_16_conv;
7605 ret_conv_16_conv.inner = (void*)(ret_conv_16 & (~1));
7606 ret_conv_16_conv.is_owned = (ret_conv_16 & 1) || (ret_conv_16 == 0);
7607 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
7608 ret_constr.data[q] = ret_conv_16_conv;
7612 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
7613 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
7614 LDKRoute route_var = *route;
7615 uint64_t route_ref = 0;
7616 route_var = Route_clone(route);
7617 CHECK((((uint64_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7618 CHECK((((uint64_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7619 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
7620 route_ref = (uint64_t)route_var.inner;
7621 if (route_var.is_owned) {
7624 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
7625 memcpy((uint8_t*)(payment_hash_arr + 4), payment_hash.data, 32);
7626 int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
7627 memcpy((uint8_t*)(payment_secret_arr + 4), payment_secret.data, 32);
7628 uint32_t ret = js_invoke_function_3(j_calls->send_payment_meth, route_ref, payment_hash_arr, payment_secret_arr);
7629 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7630 CHECK_ACCESS(ret_ptr);
7631 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
7635 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
7636 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
7637 LDKRoute route_var = *route;
7638 uint64_t route_ref = 0;
7639 route_var = Route_clone(route);
7640 CHECK((((uint64_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7641 CHECK((((uint64_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7642 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
7643 route_ref = (uint64_t)route_var.inner;
7644 if (route_var.is_owned) {
7647 int8_tArray payment_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
7648 memcpy((uint8_t*)(payment_id_arr + 4), payment_id.data, 32);
7649 uint32_t ret = js_invoke_function_2(j_calls->retry_payment_meth, route_ref, payment_id_arr);
7650 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7651 CHECK_ACCESS(ret_ptr);
7652 LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
7656 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
7657 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
7658 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7660 static inline LDKPayer LDKPayer_init (/*TODO: JS Object Reference */void* o) {
7661 LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
7662 atomic_init(&calls->refcnt, 1);
7663 //TODO: Assign calls->o from o
7666 .this_arg = (void*) calls,
7667 .node_id = node_id_LDKPayer_jcall,
7668 .first_hops = first_hops_LDKPayer_jcall,
7669 .send_payment = send_payment_LDKPayer_jcall,
7670 .retry_payment = retry_payment_LDKPayer_jcall,
7671 .free = LDKPayer_JCalls_free,
7675 long __attribute__((visibility("default"))) TS_LDKPayer_new(/*TODO: JS Object Reference */void* o) {
7676 LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
7677 *res_ptr = LDKPayer_init(o);
7678 return (long)res_ptr;
7680 int8_tArray __attribute__((visibility("default"))) TS_Payer_node_id(uint32_t this_arg) {
7681 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7682 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7683 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
7684 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
7685 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form, 33);
7689 uint32_tArray __attribute__((visibility("default"))) TS_Payer_first_hops(uint32_t this_arg) {
7690 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7691 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7692 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
7693 LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
7694 uint32_tArray ret_arr = NULL;
7695 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
7696 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
7697 for (size_t q = 0; q < ret_var.datalen; q++) {
7698 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
7699 uint64_t ret_conv_16_ref = 0;
7700 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7701 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7702 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
7703 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
7704 if (ret_conv_16_var.is_owned) {
7705 ret_conv_16_ref |= 1;
7707 ret_arr_ptr[q] = ret_conv_16_ref;
7714 uint32_t __attribute__((visibility("default"))) TS_Payer_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
7715 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7716 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7717 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
7718 LDKRoute route_conv;
7719 route_conv.inner = (void*)(route & (~1));
7720 route_conv.is_owned = false;
7721 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
7722 LDKThirtyTwoBytes payment_hash_ref;
7723 CHECK(*((uint32_t*)payment_hash) == 32);
7724 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
7725 LDKThirtyTwoBytes payment_secret_ref;
7726 CHECK(*((uint32_t*)payment_secret) == 32);
7727 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
7728 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
7729 *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
7730 return (uint64_t)ret_conv;
7733 uint32_t __attribute__((visibility("default"))) TS_Payer_retry_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_id) {
7734 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7735 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7736 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
7737 LDKRoute route_conv;
7738 route_conv.inner = (void*)(route & (~1));
7739 route_conv.is_owned = false;
7740 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
7741 LDKThirtyTwoBytes payment_id_ref;
7742 CHECK(*((uint32_t*)payment_id) == 32);
7743 memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32);
7744 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
7745 *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
7746 return (uint64_t)ret_conv;
7749 typedef struct LDKRouter_JCalls {
7750 atomic_size_t refcnt;
7751 uint32_t find_route_meth;
7753 static void LDKRouter_JCalls_free(void* this_arg) {
7754 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7755 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7756 js_free(j_calls->find_route_meth);
7760 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * params, LDKCVec_ChannelDetailsZ * first_hops, const LDKScore * scorer) {
7761 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7762 int8_tArray payer_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
7763 memcpy((uint8_t*)(payer_arr + 4), payer.compressed_form, 33);
7764 LDKRouteParameters params_var = *params;
7765 uint64_t params_ref = 0;
7766 params_var = RouteParameters_clone(params);
7767 CHECK((((uint64_t)params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7768 CHECK((((uint64_t)¶ms_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7769 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_var);
7770 params_ref = (uint64_t)params_var.inner;
7771 if (params_var.is_owned) {
7774 LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
7775 uint32_tArray first_hops_arr = NULL;
7776 if (first_hops != NULL) {
7777 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
7778 first_hops_arr = init_arr(first_hops_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
7779 uint32_t *first_hops_arr_ptr = (uint32_t*)(first_hops_arr + 4);
7780 for (size_t q = 0; q < first_hops_var.datalen; q++) {
7781 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
7782 uint64_t first_hops_conv_16_ref = 0;
7783 CHECK((((uint64_t)first_hops_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7784 CHECK((((uint64_t)&first_hops_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7785 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
7786 first_hops_conv_16_ref = (uint64_t)first_hops_conv_16_var.inner;
7787 if (first_hops_conv_16_var.is_owned) {
7788 first_hops_conv_16_ref |= 1;
7790 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
7794 // WARNING: This object doesn't live past this scope, needs clone!
7795 uint64_t ret_scorer = ((uint64_t)scorer) | 1;
7796 uint32_t ret = js_invoke_function_4(j_calls->find_route_meth, payer_arr, params_ref, first_hops_arr, ret_scorer);
7797 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7798 CHECK_ACCESS(ret_ptr);
7799 LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
7803 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
7804 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
7805 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7807 static inline LDKRouter LDKRouter_init (/*TODO: JS Object Reference */void* o) {
7808 LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
7809 atomic_init(&calls->refcnt, 1);
7810 //TODO: Assign calls->o from o
7813 .this_arg = (void*) calls,
7814 .find_route = find_route_LDKRouter_jcall,
7815 .free = LDKRouter_JCalls_free,
7819 long __attribute__((visibility("default"))) TS_LDKRouter_new(/*TODO: JS Object Reference */void* o) {
7820 LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
7821 *res_ptr = LDKRouter_init(o);
7822 return (long)res_ptr;
7824 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) {
7825 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7826 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7827 LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
7828 LDKPublicKey payer_ref;
7829 CHECK(*((uint32_t*)payer) == 33);
7830 memcpy(payer_ref.compressed_form, (uint8_t*)(payer + 4), 33);
7831 LDKRouteParameters params_conv;
7832 params_conv.inner = (void*)(params & (~1));
7833 params_conv.is_owned = false;
7834 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
7835 LDKCVec_ChannelDetailsZ first_hops_constr;
7836 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
7837 if (first_hops != 0) {
7838 first_hops_constr.datalen = *((uint32_t*)first_hops);
7839 if (first_hops_constr.datalen > 0)
7840 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7842 first_hops_constr.data = NULL;
7843 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
7844 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
7845 uint32_t first_hops_conv_16 = first_hops_vals[q];
7846 LDKChannelDetails first_hops_conv_16_conv;
7847 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
7848 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
7849 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
7850 first_hops_constr.data[q] = first_hops_conv_16_conv;
7852 first_hops_ptr = &first_hops_constr;
7854 void* scorer_ptr = (void*)(((uint64_t)scorer) & ~1);
7855 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
7856 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
7857 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7858 *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, ¶ms_conv, first_hops_ptr, scorer_conv);
7859 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
7860 return (uint64_t)ret_conv;
7863 jstring __attribute__((visibility("default"))) TS__ldk_get_compiled_version() {
7864 LDKStr ret_str = _ldk_get_compiled_version();
7865 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
7870 jstring __attribute__((visibility("default"))) TS__ldk_c_bindings_get_compiled_version() {
7871 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
7872 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
7877 void __attribute__((visibility("default"))) TS_Transaction_free(int8_tArray _res) {
7878 LDKTransaction _res_ref;
7879 _res_ref.datalen = *((uint32_t*)_res);
7880 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
7881 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
7882 _res_ref.data_is_owned = true;
7883 Transaction_free(_res_ref);
7886 uint32_t __attribute__((visibility("default"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
7887 LDKCVec_u8Z script_pubkey_ref;
7888 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
7889 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
7890 memcpy(script_pubkey_ref.data, (uint8_t*)(script_pubkey + 4), script_pubkey_ref.datalen);
7891 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7892 *ret_ref = TxOut_new(script_pubkey_ref, value);
7893 return (uint64_t)ret_ref;
7896 void __attribute__((visibility("default"))) TS_TxOut_free(uint32_t _res) {
7897 if ((_res & 1) != 0) return;
7898 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7899 CHECK_ACCESS(_res_ptr);
7900 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
7902 TxOut_free(_res_conv);
7905 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
7906 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7907 *ret_ref = TxOut_clone(arg);
7908 return (uint64_t)ret_ref;
7910 int64_t __attribute__((visibility("default"))) TS_TxOut_clone_ptr(uint32_t arg) {
7911 LDKTxOut* arg_conv = (LDKTxOut*)(arg & ~1);
7912 int64_t ret_val = TxOut_clone_ptr(arg_conv);
7916 uint32_t __attribute__((visibility("default"))) TS_TxOut_clone(uint32_t orig) {
7917 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
7918 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7919 *ret_ref = TxOut_clone(orig_conv);
7920 return (uint64_t)ret_ref;
7923 void __attribute__((visibility("default"))) TS_Str_free(jstring _res) {
7924 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
7928 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
7930 CHECK(*((uint32_t*)o) == 32);
7931 memcpy(o_ref.bytes, (uint8_t*)(o + 4), 32);
7932 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
7933 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
7934 return (uint64_t)ret_conv;
7937 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
7938 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
7939 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
7940 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
7941 return (uint64_t)ret_conv;
7944 jboolean __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_is_ok(uint32_t o) {
7945 LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)(o & ~1);
7946 jboolean ret_val = CResult_SecretKeyErrorZ_is_ok(o_conv);
7950 void __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
7951 if ((_res & 1) != 0) return;
7952 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7953 CHECK_ACCESS(_res_ptr);
7954 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
7956 CResult_SecretKeyErrorZ_free(_res_conv);
7959 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
7961 CHECK(*((uint32_t*)o) == 33);
7962 memcpy(o_ref.compressed_form, (uint8_t*)(o + 4), 33);
7963 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
7964 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
7965 return (uint64_t)ret_conv;
7968 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
7969 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
7970 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
7971 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
7972 return (uint64_t)ret_conv;
7975 jboolean __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_is_ok(uint32_t o) {
7976 LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)(o & ~1);
7977 jboolean ret_val = CResult_PublicKeyErrorZ_is_ok(o_conv);
7981 void __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
7982 if ((_res & 1) != 0) return;
7983 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
7984 CHECK_ACCESS(_res_ptr);
7985 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
7987 CResult_PublicKeyErrorZ_free(_res_conv);
7990 static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
7991 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
7992 *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
7993 return (uint64_t)ret_conv;
7995 int64_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint32_t arg) {
7996 LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
7997 int64_t ret_val = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
8001 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_clone(uint32_t orig) {
8002 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
8003 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8004 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
8005 return (uint64_t)ret_conv;
8008 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
8009 LDKTxCreationKeys o_conv;
8010 o_conv.inner = (void*)(o & (~1));
8011 o_conv.is_owned = (o & 1) || (o == 0);
8012 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8013 o_conv = TxCreationKeys_clone(&o_conv);
8014 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8015 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
8016 return (uint64_t)ret_conv;
8019 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
8020 LDKDecodeError e_conv;
8021 e_conv.inner = (void*)(e & (~1));
8022 e_conv.is_owned = (e & 1) || (e == 0);
8023 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8024 e_conv = DecodeError_clone(&e_conv);
8025 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8026 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
8027 return (uint64_t)ret_conv;
8030 jboolean __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint32_t o) {
8031 LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(o & ~1);
8032 jboolean ret_val = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
8036 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
8037 if ((_res & 1) != 0) return;
8038 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8039 CHECK_ACCESS(_res_ptr);
8040 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
8042 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
8045 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
8046 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8047 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
8048 return (uint64_t)ret_conv;
8050 int64_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint32_t arg) {
8051 LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
8052 int64_t ret_val = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
8056 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
8057 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
8058 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8059 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
8060 return (uint64_t)ret_conv;
8063 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
8064 LDKChannelPublicKeys o_conv;
8065 o_conv.inner = (void*)(o & (~1));
8066 o_conv.is_owned = (o & 1) || (o == 0);
8067 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8068 o_conv = ChannelPublicKeys_clone(&o_conv);
8069 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8070 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
8071 return (uint64_t)ret_conv;
8074 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
8075 LDKDecodeError e_conv;
8076 e_conv.inner = (void*)(e & (~1));
8077 e_conv.is_owned = (e & 1) || (e == 0);
8078 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8079 e_conv = DecodeError_clone(&e_conv);
8080 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8081 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
8082 return (uint64_t)ret_conv;
8085 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint32_t o) {
8086 LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(o & ~1);
8087 jboolean ret_val = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
8091 void __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
8092 if ((_res & 1) != 0) return;
8093 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8094 CHECK_ACCESS(_res_ptr);
8095 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
8097 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
8100 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
8101 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8102 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
8103 return (uint64_t)ret_conv;
8105 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint32_t arg) {
8106 LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
8107 int64_t ret_val = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
8111 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
8112 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
8113 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8114 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
8115 return (uint64_t)ret_conv;
8118 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
8119 LDKTxCreationKeys o_conv;
8120 o_conv.inner = (void*)(o & (~1));
8121 o_conv.is_owned = (o & 1) || (o == 0);
8122 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8123 o_conv = TxCreationKeys_clone(&o_conv);
8124 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8125 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
8126 return (uint64_t)ret_conv;
8129 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
8130 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
8131 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8132 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
8133 return (uint64_t)ret_conv;
8136 jboolean __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_is_ok(uint32_t o) {
8137 LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)(o & ~1);
8138 jboolean ret_val = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
8142 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
8143 if ((_res & 1) != 0) return;
8144 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8145 CHECK_ACCESS(_res_ptr);
8146 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
8148 CResult_TxCreationKeysErrorZ_free(_res_conv);
8151 static inline uint64_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
8152 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8153 *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
8154 return (uint64_t)ret_conv;
8156 int64_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_clone_ptr(uint32_t arg) {
8157 LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
8158 int64_t ret_val = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
8162 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_clone(uint32_t orig) {
8163 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
8164 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8165 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
8166 return (uint64_t)ret_conv;
8169 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_some(int32_t o) {
8170 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
8171 *ret_copy = COption_u32Z_some(o);
8172 uint64_t ret_ref = (uint64_t)ret_copy;
8176 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_none() {
8177 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
8178 *ret_copy = COption_u32Z_none();
8179 uint64_t ret_ref = (uint64_t)ret_copy;
8183 void __attribute__((visibility("default"))) TS_COption_u32Z_free(uint32_t _res) {
8184 if ((_res & 1) != 0) return;
8185 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8186 CHECK_ACCESS(_res_ptr);
8187 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
8189 COption_u32Z_free(_res_conv);
8192 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
8193 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
8194 *ret_copy = COption_u32Z_clone(arg);
8195 uint64_t ret_ref = (uint64_t)ret_copy;
8198 int64_t __attribute__((visibility("default"))) TS_COption_u32Z_clone_ptr(uint32_t arg) {
8199 LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)arg;
8200 int64_t ret_val = COption_u32Z_clone_ptr(arg_conv);
8204 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_clone(uint32_t orig) {
8205 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
8206 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
8207 *ret_copy = COption_u32Z_clone(orig_conv);
8208 uint64_t ret_ref = (uint64_t)ret_copy;
8212 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
8213 LDKHTLCOutputInCommitment o_conv;
8214 o_conv.inner = (void*)(o & (~1));
8215 o_conv.is_owned = (o & 1) || (o == 0);
8216 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8217 o_conv = HTLCOutputInCommitment_clone(&o_conv);
8218 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
8219 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
8220 return (uint64_t)ret_conv;
8223 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
8224 LDKDecodeError e_conv;
8225 e_conv.inner = (void*)(e & (~1));
8226 e_conv.is_owned = (e & 1) || (e == 0);
8227 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8228 e_conv = DecodeError_clone(&e_conv);
8229 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
8230 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
8231 return (uint64_t)ret_conv;
8234 jboolean __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint32_t o) {
8235 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(o & ~1);
8236 jboolean ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
8240 void __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
8241 if ((_res & 1) != 0) return;
8242 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8243 CHECK_ACCESS(_res_ptr);
8244 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
8246 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
8249 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
8250 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
8251 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
8252 return (uint64_t)ret_conv;
8254 int64_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint32_t arg) {
8255 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
8256 int64_t ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
8260 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
8261 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
8262 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
8263 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
8264 return (uint64_t)ret_conv;
8267 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
8268 LDKCounterpartyChannelTransactionParameters o_conv;
8269 o_conv.inner = (void*)(o & (~1));
8270 o_conv.is_owned = (o & 1) || (o == 0);
8271 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8272 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
8273 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
8274 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
8275 return (uint64_t)ret_conv;
8278 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
8279 LDKDecodeError e_conv;
8280 e_conv.inner = (void*)(e & (~1));
8281 e_conv.is_owned = (e & 1) || (e == 0);
8282 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8283 e_conv = DecodeError_clone(&e_conv);
8284 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
8285 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
8286 return (uint64_t)ret_conv;
8289 jboolean __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint32_t o) {
8290 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(o & ~1);
8291 jboolean ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
8295 void __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
8296 if ((_res & 1) != 0) return;
8297 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8298 CHECK_ACCESS(_res_ptr);
8299 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
8301 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
8304 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
8305 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
8306 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
8307 return (uint64_t)ret_conv;
8309 int64_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
8310 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
8311 int64_t ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
8315 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
8316 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
8317 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
8318 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
8319 return (uint64_t)ret_conv;
8322 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
8323 LDKChannelTransactionParameters o_conv;
8324 o_conv.inner = (void*)(o & (~1));
8325 o_conv.is_owned = (o & 1) || (o == 0);
8326 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8327 o_conv = ChannelTransactionParameters_clone(&o_conv);
8328 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
8329 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
8330 return (uint64_t)ret_conv;
8333 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
8334 LDKDecodeError e_conv;
8335 e_conv.inner = (void*)(e & (~1));
8336 e_conv.is_owned = (e & 1) || (e == 0);
8337 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8338 e_conv = DecodeError_clone(&e_conv);
8339 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
8340 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
8341 return (uint64_t)ret_conv;
8344 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint32_t o) {
8345 LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(o & ~1);
8346 jboolean ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
8350 void __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
8351 if ((_res & 1) != 0) return;
8352 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8353 CHECK_ACCESS(_res_ptr);
8354 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
8356 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
8359 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
8360 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
8361 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
8362 return (uint64_t)ret_conv;
8364 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
8365 LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
8366 int64_t ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
8370 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
8371 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
8372 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
8373 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
8374 return (uint64_t)ret_conv;
8377 void __attribute__((visibility("default"))) TS_CVec_SignatureZ_free(ptrArray _res) {
8378 LDKCVec_SignatureZ _res_constr;
8379 _res_constr.datalen = *((uint32_t*)_res);
8380 if (_res_constr.datalen > 0)
8381 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8383 _res_constr.data = NULL;
8384 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
8385 for (size_t m = 0; m < _res_constr.datalen; m++) {
8386 int8_tArray _res_conv_12 = _res_vals[m];
8387 LDKSignature _res_conv_12_ref;
8388 CHECK(*((uint32_t*)_res_conv_12) == 64);
8389 memcpy(_res_conv_12_ref.compact_form, (uint8_t*)(_res_conv_12 + 4), 64);
8390 _res_constr.data[m] = _res_conv_12_ref;
8392 CVec_SignatureZ_free(_res_constr);
8395 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
8396 LDKHolderCommitmentTransaction o_conv;
8397 o_conv.inner = (void*)(o & (~1));
8398 o_conv.is_owned = (o & 1) || (o == 0);
8399 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8400 o_conv = HolderCommitmentTransaction_clone(&o_conv);
8401 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
8402 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
8403 return (uint64_t)ret_conv;
8406 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
8407 LDKDecodeError e_conv;
8408 e_conv.inner = (void*)(e & (~1));
8409 e_conv.is_owned = (e & 1) || (e == 0);
8410 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8411 e_conv = DecodeError_clone(&e_conv);
8412 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
8413 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
8414 return (uint64_t)ret_conv;
8417 jboolean __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
8418 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(o & ~1);
8419 jboolean ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
8423 void __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
8424 if ((_res & 1) != 0) return;
8425 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8426 CHECK_ACCESS(_res_ptr);
8427 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
8429 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
8432 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
8433 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
8434 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
8435 return (uint64_t)ret_conv;
8437 int64_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
8438 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
8439 int64_t ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
8443 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
8444 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
8445 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
8446 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
8447 return (uint64_t)ret_conv;
8450 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
8451 LDKBuiltCommitmentTransaction o_conv;
8452 o_conv.inner = (void*)(o & (~1));
8453 o_conv.is_owned = (o & 1) || (o == 0);
8454 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8455 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
8456 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
8457 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
8458 return (uint64_t)ret_conv;
8461 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
8462 LDKDecodeError e_conv;
8463 e_conv.inner = (void*)(e & (~1));
8464 e_conv.is_owned = (e & 1) || (e == 0);
8465 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8466 e_conv = DecodeError_clone(&e_conv);
8467 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
8468 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
8469 return (uint64_t)ret_conv;
8472 jboolean __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
8473 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(o & ~1);
8474 jboolean ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
8478 void __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
8479 if ((_res & 1) != 0) return;
8480 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8481 CHECK_ACCESS(_res_ptr);
8482 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
8484 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
8487 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
8488 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
8489 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
8490 return (uint64_t)ret_conv;
8492 int64_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
8493 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
8494 int64_t ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
8498 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
8499 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
8500 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
8501 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
8502 return (uint64_t)ret_conv;
8505 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint32_t o) {
8506 LDKTrustedClosingTransaction o_conv;
8507 o_conv.inner = (void*)(o & (~1));
8508 o_conv.is_owned = (o & 1) || (o == 0);
8509 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8510 // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction
8511 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
8512 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
8513 return (uint64_t)ret_conv;
8516 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
8517 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
8518 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
8519 return (uint64_t)ret_conv;
8522 jboolean __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint32_t o) {
8523 LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(o & ~1);
8524 jboolean ret_val = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
8528 void __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint32_t _res) {
8529 if ((_res & 1) != 0) return;
8530 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8531 CHECK_ACCESS(_res_ptr);
8532 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
8534 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
8537 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
8538 LDKCommitmentTransaction o_conv;
8539 o_conv.inner = (void*)(o & (~1));
8540 o_conv.is_owned = (o & 1) || (o == 0);
8541 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8542 o_conv = CommitmentTransaction_clone(&o_conv);
8543 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
8544 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
8545 return (uint64_t)ret_conv;
8548 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
8549 LDKDecodeError e_conv;
8550 e_conv.inner = (void*)(e & (~1));
8551 e_conv.is_owned = (e & 1) || (e == 0);
8552 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8553 e_conv = DecodeError_clone(&e_conv);
8554 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
8555 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
8556 return (uint64_t)ret_conv;
8559 jboolean __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
8560 LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(o & ~1);
8561 jboolean ret_val = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
8565 void __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
8566 if ((_res & 1) != 0) return;
8567 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8568 CHECK_ACCESS(_res_ptr);
8569 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
8571 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
8574 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
8575 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
8576 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
8577 return (uint64_t)ret_conv;
8579 int64_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
8580 LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
8581 int64_t ret_val = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
8585 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
8586 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
8587 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
8588 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
8589 return (uint64_t)ret_conv;
8592 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
8593 LDKTrustedCommitmentTransaction o_conv;
8594 o_conv.inner = (void*)(o & (~1));
8595 o_conv.is_owned = (o & 1) || (o == 0);
8596 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8597 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
8598 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
8599 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
8600 return (uint64_t)ret_conv;
8603 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
8604 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
8605 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
8606 return (uint64_t)ret_conv;
8609 jboolean __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint32_t o) {
8610 LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(o & ~1);
8611 jboolean ret_val = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
8615 void __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
8616 if ((_res & 1) != 0) return;
8617 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8618 CHECK_ACCESS(_res_ptr);
8619 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
8621 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
8624 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
8625 LDKCVec_SignatureZ o_constr;
8626 o_constr.datalen = *((uint32_t*)o);
8627 if (o_constr.datalen > 0)
8628 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8630 o_constr.data = NULL;
8631 int8_tArray* o_vals = (int8_tArray*)(o + 4);
8632 for (size_t m = 0; m < o_constr.datalen; m++) {
8633 int8_tArray o_conv_12 = o_vals[m];
8634 LDKSignature o_conv_12_ref;
8635 CHECK(*((uint32_t*)o_conv_12) == 64);
8636 memcpy(o_conv_12_ref.compact_form, (uint8_t*)(o_conv_12 + 4), 64);
8637 o_constr.data[m] = o_conv_12_ref;
8639 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
8640 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
8641 return (uint64_t)ret_conv;
8644 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_err() {
8645 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
8646 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
8647 return (uint64_t)ret_conv;
8650 jboolean __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_is_ok(uint32_t o) {
8651 LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)(o & ~1);
8652 jboolean ret_val = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
8656 void __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
8657 if ((_res & 1) != 0) return;
8658 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8659 CHECK_ACCESS(_res_ptr);
8660 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
8662 CResult_CVec_SignatureZNoneZ_free(_res_conv);
8665 static inline uint64_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
8666 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
8667 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
8668 return (uint64_t)ret_conv;
8670 int64_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_clone_ptr(uint32_t arg) {
8671 LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
8672 int64_t ret_val = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
8676 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
8677 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
8678 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
8679 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
8680 return (uint64_t)ret_conv;
8683 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint32_t o) {
8684 LDKShutdownScript o_conv;
8685 o_conv.inner = (void*)(o & (~1));
8686 o_conv.is_owned = (o & 1) || (o == 0);
8687 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8688 o_conv = ShutdownScript_clone(&o_conv);
8689 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
8690 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
8691 return (uint64_t)ret_conv;
8694 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint32_t e) {
8695 LDKDecodeError e_conv;
8696 e_conv.inner = (void*)(e & (~1));
8697 e_conv.is_owned = (e & 1) || (e == 0);
8698 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8699 e_conv = DecodeError_clone(&e_conv);
8700 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
8701 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
8702 return (uint64_t)ret_conv;
8705 jboolean __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint32_t o) {
8706 LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(o & ~1);
8707 jboolean ret_val = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
8711 void __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint32_t _res) {
8712 if ((_res & 1) != 0) return;
8713 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8714 CHECK_ACCESS(_res_ptr);
8715 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
8717 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
8720 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
8721 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
8722 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
8723 return (uint64_t)ret_conv;
8725 int64_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint32_t arg) {
8726 LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
8727 int64_t ret_val = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
8731 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint32_t orig) {
8732 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
8733 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
8734 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
8735 return (uint64_t)ret_conv;
8738 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint32_t o) {
8739 LDKShutdownScript o_conv;
8740 o_conv.inner = (void*)(o & (~1));
8741 o_conv.is_owned = (o & 1) || (o == 0);
8742 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8743 o_conv = ShutdownScript_clone(&o_conv);
8744 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
8745 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
8746 return (uint64_t)ret_conv;
8749 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint32_t e) {
8750 LDKInvalidShutdownScript e_conv;
8751 e_conv.inner = (void*)(e & (~1));
8752 e_conv.is_owned = (e & 1) || (e == 0);
8753 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8754 e_conv = InvalidShutdownScript_clone(&e_conv);
8755 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
8756 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
8757 return (uint64_t)ret_conv;
8760 jboolean __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint32_t o) {
8761 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(o & ~1);
8762 jboolean ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
8766 void __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint32_t _res) {
8767 if ((_res & 1) != 0) return;
8768 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8769 CHECK_ACCESS(_res_ptr);
8770 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
8772 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
8775 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
8776 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
8777 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
8778 return (uint64_t)ret_conv;
8780 int64_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint32_t arg) {
8781 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
8782 int64_t ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
8786 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint32_t orig) {
8787 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
8788 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
8789 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
8790 return (uint64_t)ret_conv;
8793 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_ok() {
8794 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8795 *ret_conv = CResult_NoneErrorZ_ok();
8796 return (uint64_t)ret_conv;
8799 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
8800 LDKIOError e_conv = LDKIOError_from_js(e);
8801 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8802 *ret_conv = CResult_NoneErrorZ_err(e_conv);
8803 return (uint64_t)ret_conv;
8806 jboolean __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_is_ok(uint32_t o) {
8807 LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)(o & ~1);
8808 jboolean ret_val = CResult_NoneErrorZ_is_ok(o_conv);
8812 void __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_free(uint32_t _res) {
8813 if ((_res & 1) != 0) return;
8814 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8815 CHECK_ACCESS(_res_ptr);
8816 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
8818 CResult_NoneErrorZ_free(_res_conv);
8821 static inline uint64_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
8822 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8823 *ret_conv = CResult_NoneErrorZ_clone(arg);
8824 return (uint64_t)ret_conv;
8826 int64_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_clone_ptr(uint32_t arg) {
8827 LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)(arg & ~1);
8828 int64_t ret_val = CResult_NoneErrorZ_clone_ptr(arg_conv);
8832 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_clone(uint32_t orig) {
8833 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
8834 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8835 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
8836 return (uint64_t)ret_conv;
8839 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint32_t o) {
8841 o_conv.inner = (void*)(o & (~1));
8842 o_conv.is_owned = (o & 1) || (o == 0);
8843 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8844 o_conv = RouteHop_clone(&o_conv);
8845 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
8846 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
8847 return (uint64_t)ret_conv;
8850 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_err(uint32_t e) {
8851 LDKDecodeError e_conv;
8852 e_conv.inner = (void*)(e & (~1));
8853 e_conv.is_owned = (e & 1) || (e == 0);
8854 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8855 e_conv = DecodeError_clone(&e_conv);
8856 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
8857 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
8858 return (uint64_t)ret_conv;
8861 jboolean __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint32_t o) {
8862 LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)(o & ~1);
8863 jboolean ret_val = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
8867 void __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_free(uint32_t _res) {
8868 if ((_res & 1) != 0) return;
8869 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8870 CHECK_ACCESS(_res_ptr);
8871 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
8873 CResult_RouteHopDecodeErrorZ_free(_res_conv);
8876 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
8877 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
8878 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
8879 return (uint64_t)ret_conv;
8881 int64_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint32_t arg) {
8882 LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
8883 int64_t ret_val = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
8887 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint32_t orig) {
8888 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
8889 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
8890 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
8891 return (uint64_t)ret_conv;
8894 void __attribute__((visibility("default"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
8895 LDKCVec_RouteHopZ _res_constr;
8896 _res_constr.datalen = *((uint32_t*)_res);
8897 if (_res_constr.datalen > 0)
8898 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8900 _res_constr.data = NULL;
8901 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8902 for (size_t k = 0; k < _res_constr.datalen; k++) {
8903 uint32_t _res_conv_10 = _res_vals[k];
8904 LDKRouteHop _res_conv_10_conv;
8905 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
8906 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
8907 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
8908 _res_constr.data[k] = _res_conv_10_conv;
8910 CVec_RouteHopZ_free(_res_constr);
8913 void __attribute__((visibility("default"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
8914 LDKCVec_CVec_RouteHopZZ _res_constr;
8915 _res_constr.datalen = *((uint32_t*)_res);
8916 if (_res_constr.datalen > 0)
8917 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
8919 _res_constr.data = NULL;
8920 uint32_tArray* _res_vals = (uint32_tArray*)(_res + 4);
8921 for (size_t m = 0; m < _res_constr.datalen; m++) {
8922 uint32_tArray _res_conv_12 = _res_vals[m];
8923 LDKCVec_RouteHopZ _res_conv_12_constr;
8924 _res_conv_12_constr.datalen = *((uint32_t*)_res_conv_12);
8925 if (_res_conv_12_constr.datalen > 0)
8926 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8928 _res_conv_12_constr.data = NULL;
8929 uint32_t* _res_conv_12_vals = (uint32_t*)(_res_conv_12 + 4);
8930 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
8931 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
8932 LDKRouteHop _res_conv_12_conv_10_conv;
8933 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
8934 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
8935 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
8936 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
8938 _res_constr.data[m] = _res_conv_12_constr;
8940 CVec_CVec_RouteHopZZ_free(_res_constr);
8943 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
8945 o_conv.inner = (void*)(o & (~1));
8946 o_conv.is_owned = (o & 1) || (o == 0);
8947 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8948 o_conv = Route_clone(&o_conv);
8949 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8950 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
8951 return (uint64_t)ret_conv;
8954 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
8955 LDKDecodeError e_conv;
8956 e_conv.inner = (void*)(e & (~1));
8957 e_conv.is_owned = (e & 1) || (e == 0);
8958 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8959 e_conv = DecodeError_clone(&e_conv);
8960 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8961 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
8962 return (uint64_t)ret_conv;
8965 jboolean __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint32_t o) {
8966 LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)(o & ~1);
8967 jboolean ret_val = CResult_RouteDecodeErrorZ_is_ok(o_conv);
8971 void __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
8972 if ((_res & 1) != 0) return;
8973 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8974 CHECK_ACCESS(_res_ptr);
8975 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
8977 CResult_RouteDecodeErrorZ_free(_res_conv);
8980 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
8981 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8982 *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
8983 return (uint64_t)ret_conv;
8985 int64_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint32_t arg) {
8986 LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
8987 int64_t ret_val = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
8991 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
8992 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
8993 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8994 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
8995 return (uint64_t)ret_conv;
8998 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint32_t o) {
8999 LDKRouteParameters o_conv;
9000 o_conv.inner = (void*)(o & (~1));
9001 o_conv.is_owned = (o & 1) || (o == 0);
9002 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9003 o_conv = RouteParameters_clone(&o_conv);
9004 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
9005 *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
9006 return (uint64_t)ret_conv;
9009 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint32_t e) {
9010 LDKDecodeError e_conv;
9011 e_conv.inner = (void*)(e & (~1));
9012 e_conv.is_owned = (e & 1) || (e == 0);
9013 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9014 e_conv = DecodeError_clone(&e_conv);
9015 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
9016 *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
9017 return (uint64_t)ret_conv;
9020 jboolean __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint32_t o) {
9021 LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(o & ~1);
9022 jboolean ret_val = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
9026 void __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint32_t _res) {
9027 if ((_res & 1) != 0) return;
9028 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9029 CHECK_ACCESS(_res_ptr);
9030 LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
9032 CResult_RouteParametersDecodeErrorZ_free(_res_conv);
9035 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
9036 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
9037 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
9038 return (uint64_t)ret_conv;
9040 int64_t __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
9041 LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
9042 int64_t ret_val = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
9046 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint32_t orig) {
9047 LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(orig & ~1);
9048 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
9049 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
9050 return (uint64_t)ret_conv;
9053 void __attribute__((visibility("default"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
9054 LDKCVec_RouteHintZ _res_constr;
9055 _res_constr.datalen = *((uint32_t*)_res);
9056 if (_res_constr.datalen > 0)
9057 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
9059 _res_constr.data = NULL;
9060 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9061 for (size_t l = 0; l < _res_constr.datalen; l++) {
9062 uint32_t _res_conv_11 = _res_vals[l];
9063 LDKRouteHint _res_conv_11_conv;
9064 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
9065 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
9066 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
9067 _res_constr.data[l] = _res_conv_11_conv;
9069 CVec_RouteHintZ_free(_res_constr);
9072 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_some(int64_t o) {
9073 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9074 *ret_copy = COption_u64Z_some(o);
9075 uint64_t ret_ref = (uint64_t)ret_copy;
9079 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_none() {
9080 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9081 *ret_copy = COption_u64Z_none();
9082 uint64_t ret_ref = (uint64_t)ret_copy;
9086 void __attribute__((visibility("default"))) TS_COption_u64Z_free(uint32_t _res) {
9087 if ((_res & 1) != 0) return;
9088 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9089 CHECK_ACCESS(_res_ptr);
9090 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
9092 COption_u64Z_free(_res_conv);
9095 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
9096 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9097 *ret_copy = COption_u64Z_clone(arg);
9098 uint64_t ret_ref = (uint64_t)ret_copy;
9101 int64_t __attribute__((visibility("default"))) TS_COption_u64Z_clone_ptr(uint32_t arg) {
9102 LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)arg;
9103 int64_t ret_val = COption_u64Z_clone_ptr(arg_conv);
9107 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_clone(uint32_t orig) {
9108 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
9109 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9110 *ret_copy = COption_u64Z_clone(orig_conv);
9111 uint64_t ret_ref = (uint64_t)ret_copy;
9115 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_ok(uint32_t o) {
9117 o_conv.inner = (void*)(o & (~1));
9118 o_conv.is_owned = (o & 1) || (o == 0);
9119 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9120 o_conv = Payee_clone(&o_conv);
9121 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
9122 *ret_conv = CResult_PayeeDecodeErrorZ_ok(o_conv);
9123 return (uint64_t)ret_conv;
9126 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_err(uint32_t e) {
9127 LDKDecodeError e_conv;
9128 e_conv.inner = (void*)(e & (~1));
9129 e_conv.is_owned = (e & 1) || (e == 0);
9130 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9131 e_conv = DecodeError_clone(&e_conv);
9132 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
9133 *ret_conv = CResult_PayeeDecodeErrorZ_err(e_conv);
9134 return (uint64_t)ret_conv;
9137 jboolean __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_is_ok(uint32_t o) {
9138 LDKCResult_PayeeDecodeErrorZ* o_conv = (LDKCResult_PayeeDecodeErrorZ*)(o & ~1);
9139 jboolean ret_val = CResult_PayeeDecodeErrorZ_is_ok(o_conv);
9143 void __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_free(uint32_t _res) {
9144 if ((_res & 1) != 0) return;
9145 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9146 CHECK_ACCESS(_res_ptr);
9147 LDKCResult_PayeeDecodeErrorZ _res_conv = *(LDKCResult_PayeeDecodeErrorZ*)(_res_ptr);
9149 CResult_PayeeDecodeErrorZ_free(_res_conv);
9152 static inline uint64_t CResult_PayeeDecodeErrorZ_clone_ptr(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR arg) {
9153 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
9154 *ret_conv = CResult_PayeeDecodeErrorZ_clone(arg);
9155 return (uint64_t)ret_conv;
9157 int64_t __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_clone_ptr(uint32_t arg) {
9158 LDKCResult_PayeeDecodeErrorZ* arg_conv = (LDKCResult_PayeeDecodeErrorZ*)(arg & ~1);
9159 int64_t ret_val = CResult_PayeeDecodeErrorZ_clone_ptr(arg_conv);
9163 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_clone(uint32_t orig) {
9164 LDKCResult_PayeeDecodeErrorZ* orig_conv = (LDKCResult_PayeeDecodeErrorZ*)(orig & ~1);
9165 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
9166 *ret_conv = CResult_PayeeDecodeErrorZ_clone(orig_conv);
9167 return (uint64_t)ret_conv;
9170 void __attribute__((visibility("default"))) TS_CVec_RouteHintHopZ_free(uint32_tArray _res) {
9171 LDKCVec_RouteHintHopZ _res_constr;
9172 _res_constr.datalen = *((uint32_t*)_res);
9173 if (_res_constr.datalen > 0)
9174 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
9176 _res_constr.data = NULL;
9177 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9178 for (size_t o = 0; o < _res_constr.datalen; o++) {
9179 uint32_t _res_conv_14 = _res_vals[o];
9180 LDKRouteHintHop _res_conv_14_conv;
9181 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
9182 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
9183 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
9184 _res_constr.data[o] = _res_conv_14_conv;
9186 CVec_RouteHintHopZ_free(_res_constr);
9189 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint32_t o) {
9190 LDKRouteHint o_conv;
9191 o_conv.inner = (void*)(o & (~1));
9192 o_conv.is_owned = (o & 1) || (o == 0);
9193 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9194 o_conv = RouteHint_clone(&o_conv);
9195 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
9196 *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
9197 return (uint64_t)ret_conv;
9200 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_err(uint32_t e) {
9201 LDKDecodeError e_conv;
9202 e_conv.inner = (void*)(e & (~1));
9203 e_conv.is_owned = (e & 1) || (e == 0);
9204 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9205 e_conv = DecodeError_clone(&e_conv);
9206 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
9207 *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
9208 return (uint64_t)ret_conv;
9211 jboolean __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint32_t o) {
9212 LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)(o & ~1);
9213 jboolean ret_val = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
9217 void __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_free(uint32_t _res) {
9218 if ((_res & 1) != 0) return;
9219 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9220 CHECK_ACCESS(_res_ptr);
9221 LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
9223 CResult_RouteHintDecodeErrorZ_free(_res_conv);
9226 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
9227 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
9228 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
9229 return (uint64_t)ret_conv;
9231 int64_t __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint32_t arg) {
9232 LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
9233 int64_t ret_val = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
9237 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint32_t orig) {
9238 LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)(orig & ~1);
9239 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
9240 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
9241 return (uint64_t)ret_conv;
9244 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint32_t o) {
9245 LDKRouteHintHop o_conv;
9246 o_conv.inner = (void*)(o & (~1));
9247 o_conv.is_owned = (o & 1) || (o == 0);
9248 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9249 o_conv = RouteHintHop_clone(&o_conv);
9250 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
9251 *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
9252 return (uint64_t)ret_conv;
9255 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint32_t e) {
9256 LDKDecodeError e_conv;
9257 e_conv.inner = (void*)(e & (~1));
9258 e_conv.is_owned = (e & 1) || (e == 0);
9259 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9260 e_conv = DecodeError_clone(&e_conv);
9261 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
9262 *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
9263 return (uint64_t)ret_conv;
9266 jboolean __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint32_t o) {
9267 LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(o & ~1);
9268 jboolean ret_val = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
9272 void __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint32_t _res) {
9273 if ((_res & 1) != 0) return;
9274 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9275 CHECK_ACCESS(_res_ptr);
9276 LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
9278 CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
9281 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
9282 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
9283 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
9284 return (uint64_t)ret_conv;
9286 int64_t __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint32_t arg) {
9287 LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
9288 int64_t ret_val = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
9292 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint32_t orig) {
9293 LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(orig & ~1);
9294 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
9295 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
9296 return (uint64_t)ret_conv;
9299 void __attribute__((visibility("default"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
9300 LDKCVec_ChannelDetailsZ _res_constr;
9301 _res_constr.datalen = *((uint32_t*)_res);
9302 if (_res_constr.datalen > 0)
9303 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
9305 _res_constr.data = NULL;
9306 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9307 for (size_t q = 0; q < _res_constr.datalen; q++) {
9308 uint32_t _res_conv_16 = _res_vals[q];
9309 LDKChannelDetails _res_conv_16_conv;
9310 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
9311 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
9312 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
9313 _res_constr.data[q] = _res_conv_16_conv;
9315 CVec_ChannelDetailsZ_free(_res_constr);
9318 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
9320 o_conv.inner = (void*)(o & (~1));
9321 o_conv.is_owned = (o & 1) || (o == 0);
9322 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9323 o_conv = Route_clone(&o_conv);
9324 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9325 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
9326 return (uint64_t)ret_conv;
9329 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
9330 LDKLightningError e_conv;
9331 e_conv.inner = (void*)(e & (~1));
9332 e_conv.is_owned = (e & 1) || (e == 0);
9333 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9334 e_conv = LightningError_clone(&e_conv);
9335 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9336 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
9337 return (uint64_t)ret_conv;
9340 jboolean __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_is_ok(uint32_t o) {
9341 LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)(o & ~1);
9342 jboolean ret_val = CResult_RouteLightningErrorZ_is_ok(o_conv);
9346 void __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
9347 if ((_res & 1) != 0) return;
9348 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9349 CHECK_ACCESS(_res_ptr);
9350 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
9352 CResult_RouteLightningErrorZ_free(_res_conv);
9355 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
9356 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9357 *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
9358 return (uint64_t)ret_conv;
9360 int64_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint32_t arg) {
9361 LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
9362 int64_t ret_val = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
9366 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
9367 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
9368 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9369 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
9370 return (uint64_t)ret_conv;
9373 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
9374 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9375 CHECK_ACCESS(o_ptr);
9376 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
9377 o_conv = TxOut_clone((LDKTxOut*)(((uint64_t)o) & ~1));
9378 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9379 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
9380 return (uint64_t)ret_conv;
9383 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
9384 LDKAccessError e_conv = LDKAccessError_from_js(e);
9385 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9386 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
9387 return (uint64_t)ret_conv;
9390 jboolean __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_is_ok(uint32_t o) {
9391 LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)(o & ~1);
9392 jboolean ret_val = CResult_TxOutAccessErrorZ_is_ok(o_conv);
9396 void __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
9397 if ((_res & 1) != 0) return;
9398 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9399 CHECK_ACCESS(_res_ptr);
9400 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
9402 CResult_TxOutAccessErrorZ_free(_res_conv);
9405 static inline uint64_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
9406 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9407 *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
9408 return (uint64_t)ret_conv;
9410 int64_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_clone_ptr(uint32_t arg) {
9411 LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
9412 int64_t ret_val = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
9416 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
9417 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
9418 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9419 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
9420 return (uint64_t)ret_conv;
9423 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
9424 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9425 *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
9426 return ((uint64_t)ret_conv);
9428 int64_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint32_t arg) {
9429 LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)(arg & ~1);
9430 int64_t ret_val = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
9434 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_clone(uint32_t orig) {
9435 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
9436 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9437 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
9438 return ((uint64_t)ret_conv);
9441 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
9442 LDKTransaction b_ref;
9443 b_ref.datalen = *((uint32_t*)b);
9444 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
9445 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
9446 b_ref.data_is_owned = true;
9447 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9448 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
9449 return ((uint64_t)ret_conv);
9452 void __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
9453 if ((_res & 1) != 0) return;
9454 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9455 CHECK_ACCESS(_res_ptr);
9456 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
9458 C2Tuple_usizeTransactionZ_free(_res_conv);
9461 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
9462 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
9463 _res_constr.datalen = *((uint32_t*)_res);
9464 if (_res_constr.datalen > 0)
9465 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9467 _res_constr.data = NULL;
9468 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9469 for (size_t c = 0; c < _res_constr.datalen; c++) {
9470 uint32_t _res_conv_28 = _res_vals[c];
9471 void* _res_conv_28_ptr = (void*)(((uint64_t)_res_conv_28) & ~1);
9472 CHECK_ACCESS(_res_conv_28_ptr);
9473 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
9474 FREE((void*)_res_conv_28);
9475 _res_constr.data[c] = _res_conv_28_conv;
9477 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
9480 void __attribute__((visibility("default"))) TS_CVec_TxidZ_free(ptrArray _res) {
9481 LDKCVec_TxidZ _res_constr;
9482 _res_constr.datalen = *((uint32_t*)_res);
9483 if (_res_constr.datalen > 0)
9484 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
9486 _res_constr.data = NULL;
9487 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
9488 for (size_t m = 0; m < _res_constr.datalen; m++) {
9489 int8_tArray _res_conv_12 = _res_vals[m];
9490 LDKThirtyTwoBytes _res_conv_12_ref;
9491 CHECK(*((uint32_t*)_res_conv_12) == 32);
9492 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), 32);
9493 _res_constr.data[m] = _res_conv_12_ref;
9495 CVec_TxidZ_free(_res_constr);
9498 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
9499 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9500 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
9501 return (uint64_t)ret_conv;
9504 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
9505 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
9506 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9507 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
9508 return (uint64_t)ret_conv;
9511 jboolean __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok(uint32_t o) {
9512 LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(o & ~1);
9513 jboolean ret_val = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
9517 void __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
9518 if ((_res & 1) != 0) return;
9519 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9520 CHECK_ACCESS(_res_ptr);
9521 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
9523 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
9526 static inline uint64_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
9527 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9528 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
9529 return (uint64_t)ret_conv;
9531 int64_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(uint32_t arg) {
9532 LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
9533 int64_t ret_val = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
9537 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
9538 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
9539 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9540 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
9541 return (uint64_t)ret_conv;
9544 void __attribute__((visibility("default"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
9545 LDKCVec_MonitorEventZ _res_constr;
9546 _res_constr.datalen = *((uint32_t*)_res);
9547 if (_res_constr.datalen > 0)
9548 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
9550 _res_constr.data = NULL;
9551 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9552 for (size_t o = 0; o < _res_constr.datalen; o++) {
9553 uint32_t _res_conv_14 = _res_vals[o];
9554 void* _res_conv_14_ptr = (void*)(((uint64_t)_res_conv_14) & ~1);
9555 CHECK_ACCESS(_res_conv_14_ptr);
9556 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
9557 FREE((void*)_res_conv_14);
9558 _res_constr.data[o] = _res_conv_14_conv;
9560 CVec_MonitorEventZ_free(_res_constr);
9563 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
9564 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9565 CHECK_ACCESS(o_ptr);
9566 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
9567 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1));
9568 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9569 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
9570 uint64_t ret_ref = (uint64_t)ret_copy;
9574 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
9575 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9576 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
9577 uint64_t ret_ref = (uint64_t)ret_copy;
9581 void __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint32_t _res) {
9582 if ((_res & 1) != 0) return;
9583 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9584 CHECK_ACCESS(_res_ptr);
9585 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
9587 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
9590 static inline uint64_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
9591 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9592 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
9593 uint64_t ret_ref = (uint64_t)ret_copy;
9596 int64_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_clone_ptr(uint32_t arg) {
9597 LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)arg;
9598 int64_t ret_val = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
9602 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_clone(uint32_t orig) {
9603 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
9604 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9605 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
9606 uint64_t ret_ref = (uint64_t)ret_copy;
9610 uint32_t __attribute__((visibility("default"))) TS_COption_ClosureReasonZ_some(uint32_t o) {
9611 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9612 CHECK_ACCESS(o_ptr);
9613 LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
9614 o_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)o) & ~1));
9615 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
9616 *ret_copy = COption_ClosureReasonZ_some(o_conv);
9617 uint64_t ret_ref = (uint64_t)ret_copy;
9621 uint32_t __attribute__((visibility("default"))) TS_COption_ClosureReasonZ_none() {
9622 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
9623 *ret_copy = COption_ClosureReasonZ_none();
9624 uint64_t ret_ref = (uint64_t)ret_copy;
9628 void __attribute__((visibility("default"))) TS_COption_ClosureReasonZ_free(uint32_t _res) {
9629 if ((_res & 1) != 0) return;
9630 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9631 CHECK_ACCESS(_res_ptr);
9632 LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
9634 COption_ClosureReasonZ_free(_res_conv);
9637 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
9638 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
9639 *ret_copy = COption_ClosureReasonZ_clone(arg);
9640 uint64_t ret_ref = (uint64_t)ret_copy;
9643 int64_t __attribute__((visibility("default"))) TS_COption_ClosureReasonZ_clone_ptr(uint32_t arg) {
9644 LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)arg;
9645 int64_t ret_val = COption_ClosureReasonZ_clone_ptr(arg_conv);
9649 uint32_t __attribute__((visibility("default"))) TS_COption_ClosureReasonZ_clone(uint32_t orig) {
9650 LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)orig;
9651 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
9652 *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
9653 uint64_t ret_ref = (uint64_t)ret_copy;
9657 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint32_t o) {
9658 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9659 CHECK_ACCESS(o_ptr);
9660 LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
9661 o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)(((uint64_t)o) & ~1));
9662 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
9663 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
9664 return (uint64_t)ret_conv;
9667 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint32_t e) {
9668 LDKDecodeError e_conv;
9669 e_conv.inner = (void*)(e & (~1));
9670 e_conv.is_owned = (e & 1) || (e == 0);
9671 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9672 e_conv = DecodeError_clone(&e_conv);
9673 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
9674 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
9675 return (uint64_t)ret_conv;
9678 jboolean __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint32_t o) {
9679 LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(o & ~1);
9680 jboolean ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
9684 void __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint32_t _res) {
9685 if ((_res & 1) != 0) return;
9686 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9687 CHECK_ACCESS(_res_ptr);
9688 LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
9690 CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
9693 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
9694 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
9695 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
9696 return (uint64_t)ret_conv;
9698 int64_t __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint32_t arg) {
9699 LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
9700 int64_t ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
9704 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint32_t orig) {
9705 LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(orig & ~1);
9706 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
9707 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
9708 return (uint64_t)ret_conv;
9711 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_some(uint32_t o) {
9712 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9713 CHECK_ACCESS(o_ptr);
9714 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
9715 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uint64_t)o) & ~1));
9716 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
9717 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
9718 uint64_t ret_ref = (uint64_t)ret_copy;
9722 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_none() {
9723 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
9724 *ret_copy = COption_NetworkUpdateZ_none();
9725 uint64_t ret_ref = (uint64_t)ret_copy;
9729 void __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_free(uint32_t _res) {
9730 if ((_res & 1) != 0) return;
9731 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9732 CHECK_ACCESS(_res_ptr);
9733 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
9735 COption_NetworkUpdateZ_free(_res_conv);
9738 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
9739 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
9740 *ret_copy = COption_NetworkUpdateZ_clone(arg);
9741 uint64_t ret_ref = (uint64_t)ret_copy;
9744 int64_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_clone_ptr(uint32_t arg) {
9745 LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)arg;
9746 int64_t ret_val = COption_NetworkUpdateZ_clone_ptr(arg_conv);
9750 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_clone(uint32_t orig) {
9751 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
9752 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
9753 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
9754 uint64_t ret_ref = (uint64_t)ret_copy;
9758 void __attribute__((visibility("default"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
9759 LDKCVec_SpendableOutputDescriptorZ _res_constr;
9760 _res_constr.datalen = *((uint32_t*)_res);
9761 if (_res_constr.datalen > 0)
9762 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
9764 _res_constr.data = NULL;
9765 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9766 for (size_t b = 0; b < _res_constr.datalen; b++) {
9767 uint32_t _res_conv_27 = _res_vals[b];
9768 void* _res_conv_27_ptr = (void*)(((uint64_t)_res_conv_27) & ~1);
9769 CHECK_ACCESS(_res_conv_27_ptr);
9770 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
9771 FREE((void*)_res_conv_27);
9772 _res_constr.data[b] = _res_conv_27_conv;
9774 CVec_SpendableOutputDescriptorZ_free(_res_constr);
9777 uint32_t __attribute__((visibility("default"))) TS_COption_EventZ_some(uint32_t o) {
9778 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9779 CHECK_ACCESS(o_ptr);
9780 LDKEvent o_conv = *(LDKEvent*)(o_ptr);
9781 o_conv = Event_clone((LDKEvent*)(((uint64_t)o) & ~1));
9782 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
9783 *ret_copy = COption_EventZ_some(o_conv);
9784 uint64_t ret_ref = (uint64_t)ret_copy;
9788 uint32_t __attribute__((visibility("default"))) TS_COption_EventZ_none() {
9789 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
9790 *ret_copy = COption_EventZ_none();
9791 uint64_t ret_ref = (uint64_t)ret_copy;
9795 void __attribute__((visibility("default"))) TS_COption_EventZ_free(uint32_t _res) {
9796 if ((_res & 1) != 0) return;
9797 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9798 CHECK_ACCESS(_res_ptr);
9799 LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
9801 COption_EventZ_free(_res_conv);
9804 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
9805 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
9806 *ret_copy = COption_EventZ_clone(arg);
9807 uint64_t ret_ref = (uint64_t)ret_copy;
9810 int64_t __attribute__((visibility("default"))) TS_COption_EventZ_clone_ptr(uint32_t arg) {
9811 LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)arg;
9812 int64_t ret_val = COption_EventZ_clone_ptr(arg_conv);
9816 uint32_t __attribute__((visibility("default"))) TS_COption_EventZ_clone(uint32_t orig) {
9817 LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)orig;
9818 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
9819 *ret_copy = COption_EventZ_clone(orig_conv);
9820 uint64_t ret_ref = (uint64_t)ret_copy;
9824 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint32_t o) {
9825 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9826 CHECK_ACCESS(o_ptr);
9827 LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
9828 o_conv = COption_EventZ_clone((LDKCOption_EventZ*)(((uint64_t)o) & ~1));
9829 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
9830 *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
9831 return (uint64_t)ret_conv;
9834 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint32_t e) {
9835 LDKDecodeError e_conv;
9836 e_conv.inner = (void*)(e & (~1));
9837 e_conv.is_owned = (e & 1) || (e == 0);
9838 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9839 e_conv = DecodeError_clone(&e_conv);
9840 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
9841 *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
9842 return (uint64_t)ret_conv;
9845 jboolean __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint32_t o) {
9846 LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(o & ~1);
9847 jboolean ret_val = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
9851 void __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint32_t _res) {
9852 if ((_res & 1) != 0) return;
9853 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9854 CHECK_ACCESS(_res_ptr);
9855 LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
9857 CResult_COption_EventZDecodeErrorZ_free(_res_conv);
9860 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
9861 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
9862 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
9863 return (uint64_t)ret_conv;
9865 int64_t __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint32_t arg) {
9866 LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
9867 int64_t ret_val = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
9871 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint32_t orig) {
9872 LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(orig & ~1);
9873 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
9874 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
9875 return (uint64_t)ret_conv;
9878 void __attribute__((visibility("default"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
9879 LDKCVec_MessageSendEventZ _res_constr;
9880 _res_constr.datalen = *((uint32_t*)_res);
9881 if (_res_constr.datalen > 0)
9882 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
9884 _res_constr.data = NULL;
9885 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9886 for (size_t s = 0; s < _res_constr.datalen; s++) {
9887 uint32_t _res_conv_18 = _res_vals[s];
9888 void* _res_conv_18_ptr = (void*)(((uint64_t)_res_conv_18) & ~1);
9889 CHECK_ACCESS(_res_conv_18_ptr);
9890 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
9891 FREE((void*)_res_conv_18);
9892 _res_constr.data[s] = _res_conv_18_conv;
9894 CVec_MessageSendEventZ_free(_res_constr);
9897 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
9898 LDKInitFeatures o_conv;
9899 o_conv.inner = (void*)(o & (~1));
9900 o_conv.is_owned = (o & 1) || (o == 0);
9901 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9902 o_conv = InitFeatures_clone(&o_conv);
9903 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
9904 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
9905 return (uint64_t)ret_conv;
9908 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
9909 LDKDecodeError e_conv;
9910 e_conv.inner = (void*)(e & (~1));
9911 e_conv.is_owned = (e & 1) || (e == 0);
9912 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9913 e_conv = DecodeError_clone(&e_conv);
9914 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
9915 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
9916 return (uint64_t)ret_conv;
9919 jboolean __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint32_t o) {
9920 LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1);
9921 jboolean ret_val = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
9925 void __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
9926 if ((_res & 1) != 0) return;
9927 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9928 CHECK_ACCESS(_res_ptr);
9929 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
9931 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
9934 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
9935 LDKNodeFeatures o_conv;
9936 o_conv.inner = (void*)(o & (~1));
9937 o_conv.is_owned = (o & 1) || (o == 0);
9938 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9939 o_conv = NodeFeatures_clone(&o_conv);
9940 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
9941 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
9942 return (uint64_t)ret_conv;
9945 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
9946 LDKDecodeError e_conv;
9947 e_conv.inner = (void*)(e & (~1));
9948 e_conv.is_owned = (e & 1) || (e == 0);
9949 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9950 e_conv = DecodeError_clone(&e_conv);
9951 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
9952 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
9953 return (uint64_t)ret_conv;
9956 jboolean __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint32_t o) {
9957 LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1);
9958 jboolean ret_val = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
9962 void __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
9963 if ((_res & 1) != 0) return;
9964 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9965 CHECK_ACCESS(_res_ptr);
9966 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
9968 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
9971 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
9972 LDKChannelFeatures o_conv;
9973 o_conv.inner = (void*)(o & (~1));
9974 o_conv.is_owned = (o & 1) || (o == 0);
9975 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9976 o_conv = ChannelFeatures_clone(&o_conv);
9977 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
9978 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
9979 return (uint64_t)ret_conv;
9982 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
9983 LDKDecodeError e_conv;
9984 e_conv.inner = (void*)(e & (~1));
9985 e_conv.is_owned = (e & 1) || (e == 0);
9986 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9987 e_conv = DecodeError_clone(&e_conv);
9988 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
9989 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
9990 return (uint64_t)ret_conv;
9993 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint32_t o) {
9994 LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(o & ~1);
9995 jboolean ret_val = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
9999 void __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
10000 if ((_res & 1) != 0) return;
10001 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10002 CHECK_ACCESS(_res_ptr);
10003 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
10005 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
10008 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) {
10009 LDKInvoiceFeatures o_conv;
10010 o_conv.inner = (void*)(o & (~1));
10011 o_conv.is_owned = (o & 1) || (o == 0);
10012 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10013 o_conv = InvoiceFeatures_clone(&o_conv);
10014 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
10015 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
10016 return (uint64_t)ret_conv;
10019 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) {
10020 LDKDecodeError e_conv;
10021 e_conv.inner = (void*)(e & (~1));
10022 e_conv.is_owned = (e & 1) || (e == 0);
10023 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10024 e_conv = DecodeError_clone(&e_conv);
10025 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
10026 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
10027 return (uint64_t)ret_conv;
10030 jboolean __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint32_t o) {
10031 LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1);
10032 jboolean ret_val = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
10036 void __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) {
10037 if ((_res & 1) != 0) return;
10038 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10039 CHECK_ACCESS(_res_ptr);
10040 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
10042 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
10045 uint32_t __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_ok(uint32_t o) {
10046 LDKScoringParameters o_conv;
10047 o_conv.inner = (void*)(o & (~1));
10048 o_conv.is_owned = (o & 1) || (o == 0);
10049 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10050 // Warning: we need a move here but no clone is available for LDKScoringParameters
10051 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
10052 *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv);
10053 return (uint64_t)ret_conv;
10056 uint32_t __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_err(uint32_t e) {
10057 LDKDecodeError e_conv;
10058 e_conv.inner = (void*)(e & (~1));
10059 e_conv.is_owned = (e & 1) || (e == 0);
10060 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10061 e_conv = DecodeError_clone(&e_conv);
10062 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
10063 *ret_conv = CResult_ScoringParametersDecodeErrorZ_err(e_conv);
10064 return (uint64_t)ret_conv;
10067 jboolean __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_is_ok(uint32_t o) {
10068 LDKCResult_ScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(o & ~1);
10069 jboolean ret_val = CResult_ScoringParametersDecodeErrorZ_is_ok(o_conv);
10073 void __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_free(uint32_t _res) {
10074 if ((_res & 1) != 0) return;
10075 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10076 CHECK_ACCESS(_res_ptr);
10077 LDKCResult_ScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ScoringParametersDecodeErrorZ*)(_res_ptr);
10079 CResult_ScoringParametersDecodeErrorZ_free(_res_conv);
10082 uint32_t __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_ok(uint32_t o) {
10084 o_conv.inner = (void*)(o & (~1));
10085 o_conv.is_owned = (o & 1) || (o == 0);
10086 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10087 // Warning: we need a move here but no clone is available for LDKScorer
10088 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
10089 *ret_conv = CResult_ScorerDecodeErrorZ_ok(o_conv);
10090 return (uint64_t)ret_conv;
10093 uint32_t __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_err(uint32_t e) {
10094 LDKDecodeError e_conv;
10095 e_conv.inner = (void*)(e & (~1));
10096 e_conv.is_owned = (e & 1) || (e == 0);
10097 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10098 e_conv = DecodeError_clone(&e_conv);
10099 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
10100 *ret_conv = CResult_ScorerDecodeErrorZ_err(e_conv);
10101 return (uint64_t)ret_conv;
10104 jboolean __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_is_ok(uint32_t o) {
10105 LDKCResult_ScorerDecodeErrorZ* o_conv = (LDKCResult_ScorerDecodeErrorZ*)(o & ~1);
10106 jboolean ret_val = CResult_ScorerDecodeErrorZ_is_ok(o_conv);
10110 void __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_free(uint32_t _res) {
10111 if ((_res & 1) != 0) return;
10112 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10113 CHECK_ACCESS(_res_ptr);
10114 LDKCResult_ScorerDecodeErrorZ _res_conv = *(LDKCResult_ScorerDecodeErrorZ*)(_res_ptr);
10116 CResult_ScorerDecodeErrorZ_free(_res_conv);
10119 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
10120 LDKDelayedPaymentOutputDescriptor o_conv;
10121 o_conv.inner = (void*)(o & (~1));
10122 o_conv.is_owned = (o & 1) || (o == 0);
10123 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10124 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
10125 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
10126 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
10127 return (uint64_t)ret_conv;
10130 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
10131 LDKDecodeError e_conv;
10132 e_conv.inner = (void*)(e & (~1));
10133 e_conv.is_owned = (e & 1) || (e == 0);
10134 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10135 e_conv = DecodeError_clone(&e_conv);
10136 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
10137 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
10138 return (uint64_t)ret_conv;
10141 jboolean __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
10142 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
10143 jboolean ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
10147 void __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
10148 if ((_res & 1) != 0) return;
10149 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10150 CHECK_ACCESS(_res_ptr);
10151 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
10153 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
10156 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
10157 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
10158 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
10159 return (uint64_t)ret_conv;
10161 int64_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
10162 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
10163 int64_t ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
10167 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
10168 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
10169 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
10170 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
10171 return (uint64_t)ret_conv;
10174 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
10175 LDKStaticPaymentOutputDescriptor o_conv;
10176 o_conv.inner = (void*)(o & (~1));
10177 o_conv.is_owned = (o & 1) || (o == 0);
10178 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10179 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
10180 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
10181 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
10182 return (uint64_t)ret_conv;
10185 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
10186 LDKDecodeError e_conv;
10187 e_conv.inner = (void*)(e & (~1));
10188 e_conv.is_owned = (e & 1) || (e == 0);
10189 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10190 e_conv = DecodeError_clone(&e_conv);
10191 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
10192 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
10193 return (uint64_t)ret_conv;
10196 jboolean __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
10197 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
10198 jboolean ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
10202 void __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
10203 if ((_res & 1) != 0) return;
10204 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10205 CHECK_ACCESS(_res_ptr);
10206 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
10208 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
10211 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
10212 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
10213 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
10214 return (uint64_t)ret_conv;
10216 int64_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
10217 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
10218 int64_t ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
10222 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
10223 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
10224 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
10225 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
10226 return (uint64_t)ret_conv;
10229 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
10230 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10231 CHECK_ACCESS(o_ptr);
10232 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
10233 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1));
10234 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10235 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
10236 return (uint64_t)ret_conv;
10239 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
10240 LDKDecodeError e_conv;
10241 e_conv.inner = (void*)(e & (~1));
10242 e_conv.is_owned = (e & 1) || (e == 0);
10243 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10244 e_conv = DecodeError_clone(&e_conv);
10245 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10246 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
10247 return (uint64_t)ret_conv;
10250 jboolean __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
10251 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(o & ~1);
10252 jboolean ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
10256 void __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
10257 if ((_res & 1) != 0) return;
10258 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10259 CHECK_ACCESS(_res_ptr);
10260 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
10262 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
10265 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
10266 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10267 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
10268 return (uint64_t)ret_conv;
10270 int64_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
10271 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
10272 int64_t ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
10276 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
10277 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
10278 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10279 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
10280 return (uint64_t)ret_conv;
10283 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_ok() {
10284 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10285 *ret_conv = CResult_NoneNoneZ_ok();
10286 return (uint64_t)ret_conv;
10289 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_err() {
10290 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10291 *ret_conv = CResult_NoneNoneZ_err();
10292 return (uint64_t)ret_conv;
10295 jboolean __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_is_ok(uint32_t o) {
10296 LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)(o & ~1);
10297 jboolean ret_val = CResult_NoneNoneZ_is_ok(o_conv);
10301 void __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_free(uint32_t _res) {
10302 if ((_res & 1) != 0) return;
10303 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10304 CHECK_ACCESS(_res_ptr);
10305 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
10307 CResult_NoneNoneZ_free(_res_conv);
10310 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
10311 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10312 *ret_conv = CResult_NoneNoneZ_clone(arg);
10313 return (uint64_t)ret_conv;
10315 int64_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_clone_ptr(uint32_t arg) {
10316 LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)(arg & ~1);
10317 int64_t ret_val = CResult_NoneNoneZ_clone_ptr(arg_conv);
10321 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_clone(uint32_t orig) {
10322 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
10323 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10324 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
10325 return (uint64_t)ret_conv;
10328 static inline uint64_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
10329 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
10330 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
10331 return ((uint64_t)ret_conv);
10333 int64_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(uint32_t arg) {
10334 LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(arg & ~1);
10335 int64_t ret_val = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
10339 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
10340 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
10341 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
10342 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
10343 return ((uint64_t)ret_conv);
10346 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
10347 LDKSignature a_ref;
10348 CHECK(*((uint32_t*)a) == 64);
10349 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
10350 LDKCVec_SignatureZ b_constr;
10351 b_constr.datalen = *((uint32_t*)b);
10352 if (b_constr.datalen > 0)
10353 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
10355 b_constr.data = NULL;
10356 int8_tArray* b_vals = (int8_tArray*)(b + 4);
10357 for (size_t m = 0; m < b_constr.datalen; m++) {
10358 int8_tArray b_conv_12 = b_vals[m];
10359 LDKSignature b_conv_12_ref;
10360 CHECK(*((uint32_t*)b_conv_12) == 64);
10361 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
10362 b_constr.data[m] = b_conv_12_ref;
10364 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
10365 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
10366 return ((uint64_t)ret_conv);
10369 void __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
10370 if ((_res & 1) != 0) return;
10371 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10372 CHECK_ACCESS(_res_ptr);
10373 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
10375 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
10378 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
10379 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10380 CHECK_ACCESS(o_ptr);
10381 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
10382 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1));
10383 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10384 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
10385 return (uint64_t)ret_conv;
10388 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
10389 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10390 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
10391 return (uint64_t)ret_conv;
10394 jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(uint32_t o) {
10395 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(o & ~1);
10396 jboolean ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
10400 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
10401 if ((_res & 1) != 0) return;
10402 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10403 CHECK_ACCESS(_res_ptr);
10404 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
10406 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
10409 static inline uint64_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
10410 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10411 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
10412 return (uint64_t)ret_conv;
10414 int64_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(uint32_t arg) {
10415 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
10416 int64_t ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
10420 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
10421 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
10422 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10423 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
10424 return (uint64_t)ret_conv;
10427 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
10428 LDKSignature o_ref;
10429 CHECK(*((uint32_t*)o) == 64);
10430 memcpy(o_ref.compact_form, (uint8_t*)(o + 4), 64);
10431 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10432 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
10433 return (uint64_t)ret_conv;
10436 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_err() {
10437 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10438 *ret_conv = CResult_SignatureNoneZ_err();
10439 return (uint64_t)ret_conv;
10442 jboolean __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_is_ok(uint32_t o) {
10443 LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)(o & ~1);
10444 jboolean ret_val = CResult_SignatureNoneZ_is_ok(o_conv);
10448 void __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
10449 if ((_res & 1) != 0) return;
10450 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10451 CHECK_ACCESS(_res_ptr);
10452 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
10454 CResult_SignatureNoneZ_free(_res_conv);
10457 static inline uint64_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
10458 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10459 *ret_conv = CResult_SignatureNoneZ_clone(arg);
10460 return (uint64_t)ret_conv;
10462 int64_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone_ptr(uint32_t arg) {
10463 LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)(arg & ~1);
10464 int64_t ret_val = CResult_SignatureNoneZ_clone_ptr(arg_conv);
10468 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
10469 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
10470 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10471 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
10472 return (uint64_t)ret_conv;
10475 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
10476 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10477 CHECK_ACCESS(o_ptr);
10478 LDKSign o_conv = *(LDKSign*)(o_ptr);
10479 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10480 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
10481 return (uint64_t)ret_conv;
10484 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
10485 LDKDecodeError e_conv;
10486 e_conv.inner = (void*)(e & (~1));
10487 e_conv.is_owned = (e & 1) || (e == 0);
10488 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10489 e_conv = DecodeError_clone(&e_conv);
10490 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10491 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
10492 return (uint64_t)ret_conv;
10495 jboolean __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_is_ok(uint32_t o) {
10496 LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)(o & ~1);
10497 jboolean ret_val = CResult_SignDecodeErrorZ_is_ok(o_conv);
10501 void __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
10502 if ((_res & 1) != 0) return;
10503 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10504 CHECK_ACCESS(_res_ptr);
10505 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
10507 CResult_SignDecodeErrorZ_free(_res_conv);
10510 static inline uint64_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
10511 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10512 *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
10513 return (uint64_t)ret_conv;
10515 int64_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_clone_ptr(uint32_t arg) {
10516 LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
10517 int64_t ret_val = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
10521 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
10522 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
10523 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10524 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
10525 return (uint64_t)ret_conv;
10528 void __attribute__((visibility("default"))) TS_CVec_u8Z_free(int8_tArray _res) {
10529 LDKCVec_u8Z _res_ref;
10530 _res_ref.datalen = *((uint32_t*)_res);
10531 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
10532 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
10533 CVec_u8Z_free(_res_ref);
10536 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray arg) {
10537 LDKRecoverableSignature arg_ref;
10538 CHECK(*((uint32_t*)arg) == 68);
10539 memcpy(arg_ref.serialized_form, (uint8_t*)(arg + 4), 68);
10540 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10541 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
10542 return (uint64_t)ret_conv;
10545 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_err() {
10546 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10547 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
10548 return (uint64_t)ret_conv;
10551 jboolean __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint32_t o) {
10552 LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)(o & ~1);
10553 jboolean ret_val = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
10557 void __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_free(uint32_t _res) {
10558 if ((_res & 1) != 0) return;
10559 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10560 CHECK_ACCESS(_res_ptr);
10561 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
10563 CResult_RecoverableSignatureNoneZ_free(_res_conv);
10566 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
10567 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10568 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
10569 return (uint64_t)ret_conv;
10571 int64_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint32_t arg) {
10572 LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
10573 int64_t ret_val = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
10577 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint32_t orig) {
10578 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
10579 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10580 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
10581 return (uint64_t)ret_conv;
10584 void __attribute__((visibility("default"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
10585 LDKCVec_CVec_u8ZZ _res_constr;
10586 _res_constr.datalen = *((uint32_t*)_res);
10587 if (_res_constr.datalen > 0)
10588 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
10590 _res_constr.data = NULL;
10591 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
10592 for (size_t m = 0; m < _res_constr.datalen; m++) {
10593 int8_tArray _res_conv_12 = _res_vals[m];
10594 LDKCVec_u8Z _res_conv_12_ref;
10595 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
10596 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
10597 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
10598 _res_constr.data[m] = _res_conv_12_ref;
10600 CVec_CVec_u8ZZ_free(_res_constr);
10603 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
10604 LDKCVec_CVec_u8ZZ o_constr;
10605 o_constr.datalen = *((uint32_t*)o);
10606 if (o_constr.datalen > 0)
10607 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
10609 o_constr.data = NULL;
10610 int8_tArray* o_vals = (int8_tArray*)(o + 4);
10611 for (size_t m = 0; m < o_constr.datalen; m++) {
10612 int8_tArray o_conv_12 = o_vals[m];
10613 LDKCVec_u8Z o_conv_12_ref;
10614 o_conv_12_ref.datalen = *((uint32_t*)o_conv_12);
10615 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
10616 memcpy(o_conv_12_ref.data, (uint8_t*)(o_conv_12 + 4), o_conv_12_ref.datalen);
10617 o_constr.data[m] = o_conv_12_ref;
10619 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10620 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
10621 return (uint64_t)ret_conv;
10624 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
10625 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10626 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
10627 return (uint64_t)ret_conv;
10630 jboolean __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint32_t o) {
10631 LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(o & ~1);
10632 jboolean ret_val = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
10636 void __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
10637 if ((_res & 1) != 0) return;
10638 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10639 CHECK_ACCESS(_res_ptr);
10640 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
10642 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
10645 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
10646 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10647 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
10648 return (uint64_t)ret_conv;
10650 int64_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint32_t arg) {
10651 LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
10652 int64_t ret_val = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
10656 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
10657 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
10658 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10659 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
10660 return (uint64_t)ret_conv;
10663 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
10664 LDKInMemorySigner o_conv;
10665 o_conv.inner = (void*)(o & (~1));
10666 o_conv.is_owned = (o & 1) || (o == 0);
10667 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10668 o_conv = InMemorySigner_clone(&o_conv);
10669 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10670 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
10671 return (uint64_t)ret_conv;
10674 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
10675 LDKDecodeError e_conv;
10676 e_conv.inner = (void*)(e & (~1));
10677 e_conv.is_owned = (e & 1) || (e == 0);
10678 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10679 e_conv = DecodeError_clone(&e_conv);
10680 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10681 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
10682 return (uint64_t)ret_conv;
10685 jboolean __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint32_t o) {
10686 LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(o & ~1);
10687 jboolean ret_val = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
10691 void __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
10692 if ((_res & 1) != 0) return;
10693 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10694 CHECK_ACCESS(_res_ptr);
10695 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
10697 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
10700 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
10701 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10702 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
10703 return (uint64_t)ret_conv;
10705 int64_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint32_t arg) {
10706 LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
10707 int64_t ret_val = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
10711 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
10712 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
10713 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10714 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
10715 return (uint64_t)ret_conv;
10718 void __attribute__((visibility("default"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
10719 LDKCVec_TxOutZ _res_constr;
10720 _res_constr.datalen = *((uint32_t*)_res);
10721 if (_res_constr.datalen > 0)
10722 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
10724 _res_constr.data = NULL;
10725 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10726 for (size_t h = 0; h < _res_constr.datalen; h++) {
10727 uint32_t _res_conv_7 = _res_vals[h];
10728 void* _res_conv_7_ptr = (void*)(((uint64_t)_res_conv_7) & ~1);
10729 CHECK_ACCESS(_res_conv_7_ptr);
10730 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
10731 FREE((void*)_res_conv_7);
10732 _res_constr.data[h] = _res_conv_7_conv;
10734 CVec_TxOutZ_free(_res_constr);
10737 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
10738 LDKTransaction o_ref;
10739 o_ref.datalen = *((uint32_t*)o);
10740 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
10741 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
10742 o_ref.data_is_owned = true;
10743 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10744 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
10745 return (uint64_t)ret_conv;
10748 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_err() {
10749 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10750 *ret_conv = CResult_TransactionNoneZ_err();
10751 return (uint64_t)ret_conv;
10754 jboolean __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_is_ok(uint32_t o) {
10755 LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)(o & ~1);
10756 jboolean ret_val = CResult_TransactionNoneZ_is_ok(o_conv);
10760 void __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
10761 if ((_res & 1) != 0) return;
10762 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10763 CHECK_ACCESS(_res_ptr);
10764 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
10766 CResult_TransactionNoneZ_free(_res_conv);
10769 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
10770 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10771 *ret_conv = CResult_TransactionNoneZ_clone(arg);
10772 return (uint64_t)ret_conv;
10774 int64_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_clone_ptr(uint32_t arg) {
10775 LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)(arg & ~1);
10776 int64_t ret_val = CResult_TransactionNoneZ_clone_ptr(arg_conv);
10780 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_clone(uint32_t orig) {
10781 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
10782 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10783 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
10784 return (uint64_t)ret_conv;
10787 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
10788 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10789 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
10790 return ((uint64_t)ret_conv);
10792 int64_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint32_t arg) {
10793 LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(arg & ~1);
10794 int64_t ret_val = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
10798 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint32_t orig) {
10799 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
10800 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10801 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
10802 return ((uint64_t)ret_conv);
10805 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
10806 LDKThirtyTwoBytes a_ref;
10807 CHECK(*((uint32_t*)a) == 32);
10808 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
10809 LDKChannelMonitor b_conv;
10810 b_conv.inner = (void*)(b & (~1));
10811 b_conv.is_owned = (b & 1) || (b == 0);
10812 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
10813 b_conv = ChannelMonitor_clone(&b_conv);
10814 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10815 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
10816 return ((uint64_t)ret_conv);
10819 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
10820 if ((_res & 1) != 0) return;
10821 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10822 CHECK_ACCESS(_res_ptr);
10823 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
10825 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
10828 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_BlockHashChannelMonitorZZ_free(uint32_tArray _res) {
10829 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
10830 _res_constr.datalen = *((uint32_t*)_res);
10831 if (_res_constr.datalen > 0)
10832 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
10834 _res_constr.data = NULL;
10835 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10836 for (size_t j = 0; j < _res_constr.datalen; j++) {
10837 uint32_t _res_conv_35 = _res_vals[j];
10838 void* _res_conv_35_ptr = (void*)(((uint64_t)_res_conv_35) & ~1);
10839 CHECK_ACCESS(_res_conv_35_ptr);
10840 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_conv_35_ptr);
10841 FREE((void*)_res_conv_35);
10842 _res_constr.data[j] = _res_conv_35_conv;
10844 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
10847 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(uint32_tArray o) {
10848 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
10849 o_constr.datalen = *((uint32_t*)o);
10850 if (o_constr.datalen > 0)
10851 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
10853 o_constr.data = NULL;
10854 uint32_t* o_vals = (uint32_t*)(o + 4);
10855 for (size_t j = 0; j < o_constr.datalen; j++) {
10856 uint32_t o_conv_35 = o_vals[j];
10857 void* o_conv_35_ptr = (void*)(((uint64_t)o_conv_35) & ~1);
10858 CHECK_ACCESS(o_conv_35_ptr);
10859 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_conv_35_ptr);
10860 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_35) & ~1));
10861 o_constr.data[j] = o_conv_35_conv;
10863 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10864 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
10865 return (uint64_t)ret_conv;
10868 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(uint32_t e) {
10869 LDKIOError e_conv = LDKIOError_from_js(e);
10870 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10871 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
10872 return (uint64_t)ret_conv;
10875 jboolean __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(uint32_t o) {
10876 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(o & ~1);
10877 jboolean ret_val = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o_conv);
10881 void __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(uint32_t _res) {
10882 if ((_res & 1) != 0) return;
10883 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10884 CHECK_ACCESS(_res_ptr);
10885 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(_res_ptr);
10887 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
10890 static inline uint64_t CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR arg) {
10891 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10892 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(arg);
10893 return (uint64_t)ret_conv;
10895 int64_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(uint32_t arg) {
10896 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
10897 int64_t ret_val = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(arg_conv);
10901 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(uint32_t orig) {
10902 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(orig & ~1);
10903 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10904 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
10905 return (uint64_t)ret_conv;
10908 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_some(int16_t o) {
10909 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
10910 *ret_copy = COption_u16Z_some(o);
10911 uint64_t ret_ref = (uint64_t)ret_copy;
10915 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_none() {
10916 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
10917 *ret_copy = COption_u16Z_none();
10918 uint64_t ret_ref = (uint64_t)ret_copy;
10922 void __attribute__((visibility("default"))) TS_COption_u16Z_free(uint32_t _res) {
10923 if ((_res & 1) != 0) return;
10924 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10925 CHECK_ACCESS(_res_ptr);
10926 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
10928 COption_u16Z_free(_res_conv);
10931 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
10932 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
10933 *ret_copy = COption_u16Z_clone(arg);
10934 uint64_t ret_ref = (uint64_t)ret_copy;
10937 int64_t __attribute__((visibility("default"))) TS_COption_u16Z_clone_ptr(uint32_t arg) {
10938 LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)arg;
10939 int64_t ret_val = COption_u16Z_clone_ptr(arg_conv);
10943 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_clone(uint32_t orig) {
10944 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
10945 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
10946 *ret_copy = COption_u16Z_clone(orig_conv);
10947 uint64_t ret_ref = (uint64_t)ret_copy;
10951 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_ok() {
10952 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10953 *ret_conv = CResult_NoneAPIErrorZ_ok();
10954 return (uint64_t)ret_conv;
10957 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
10958 void* e_ptr = (void*)(((uint64_t)e) & ~1);
10959 CHECK_ACCESS(e_ptr);
10960 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
10961 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
10962 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10963 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
10964 return (uint64_t)ret_conv;
10967 jboolean __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_is_ok(uint32_t o) {
10968 LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)(o & ~1);
10969 jboolean ret_val = CResult_NoneAPIErrorZ_is_ok(o_conv);
10973 void __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
10974 if ((_res & 1) != 0) return;
10975 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10976 CHECK_ACCESS(_res_ptr);
10977 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
10979 CResult_NoneAPIErrorZ_free(_res_conv);
10982 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
10983 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10984 *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
10985 return (uint64_t)ret_conv;
10987 int64_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint32_t arg) {
10988 LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
10989 int64_t ret_val = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
10993 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
10994 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
10995 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10996 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
10997 return (uint64_t)ret_conv;
11000 void __attribute__((visibility("default"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
11001 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
11002 _res_constr.datalen = *((uint32_t*)_res);
11003 if (_res_constr.datalen > 0)
11004 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
11006 _res_constr.data = NULL;
11007 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11008 for (size_t w = 0; w < _res_constr.datalen; w++) {
11009 uint32_t _res_conv_22 = _res_vals[w];
11010 void* _res_conv_22_ptr = (void*)(((uint64_t)_res_conv_22) & ~1);
11011 CHECK_ACCESS(_res_conv_22_ptr);
11012 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
11013 FREE((void*)_res_conv_22);
11014 _res_constr.data[w] = _res_conv_22_conv;
11016 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
11019 void __attribute__((visibility("default"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
11020 LDKCVec_APIErrorZ _res_constr;
11021 _res_constr.datalen = *((uint32_t*)_res);
11022 if (_res_constr.datalen > 0)
11023 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
11025 _res_constr.data = NULL;
11026 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11027 for (size_t k = 0; k < _res_constr.datalen; k++) {
11028 uint32_t _res_conv_10 = _res_vals[k];
11029 void* _res_conv_10_ptr = (void*)(((uint64_t)_res_conv_10) & ~1);
11030 CHECK_ACCESS(_res_conv_10_ptr);
11031 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
11032 FREE((void*)_res_conv_10);
11033 _res_constr.data[k] = _res_conv_10_conv;
11035 CVec_APIErrorZ_free(_res_constr);
11038 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
11039 LDKThirtyTwoBytes o_ref;
11040 CHECK(*((uint32_t*)o) == 32);
11041 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
11042 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
11043 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
11044 return (uint64_t)ret_conv;
11047 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_err(uint32_t e) {
11048 void* e_ptr = (void*)(((uint64_t)e) & ~1);
11049 CHECK_ACCESS(e_ptr);
11050 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
11051 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
11052 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
11053 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
11054 return (uint64_t)ret_conv;
11057 jboolean __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_is_ok(uint32_t o) {
11058 LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)(o & ~1);
11059 jboolean ret_val = CResult__u832APIErrorZ_is_ok(o_conv);
11063 void __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_free(uint32_t _res) {
11064 if ((_res & 1) != 0) return;
11065 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11066 CHECK_ACCESS(_res_ptr);
11067 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
11069 CResult__u832APIErrorZ_free(_res_conv);
11072 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
11073 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
11074 *ret_conv = CResult__u832APIErrorZ_clone(arg);
11075 return (uint64_t)ret_conv;
11077 int64_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_clone_ptr(uint32_t arg) {
11078 LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)(arg & ~1);
11079 int64_t ret_val = CResult__u832APIErrorZ_clone_ptr(arg_conv);
11083 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_clone(uint32_t orig) {
11084 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
11085 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
11086 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
11087 return (uint64_t)ret_conv;
11090 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_ok(int8_tArray o) {
11091 LDKThirtyTwoBytes o_ref;
11092 CHECK(*((uint32_t*)o) == 32);
11093 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
11094 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
11095 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
11096 return (uint64_t)ret_conv;
11099 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_err(uint32_t e) {
11100 void* e_ptr = (void*)(((uint64_t)e) & ~1);
11101 CHECK_ACCESS(e_ptr);
11102 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
11103 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
11104 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
11105 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
11106 return (uint64_t)ret_conv;
11109 jboolean __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_is_ok(uint32_t o) {
11110 LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(o & ~1);
11111 jboolean ret_val = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
11115 void __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_free(uint32_t _res) {
11116 if ((_res & 1) != 0) return;
11117 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11118 CHECK_ACCESS(_res_ptr);
11119 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
11121 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
11124 static inline uint64_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
11125 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
11126 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
11127 return (uint64_t)ret_conv;
11129 int64_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr(uint32_t arg) {
11130 LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
11131 int64_t ret_val = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
11135 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone(uint32_t orig) {
11136 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
11137 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
11138 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
11139 return (uint64_t)ret_conv;
11142 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_ok() {
11143 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11144 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
11145 return (uint64_t)ret_conv;
11148 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
11149 void* e_ptr = (void*)(((uint64_t)e) & ~1);
11150 CHECK_ACCESS(e_ptr);
11151 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
11152 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
11153 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11154 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
11155 return (uint64_t)ret_conv;
11158 jboolean __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint32_t o) {
11159 LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)(o & ~1);
11160 jboolean ret_val = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
11164 void __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
11165 if ((_res & 1) != 0) return;
11166 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11167 CHECK_ACCESS(_res_ptr);
11168 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
11170 CResult_NonePaymentSendFailureZ_free(_res_conv);
11173 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
11174 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11175 *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
11176 return (uint64_t)ret_conv;
11178 int64_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint32_t arg) {
11179 LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
11180 int64_t ret_val = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
11184 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
11185 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
11186 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11187 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
11188 return (uint64_t)ret_conv;
11191 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
11192 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
11193 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
11194 return ((uint64_t)ret_conv);
11196 int64_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint32_t arg) {
11197 LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(arg & ~1);
11198 int64_t ret_val = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
11202 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint32_t orig) {
11203 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
11204 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
11205 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
11206 return ((uint64_t)ret_conv);
11209 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
11210 LDKThirtyTwoBytes a_ref;
11211 CHECK(*((uint32_t*)a) == 32);
11212 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
11213 LDKThirtyTwoBytes b_ref;
11214 CHECK(*((uint32_t*)b) == 32);
11215 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
11216 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
11217 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
11218 return ((uint64_t)ret_conv);
11221 void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint32_t _res) {
11222 if ((_res & 1) != 0) return;
11223 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11224 CHECK_ACCESS(_res_ptr);
11225 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
11227 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
11230 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint32_t o) {
11231 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11232 CHECK_ACCESS(o_ptr);
11233 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
11234 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)o) & ~1));
11235 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
11236 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
11237 return (uint64_t)ret_conv;
11240 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint32_t e) {
11241 void* e_ptr = (void*)(((uint64_t)e) & ~1);
11242 CHECK_ACCESS(e_ptr);
11243 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
11244 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
11245 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
11246 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
11247 return (uint64_t)ret_conv;
11250 jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint32_t o) {
11251 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(o & ~1);
11252 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
11256 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint32_t _res) {
11257 if ((_res & 1) != 0) return;
11258 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11259 CHECK_ACCESS(_res_ptr);
11260 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
11262 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
11265 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
11266 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
11267 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
11268 return (uint64_t)ret_conv;
11270 int64_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint32_t arg) {
11271 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
11272 int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
11276 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint32_t orig) {
11277 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
11278 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
11279 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
11280 return (uint64_t)ret_conv;
11283 void __attribute__((visibility("default"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
11284 LDKCVec_NetAddressZ _res_constr;
11285 _res_constr.datalen = *((uint32_t*)_res);
11286 if (_res_constr.datalen > 0)
11287 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
11289 _res_constr.data = NULL;
11290 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11291 for (size_t m = 0; m < _res_constr.datalen; m++) {
11292 uint32_t _res_conv_12 = _res_vals[m];
11293 void* _res_conv_12_ptr = (void*)(((uint64_t)_res_conv_12) & ~1);
11294 CHECK_ACCESS(_res_conv_12_ptr);
11295 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
11296 FREE((void*)_res_conv_12);
11297 _res_constr.data[m] = _res_conv_12_conv;
11299 CVec_NetAddressZ_free(_res_constr);
11302 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
11303 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
11304 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
11305 return ((uint64_t)ret_conv);
11307 int64_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint32_t arg) {
11308 LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(arg & ~1);
11309 int64_t ret_val = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
11313 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint32_t orig) {
11314 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
11315 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
11316 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
11317 return ((uint64_t)ret_conv);
11320 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
11321 LDKThirtyTwoBytes a_ref;
11322 CHECK(*((uint32_t*)a) == 32);
11323 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
11324 LDKThirtyTwoBytes b_ref;
11325 CHECK(*((uint32_t*)b) == 32);
11326 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
11327 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
11328 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
11329 return ((uint64_t)ret_conv);
11332 void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint32_t _res) {
11333 if ((_res & 1) != 0) return;
11334 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11335 CHECK_ACCESS(_res_ptr);
11336 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
11338 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
11341 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
11342 LDKThirtyTwoBytes o_ref;
11343 CHECK(*((uint32_t*)o) == 32);
11344 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
11345 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
11346 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
11347 return (uint64_t)ret_conv;
11350 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint32_t e) {
11351 void* e_ptr = (void*)(((uint64_t)e) & ~1);
11352 CHECK_ACCESS(e_ptr);
11353 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
11354 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
11355 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
11356 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
11357 return (uint64_t)ret_conv;
11360 jboolean __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_is_ok(uint32_t o) {
11361 LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(o & ~1);
11362 jboolean ret_val = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
11366 void __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint32_t _res) {
11367 if ((_res & 1) != 0) return;
11368 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11369 CHECK_ACCESS(_res_ptr);
11370 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
11372 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
11375 static inline uint64_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
11376 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
11377 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
11378 return (uint64_t)ret_conv;
11380 int64_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_clone_ptr(uint32_t arg) {
11381 LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
11382 int64_t ret_val = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
11386 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint32_t orig) {
11387 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
11388 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
11389 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
11390 return (uint64_t)ret_conv;
11393 void __attribute__((visibility("default"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
11394 LDKCVec_ChannelMonitorZ _res_constr;
11395 _res_constr.datalen = *((uint32_t*)_res);
11396 if (_res_constr.datalen > 0)
11397 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
11399 _res_constr.data = NULL;
11400 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11401 for (size_t q = 0; q < _res_constr.datalen; q++) {
11402 uint32_t _res_conv_16 = _res_vals[q];
11403 LDKChannelMonitor _res_conv_16_conv;
11404 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
11405 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
11406 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
11407 _res_constr.data[q] = _res_conv_16_conv;
11409 CVec_ChannelMonitorZ_free(_res_constr);
11412 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
11413 LDKThirtyTwoBytes a_ref;
11414 CHECK(*((uint32_t*)a) == 32);
11415 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
11416 LDKChannelManager b_conv;
11417 b_conv.inner = (void*)(b & (~1));
11418 b_conv.is_owned = (b & 1) || (b == 0);
11419 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
11420 // Warning: we need a move here but no clone is available for LDKChannelManager
11421 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
11422 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
11423 return ((uint64_t)ret_conv);
11426 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
11427 if ((_res & 1) != 0) return;
11428 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11429 CHECK_ACCESS(_res_ptr);
11430 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
11432 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
11435 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
11436 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11437 CHECK_ACCESS(o_ptr);
11438 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
11439 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
11440 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
11441 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
11442 return (uint64_t)ret_conv;
11445 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
11446 LDKDecodeError e_conv;
11447 e_conv.inner = (void*)(e & (~1));
11448 e_conv.is_owned = (e & 1) || (e == 0);
11449 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11450 e_conv = DecodeError_clone(&e_conv);
11451 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
11452 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
11453 return (uint64_t)ret_conv;
11456 jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint32_t o) {
11457 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(o & ~1);
11458 jboolean ret_val = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
11462 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
11463 if ((_res & 1) != 0) return;
11464 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11465 CHECK_ACCESS(_res_ptr);
11466 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
11468 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
11471 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
11472 LDKChannelConfig o_conv;
11473 o_conv.inner = (void*)(o & (~1));
11474 o_conv.is_owned = (o & 1) || (o == 0);
11475 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11476 o_conv = ChannelConfig_clone(&o_conv);
11477 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
11478 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
11479 return (uint64_t)ret_conv;
11482 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
11483 LDKDecodeError e_conv;
11484 e_conv.inner = (void*)(e & (~1));
11485 e_conv.is_owned = (e & 1) || (e == 0);
11486 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11487 e_conv = DecodeError_clone(&e_conv);
11488 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
11489 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
11490 return (uint64_t)ret_conv;
11493 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint32_t o) {
11494 LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(o & ~1);
11495 jboolean ret_val = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
11499 void __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
11500 if ((_res & 1) != 0) return;
11501 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11502 CHECK_ACCESS(_res_ptr);
11503 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
11505 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
11508 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
11509 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
11510 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
11511 return (uint64_t)ret_conv;
11513 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint32_t arg) {
11514 LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
11515 int64_t ret_val = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
11519 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
11520 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
11521 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
11522 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
11523 return (uint64_t)ret_conv;
11526 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
11527 LDKOutPoint o_conv;
11528 o_conv.inner = (void*)(o & (~1));
11529 o_conv.is_owned = (o & 1) || (o == 0);
11530 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11531 o_conv = OutPoint_clone(&o_conv);
11532 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
11533 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
11534 return (uint64_t)ret_conv;
11537 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
11538 LDKDecodeError e_conv;
11539 e_conv.inner = (void*)(e & (~1));
11540 e_conv.is_owned = (e & 1) || (e == 0);
11541 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11542 e_conv = DecodeError_clone(&e_conv);
11543 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
11544 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
11545 return (uint64_t)ret_conv;
11548 jboolean __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint32_t o) {
11549 LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)(o & ~1);
11550 jboolean ret_val = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
11554 void __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
11555 if ((_res & 1) != 0) return;
11556 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11557 CHECK_ACCESS(_res_ptr);
11558 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
11560 CResult_OutPointDecodeErrorZ_free(_res_conv);
11563 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
11564 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
11565 *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
11566 return (uint64_t)ret_conv;
11568 int64_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint32_t arg) {
11569 LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
11570 int64_t ret_val = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
11574 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
11575 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
11576 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
11577 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
11578 return (uint64_t)ret_conv;
11581 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_some(uint32_t o) {
11582 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11583 CHECK_ACCESS(o_ptr);
11584 LDKType o_conv = *(LDKType*)(o_ptr);
11585 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
11586 *ret_copy = COption_TypeZ_some(o_conv);
11587 uint64_t ret_ref = (uint64_t)ret_copy;
11591 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_none() {
11592 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
11593 *ret_copy = COption_TypeZ_none();
11594 uint64_t ret_ref = (uint64_t)ret_copy;
11598 void __attribute__((visibility("default"))) TS_COption_TypeZ_free(uint32_t _res) {
11599 if ((_res & 1) != 0) return;
11600 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11601 CHECK_ACCESS(_res_ptr);
11602 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
11604 COption_TypeZ_free(_res_conv);
11607 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
11608 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
11609 *ret_copy = COption_TypeZ_clone(arg);
11610 uint64_t ret_ref = (uint64_t)ret_copy;
11613 int64_t __attribute__((visibility("default"))) TS_COption_TypeZ_clone_ptr(uint32_t arg) {
11614 LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)arg;
11615 int64_t ret_val = COption_TypeZ_clone_ptr(arg_conv);
11619 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_clone(uint32_t orig) {
11620 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
11621 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
11622 *ret_copy = COption_TypeZ_clone(orig_conv);
11623 uint64_t ret_ref = (uint64_t)ret_copy;
11627 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint32_t o) {
11628 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11629 CHECK_ACCESS(o_ptr);
11630 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
11631 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uint64_t)o) & ~1));
11632 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
11633 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
11634 return (uint64_t)ret_conv;
11637 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint32_t e) {
11638 LDKDecodeError e_conv;
11639 e_conv.inner = (void*)(e & (~1));
11640 e_conv.is_owned = (e & 1) || (e == 0);
11641 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11642 e_conv = DecodeError_clone(&e_conv);
11643 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
11644 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
11645 return (uint64_t)ret_conv;
11648 jboolean __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint32_t o) {
11649 LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(o & ~1);
11650 jboolean ret_val = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
11654 void __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint32_t _res) {
11655 if ((_res & 1) != 0) return;
11656 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11657 CHECK_ACCESS(_res_ptr);
11658 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
11660 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
11663 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
11664 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
11665 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
11666 return (uint64_t)ret_conv;
11668 int64_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint32_t arg) {
11669 LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
11670 int64_t ret_val = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
11674 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint32_t orig) {
11675 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
11676 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
11677 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
11678 return (uint64_t)ret_conv;
11681 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentErrorZ_ok(int8_tArray o) {
11682 LDKThirtyTwoBytes o_ref;
11683 CHECK(*((uint32_t*)o) == 32);
11684 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
11685 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
11686 *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
11687 return (uint64_t)ret_conv;
11690 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentErrorZ_err(uint32_t e) {
11691 void* e_ptr = (void*)(((uint64_t)e) & ~1);
11692 CHECK_ACCESS(e_ptr);
11693 LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
11694 e_conv = PaymentError_clone((LDKPaymentError*)(((uint64_t)e) & ~1));
11695 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
11696 *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
11697 return (uint64_t)ret_conv;
11700 jboolean __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentErrorZ_is_ok(uint32_t o) {
11701 LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(o & ~1);
11702 jboolean ret_val = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
11706 void __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentErrorZ_free(uint32_t _res) {
11707 if ((_res & 1) != 0) return;
11708 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11709 CHECK_ACCESS(_res_ptr);
11710 LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
11712 CResult_PaymentIdPaymentErrorZ_free(_res_conv);
11715 static inline uint64_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
11716 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
11717 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
11718 return (uint64_t)ret_conv;
11720 int64_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentErrorZ_clone_ptr(uint32_t arg) {
11721 LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
11722 int64_t ret_val = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
11726 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentErrorZ_clone(uint32_t orig) {
11727 LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(orig & ~1);
11728 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
11729 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
11730 return (uint64_t)ret_conv;
11733 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_ok(uint32_t o) {
11734 LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
11735 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
11736 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
11737 return (uint64_t)ret_conv;
11740 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_err() {
11741 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
11742 *ret_conv = CResult_SiPrefixNoneZ_err();
11743 return (uint64_t)ret_conv;
11746 jboolean __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_is_ok(uint32_t o) {
11747 LDKCResult_SiPrefixNoneZ* o_conv = (LDKCResult_SiPrefixNoneZ*)(o & ~1);
11748 jboolean ret_val = CResult_SiPrefixNoneZ_is_ok(o_conv);
11752 void __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_free(uint32_t _res) {
11753 if ((_res & 1) != 0) return;
11754 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11755 CHECK_ACCESS(_res_ptr);
11756 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(_res_ptr);
11758 CResult_SiPrefixNoneZ_free(_res_conv);
11761 static inline uint64_t CResult_SiPrefixNoneZ_clone_ptr(LDKCResult_SiPrefixNoneZ *NONNULL_PTR arg) {
11762 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
11763 *ret_conv = CResult_SiPrefixNoneZ_clone(arg);
11764 return (uint64_t)ret_conv;
11766 int64_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_clone_ptr(uint32_t arg) {
11767 LDKCResult_SiPrefixNoneZ* arg_conv = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
11768 int64_t ret_val = CResult_SiPrefixNoneZ_clone_ptr(arg_conv);
11772 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_clone(uint32_t orig) {
11773 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
11774 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
11775 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
11776 return (uint64_t)ret_conv;
11779 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_ok(uint32_t o) {
11781 o_conv.inner = (void*)(o & (~1));
11782 o_conv.is_owned = (o & 1) || (o == 0);
11783 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11784 o_conv = Invoice_clone(&o_conv);
11785 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
11786 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
11787 return (uint64_t)ret_conv;
11790 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_err() {
11791 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
11792 *ret_conv = CResult_InvoiceNoneZ_err();
11793 return (uint64_t)ret_conv;
11796 jboolean __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_is_ok(uint32_t o) {
11797 LDKCResult_InvoiceNoneZ* o_conv = (LDKCResult_InvoiceNoneZ*)(o & ~1);
11798 jboolean ret_val = CResult_InvoiceNoneZ_is_ok(o_conv);
11802 void __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_free(uint32_t _res) {
11803 if ((_res & 1) != 0) return;
11804 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11805 CHECK_ACCESS(_res_ptr);
11806 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(_res_ptr);
11808 CResult_InvoiceNoneZ_free(_res_conv);
11811 static inline uint64_t CResult_InvoiceNoneZ_clone_ptr(LDKCResult_InvoiceNoneZ *NONNULL_PTR arg) {
11812 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
11813 *ret_conv = CResult_InvoiceNoneZ_clone(arg);
11814 return (uint64_t)ret_conv;
11816 int64_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_clone_ptr(uint32_t arg) {
11817 LDKCResult_InvoiceNoneZ* arg_conv = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
11818 int64_t ret_val = CResult_InvoiceNoneZ_clone_ptr(arg_conv);
11822 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_clone(uint32_t orig) {
11823 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
11824 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
11825 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
11826 return (uint64_t)ret_conv;
11829 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_ok(uint32_t o) {
11830 LDKSignedRawInvoice o_conv;
11831 o_conv.inner = (void*)(o & (~1));
11832 o_conv.is_owned = (o & 1) || (o == 0);
11833 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11834 o_conv = SignedRawInvoice_clone(&o_conv);
11835 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
11836 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
11837 return (uint64_t)ret_conv;
11840 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_err() {
11841 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
11842 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
11843 return (uint64_t)ret_conv;
11846 jboolean __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_is_ok(uint32_t o) {
11847 LDKCResult_SignedRawInvoiceNoneZ* o_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(o & ~1);
11848 jboolean ret_val = CResult_SignedRawInvoiceNoneZ_is_ok(o_conv);
11852 void __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_free(uint32_t _res) {
11853 if ((_res & 1) != 0) return;
11854 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11855 CHECK_ACCESS(_res_ptr);
11856 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(_res_ptr);
11858 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
11861 static inline uint64_t CResult_SignedRawInvoiceNoneZ_clone_ptr(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR arg) {
11862 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
11863 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(arg);
11864 return (uint64_t)ret_conv;
11866 int64_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_clone_ptr(uint32_t arg) {
11867 LDKCResult_SignedRawInvoiceNoneZ* arg_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
11868 int64_t ret_val = CResult_SignedRawInvoiceNoneZ_clone_ptr(arg_conv);
11872 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_clone(uint32_t orig) {
11873 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
11874 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
11875 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
11876 return (uint64_t)ret_conv;
11879 static inline uint64_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
11880 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
11881 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
11882 return ((uint64_t)ret_conv);
11884 int64_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(uint32_t arg) {
11885 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(arg & ~1);
11886 int64_t ret_val = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
11890 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint32_t orig) {
11891 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
11892 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
11893 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
11894 return ((uint64_t)ret_conv);
11897 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint32_t a, int8_tArray b, uint32_t c) {
11898 LDKRawInvoice a_conv;
11899 a_conv.inner = (void*)(a & (~1));
11900 a_conv.is_owned = (a & 1) || (a == 0);
11901 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
11902 a_conv = RawInvoice_clone(&a_conv);
11903 LDKThirtyTwoBytes b_ref;
11904 CHECK(*((uint32_t*)b) == 32);
11905 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
11906 LDKInvoiceSignature c_conv;
11907 c_conv.inner = (void*)(c & (~1));
11908 c_conv.is_owned = (c & 1) || (c == 0);
11909 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
11910 c_conv = InvoiceSignature_clone(&c_conv);
11911 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
11912 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
11913 return ((uint64_t)ret_conv);
11916 void __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint32_t _res) {
11917 if ((_res & 1) != 0) return;
11918 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11919 CHECK_ACCESS(_res_ptr);
11920 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
11922 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
11925 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_ok(uint32_t o) {
11926 LDKPayeePubKey o_conv;
11927 o_conv.inner = (void*)(o & (~1));
11928 o_conv.is_owned = (o & 1) || (o == 0);
11929 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11930 o_conv = PayeePubKey_clone(&o_conv);
11931 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
11932 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
11933 return (uint64_t)ret_conv;
11936 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
11937 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11938 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
11939 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
11940 return (uint64_t)ret_conv;
11943 jboolean __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_is_ok(uint32_t o) {
11944 LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)(o & ~1);
11945 jboolean ret_val = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
11949 void __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_free(uint32_t _res) {
11950 if ((_res & 1) != 0) return;
11951 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11952 CHECK_ACCESS(_res_ptr);
11953 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
11955 CResult_PayeePubKeyErrorZ_free(_res_conv);
11958 static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
11959 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
11960 *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
11961 return (uint64_t)ret_conv;
11963 int64_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_clone_ptr(uint32_t arg) {
11964 LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
11965 int64_t ret_val = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
11969 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_clone(uint32_t orig) {
11970 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
11971 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
11972 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
11973 return (uint64_t)ret_conv;
11976 void __attribute__((visibility("default"))) TS_CVec_PrivateRouteZ_free(uint32_tArray _res) {
11977 LDKCVec_PrivateRouteZ _res_constr;
11978 _res_constr.datalen = *((uint32_t*)_res);
11979 if (_res_constr.datalen > 0)
11980 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
11982 _res_constr.data = NULL;
11983 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11984 for (size_t o = 0; o < _res_constr.datalen; o++) {
11985 uint32_t _res_conv_14 = _res_vals[o];
11986 LDKPrivateRoute _res_conv_14_conv;
11987 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
11988 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
11989 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
11990 _res_constr.data[o] = _res_conv_14_conv;
11992 CVec_PrivateRouteZ_free(_res_constr);
11995 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint32_t o) {
11996 LDKPositiveTimestamp o_conv;
11997 o_conv.inner = (void*)(o & (~1));
11998 o_conv.is_owned = (o & 1) || (o == 0);
11999 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12000 o_conv = PositiveTimestamp_clone(&o_conv);
12001 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
12002 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
12003 return (uint64_t)ret_conv;
12006 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
12007 LDKCreationError e_conv = LDKCreationError_from_js(e);
12008 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
12009 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
12010 return (uint64_t)ret_conv;
12013 jboolean __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint32_t o) {
12014 LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(o & ~1);
12015 jboolean ret_val = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
12019 void __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint32_t _res) {
12020 if ((_res & 1) != 0) return;
12021 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12022 CHECK_ACCESS(_res_ptr);
12023 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
12025 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
12028 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
12029 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
12030 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
12031 return (uint64_t)ret_conv;
12033 int64_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint32_t arg) {
12034 LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
12035 int64_t ret_val = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
12039 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint32_t orig) {
12040 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
12041 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
12042 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
12043 return (uint64_t)ret_conv;
12046 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_ok() {
12047 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
12048 *ret_conv = CResult_NoneSemanticErrorZ_ok();
12049 return (uint64_t)ret_conv;
12052 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
12053 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
12054 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
12055 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
12056 return (uint64_t)ret_conv;
12059 jboolean __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_is_ok(uint32_t o) {
12060 LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)(o & ~1);
12061 jboolean ret_val = CResult_NoneSemanticErrorZ_is_ok(o_conv);
12065 void __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_free(uint32_t _res) {
12066 if ((_res & 1) != 0) return;
12067 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12068 CHECK_ACCESS(_res_ptr);
12069 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
12071 CResult_NoneSemanticErrorZ_free(_res_conv);
12074 static inline uint64_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
12075 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
12076 *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
12077 return (uint64_t)ret_conv;
12079 int64_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_clone_ptr(uint32_t arg) {
12080 LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
12081 int64_t ret_val = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
12085 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_clone(uint32_t orig) {
12086 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
12087 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
12088 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
12089 return (uint64_t)ret_conv;
12092 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint32_t o) {
12094 o_conv.inner = (void*)(o & (~1));
12095 o_conv.is_owned = (o & 1) || (o == 0);
12096 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12097 o_conv = Invoice_clone(&o_conv);
12098 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
12099 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
12100 return (uint64_t)ret_conv;
12103 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
12104 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
12105 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
12106 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
12107 return (uint64_t)ret_conv;
12110 jboolean __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_is_ok(uint32_t o) {
12111 LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)(o & ~1);
12112 jboolean ret_val = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
12116 void __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_free(uint32_t _res) {
12117 if ((_res & 1) != 0) return;
12118 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12119 CHECK_ACCESS(_res_ptr);
12120 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
12122 CResult_InvoiceSemanticErrorZ_free(_res_conv);
12125 static inline uint64_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
12126 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
12127 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
12128 return (uint64_t)ret_conv;
12130 int64_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_clone_ptr(uint32_t arg) {
12131 LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
12132 int64_t ret_val = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
12136 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint32_t orig) {
12137 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
12138 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
12139 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
12140 return (uint64_t)ret_conv;
12143 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_ok(uint32_t o) {
12144 LDKDescription o_conv;
12145 o_conv.inner = (void*)(o & (~1));
12146 o_conv.is_owned = (o & 1) || (o == 0);
12147 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12148 o_conv = Description_clone(&o_conv);
12149 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
12150 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
12151 return (uint64_t)ret_conv;
12154 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
12155 LDKCreationError e_conv = LDKCreationError_from_js(e);
12156 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
12157 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
12158 return (uint64_t)ret_conv;
12161 jboolean __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint32_t o) {
12162 LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)(o & ~1);
12163 jboolean ret_val = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
12167 void __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_free(uint32_t _res) {
12168 if ((_res & 1) != 0) return;
12169 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12170 CHECK_ACCESS(_res_ptr);
12171 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
12173 CResult_DescriptionCreationErrorZ_free(_res_conv);
12176 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
12177 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
12178 *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
12179 return (uint64_t)ret_conv;
12181 int64_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint32_t arg) {
12182 LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
12183 int64_t ret_val = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
12187 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_clone(uint32_t orig) {
12188 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
12189 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
12190 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
12191 return (uint64_t)ret_conv;
12194 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_ok(uint32_t o) {
12195 LDKExpiryTime o_conv;
12196 o_conv.inner = (void*)(o & (~1));
12197 o_conv.is_owned = (o & 1) || (o == 0);
12198 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12199 o_conv = ExpiryTime_clone(&o_conv);
12200 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
12201 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
12202 return (uint64_t)ret_conv;
12205 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_err(uint32_t e) {
12206 LDKCreationError e_conv = LDKCreationError_from_js(e);
12207 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
12208 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
12209 return (uint64_t)ret_conv;
12212 jboolean __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_is_ok(uint32_t o) {
12213 LDKCResult_ExpiryTimeCreationErrorZ* o_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(o & ~1);
12214 jboolean ret_val = CResult_ExpiryTimeCreationErrorZ_is_ok(o_conv);
12218 void __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_free(uint32_t _res) {
12219 if ((_res & 1) != 0) return;
12220 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12221 CHECK_ACCESS(_res_ptr);
12222 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(_res_ptr);
12224 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
12227 static inline uint64_t CResult_ExpiryTimeCreationErrorZ_clone_ptr(LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR arg) {
12228 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
12229 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(arg);
12230 return (uint64_t)ret_conv;
12232 int64_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_clone_ptr(uint32_t arg) {
12233 LDKCResult_ExpiryTimeCreationErrorZ* arg_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
12234 int64_t ret_val = CResult_ExpiryTimeCreationErrorZ_clone_ptr(arg_conv);
12238 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_clone(uint32_t orig) {
12239 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
12240 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
12241 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
12242 return (uint64_t)ret_conv;
12245 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint32_t o) {
12246 LDKPrivateRoute o_conv;
12247 o_conv.inner = (void*)(o & (~1));
12248 o_conv.is_owned = (o & 1) || (o == 0);
12249 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12250 o_conv = PrivateRoute_clone(&o_conv);
12251 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
12252 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
12253 return (uint64_t)ret_conv;
12256 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
12257 LDKCreationError e_conv = LDKCreationError_from_js(e);
12258 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
12259 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
12260 return (uint64_t)ret_conv;
12263 jboolean __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint32_t o) {
12264 LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(o & ~1);
12265 jboolean ret_val = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
12269 void __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint32_t _res) {
12270 if ((_res & 1) != 0) return;
12271 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12272 CHECK_ACCESS(_res_ptr);
12273 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
12275 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
12278 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
12279 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
12280 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
12281 return (uint64_t)ret_conv;
12283 int64_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint32_t arg) {
12284 LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
12285 int64_t ret_val = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
12289 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint32_t orig) {
12290 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
12291 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
12292 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
12293 return (uint64_t)ret_conv;
12296 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_ok(jstring o) {
12297 LDKStr o_conv = str_ref_to_owned_c(o);
12298 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
12299 *ret_conv = CResult_StringErrorZ_ok(o_conv);
12300 return (uint64_t)ret_conv;
12303 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_err(uint32_t e) {
12304 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
12305 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
12306 *ret_conv = CResult_StringErrorZ_err(e_conv);
12307 return (uint64_t)ret_conv;
12310 jboolean __attribute__((visibility("default"))) TS_CResult_StringErrorZ_is_ok(uint32_t o) {
12311 LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)(o & ~1);
12312 jboolean ret_val = CResult_StringErrorZ_is_ok(o_conv);
12316 void __attribute__((visibility("default"))) TS_CResult_StringErrorZ_free(uint32_t _res) {
12317 if ((_res & 1) != 0) return;
12318 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12319 CHECK_ACCESS(_res_ptr);
12320 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
12322 CResult_StringErrorZ_free(_res_conv);
12325 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
12326 LDKChannelMonitorUpdate o_conv;
12327 o_conv.inner = (void*)(o & (~1));
12328 o_conv.is_owned = (o & 1) || (o == 0);
12329 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12330 o_conv = ChannelMonitorUpdate_clone(&o_conv);
12331 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
12332 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
12333 return (uint64_t)ret_conv;
12336 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
12337 LDKDecodeError e_conv;
12338 e_conv.inner = (void*)(e & (~1));
12339 e_conv.is_owned = (e & 1) || (e == 0);
12340 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12341 e_conv = DecodeError_clone(&e_conv);
12342 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
12343 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
12344 return (uint64_t)ret_conv;
12347 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint32_t o) {
12348 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(o & ~1);
12349 jboolean ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
12353 void __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
12354 if ((_res & 1) != 0) return;
12355 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12356 CHECK_ACCESS(_res_ptr);
12357 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
12359 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
12362 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
12363 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
12364 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
12365 return (uint64_t)ret_conv;
12367 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
12368 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
12369 int64_t ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
12373 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
12374 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
12375 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
12376 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
12377 return (uint64_t)ret_conv;
12380 uint32_t __attribute__((visibility("default"))) TS_COption_MonitorEventZ_some(uint32_t o) {
12381 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12382 CHECK_ACCESS(o_ptr);
12383 LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
12384 o_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)o) & ~1));
12385 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
12386 *ret_copy = COption_MonitorEventZ_some(o_conv);
12387 uint64_t ret_ref = (uint64_t)ret_copy;
12391 uint32_t __attribute__((visibility("default"))) TS_COption_MonitorEventZ_none() {
12392 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
12393 *ret_copy = COption_MonitorEventZ_none();
12394 uint64_t ret_ref = (uint64_t)ret_copy;
12398 void __attribute__((visibility("default"))) TS_COption_MonitorEventZ_free(uint32_t _res) {
12399 if ((_res & 1) != 0) return;
12400 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12401 CHECK_ACCESS(_res_ptr);
12402 LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
12404 COption_MonitorEventZ_free(_res_conv);
12407 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
12408 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
12409 *ret_copy = COption_MonitorEventZ_clone(arg);
12410 uint64_t ret_ref = (uint64_t)ret_copy;
12413 int64_t __attribute__((visibility("default"))) TS_COption_MonitorEventZ_clone_ptr(uint32_t arg) {
12414 LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)arg;
12415 int64_t ret_val = COption_MonitorEventZ_clone_ptr(arg_conv);
12419 uint32_t __attribute__((visibility("default"))) TS_COption_MonitorEventZ_clone(uint32_t orig) {
12420 LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)orig;
12421 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
12422 *ret_copy = COption_MonitorEventZ_clone(orig_conv);
12423 uint64_t ret_ref = (uint64_t)ret_copy;
12427 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint32_t o) {
12428 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12429 CHECK_ACCESS(o_ptr);
12430 LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
12431 o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)(((uint64_t)o) & ~1));
12432 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
12433 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
12434 return (uint64_t)ret_conv;
12437 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint32_t e) {
12438 LDKDecodeError e_conv;
12439 e_conv.inner = (void*)(e & (~1));
12440 e_conv.is_owned = (e & 1) || (e == 0);
12441 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12442 e_conv = DecodeError_clone(&e_conv);
12443 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
12444 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
12445 return (uint64_t)ret_conv;
12448 jboolean __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint32_t o) {
12449 LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(o & ~1);
12450 jboolean ret_val = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
12454 void __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint32_t _res) {
12455 if ((_res & 1) != 0) return;
12456 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12457 CHECK_ACCESS(_res_ptr);
12458 LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
12460 CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
12463 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
12464 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
12465 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
12466 return (uint64_t)ret_conv;
12468 int64_t __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint32_t arg) {
12469 LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
12470 int64_t ret_val = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
12474 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint32_t orig) {
12475 LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(orig & ~1);
12476 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
12477 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
12478 return (uint64_t)ret_conv;
12481 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
12482 LDKHTLCUpdate o_conv;
12483 o_conv.inner = (void*)(o & (~1));
12484 o_conv.is_owned = (o & 1) || (o == 0);
12485 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12486 o_conv = HTLCUpdate_clone(&o_conv);
12487 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
12488 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
12489 return (uint64_t)ret_conv;
12492 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
12493 LDKDecodeError e_conv;
12494 e_conv.inner = (void*)(e & (~1));
12495 e_conv.is_owned = (e & 1) || (e == 0);
12496 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12497 e_conv = DecodeError_clone(&e_conv);
12498 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
12499 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
12500 return (uint64_t)ret_conv;
12503 jboolean __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint32_t o) {
12504 LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(o & ~1);
12505 jboolean ret_val = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
12509 void __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
12510 if ((_res & 1) != 0) return;
12511 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12512 CHECK_ACCESS(_res_ptr);
12513 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
12515 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
12518 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
12519 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
12520 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
12521 return (uint64_t)ret_conv;
12523 int64_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
12524 LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
12525 int64_t ret_val = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
12529 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
12530 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
12531 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
12532 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
12533 return (uint64_t)ret_conv;
12536 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_ok() {
12537 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
12538 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
12539 return (uint64_t)ret_conv;
12542 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_err(uint32_t e) {
12543 LDKMonitorUpdateError e_conv;
12544 e_conv.inner = (void*)(e & (~1));
12545 e_conv.is_owned = (e & 1) || (e == 0);
12546 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12547 e_conv = MonitorUpdateError_clone(&e_conv);
12548 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
12549 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
12550 return (uint64_t)ret_conv;
12553 jboolean __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_is_ok(uint32_t o) {
12554 LDKCResult_NoneMonitorUpdateErrorZ* o_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(o & ~1);
12555 jboolean ret_val = CResult_NoneMonitorUpdateErrorZ_is_ok(o_conv);
12559 void __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_free(uint32_t _res) {
12560 if ((_res & 1) != 0) return;
12561 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12562 CHECK_ACCESS(_res_ptr);
12563 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(_res_ptr);
12565 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
12568 static inline uint64_t CResult_NoneMonitorUpdateErrorZ_clone_ptr(LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR arg) {
12569 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
12570 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(arg);
12571 return (uint64_t)ret_conv;
12573 int64_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_clone_ptr(uint32_t arg) {
12574 LDKCResult_NoneMonitorUpdateErrorZ* arg_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
12575 int64_t ret_val = CResult_NoneMonitorUpdateErrorZ_clone_ptr(arg_conv);
12579 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_clone(uint32_t orig) {
12580 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
12581 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
12582 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
12583 return (uint64_t)ret_conv;
12586 static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
12587 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
12588 *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
12589 return ((uint64_t)ret_conv);
12591 int64_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_clone_ptr(uint32_t arg) {
12592 LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)(arg & ~1);
12593 int64_t ret_val = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
12597 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_clone(uint32_t orig) {
12598 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
12599 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
12600 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
12601 return ((uint64_t)ret_conv);
12604 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
12605 LDKOutPoint a_conv;
12606 a_conv.inner = (void*)(a & (~1));
12607 a_conv.is_owned = (a & 1) || (a == 0);
12608 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
12609 a_conv = OutPoint_clone(&a_conv);
12611 b_ref.datalen = *((uint32_t*)b);
12612 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
12613 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
12614 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
12615 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
12616 return ((uint64_t)ret_conv);
12619 void __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
12620 if ((_res & 1) != 0) return;
12621 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12622 CHECK_ACCESS(_res_ptr);
12623 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
12625 C2Tuple_OutPointScriptZ_free(_res_conv);
12628 static inline uint64_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
12629 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
12630 *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
12631 return ((uint64_t)ret_conv);
12633 int64_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_clone_ptr(uint32_t arg) {
12634 LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)(arg & ~1);
12635 int64_t ret_val = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
12639 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_clone(uint32_t orig) {
12640 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
12641 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
12642 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
12643 return ((uint64_t)ret_conv);
12646 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
12648 b_ref.datalen = *((uint32_t*)b);
12649 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
12650 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
12651 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
12652 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
12653 return ((uint64_t)ret_conv);
12656 void __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_free(uint32_t _res) {
12657 if ((_res & 1) != 0) return;
12658 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12659 CHECK_ACCESS(_res_ptr);
12660 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
12662 C2Tuple_u32ScriptZ_free(_res_conv);
12665 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint32_tArray _res) {
12666 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
12667 _res_constr.datalen = *((uint32_t*)_res);
12668 if (_res_constr.datalen > 0)
12669 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
12671 _res_constr.data = NULL;
12672 uint32_t* _res_vals = (uint32_t*)(_res + 4);
12673 for (size_t v = 0; v < _res_constr.datalen; v++) {
12674 uint32_t _res_conv_21 = _res_vals[v];
12675 void* _res_conv_21_ptr = (void*)(((uint64_t)_res_conv_21) & ~1);
12676 CHECK_ACCESS(_res_conv_21_ptr);
12677 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
12678 FREE((void*)_res_conv_21);
12679 _res_constr.data[v] = _res_conv_21_conv;
12681 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
12684 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
12685 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
12686 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
12687 return ((uint64_t)ret_conv);
12689 int64_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(uint32_t arg) {
12690 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(arg & ~1);
12691 int64_t ret_val = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
12695 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint32_t orig) {
12696 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
12697 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
12698 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
12699 return ((uint64_t)ret_conv);
12702 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
12703 LDKThirtyTwoBytes a_ref;
12704 CHECK(*((uint32_t*)a) == 32);
12705 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
12706 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
12707 b_constr.datalen = *((uint32_t*)b);
12708 if (b_constr.datalen > 0)
12709 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
12711 b_constr.data = NULL;
12712 uint32_t* b_vals = (uint32_t*)(b + 4);
12713 for (size_t v = 0; v < b_constr.datalen; v++) {
12714 uint32_t b_conv_21 = b_vals[v];
12715 void* b_conv_21_ptr = (void*)(((uint64_t)b_conv_21) & ~1);
12716 CHECK_ACCESS(b_conv_21_ptr);
12717 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
12718 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_21) & ~1));
12719 b_constr.data[v] = b_conv_21_conv;
12721 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
12722 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
12723 return ((uint64_t)ret_conv);
12726 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint32_t _res) {
12727 if ((_res & 1) != 0) return;
12728 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12729 CHECK_ACCESS(_res_ptr);
12730 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
12732 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
12735 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint32_tArray _res) {
12736 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
12737 _res_constr.datalen = *((uint32_t*)_res);
12738 if (_res_constr.datalen > 0)
12739 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
12741 _res_constr.data = NULL;
12742 uint32_t* _res_vals = (uint32_t*)(_res + 4);
12743 for (size_t o = 0; o < _res_constr.datalen; o++) {
12744 uint32_t _res_conv_40 = _res_vals[o];
12745 void* _res_conv_40_ptr = (void*)(((uint64_t)_res_conv_40) & ~1);
12746 CHECK_ACCESS(_res_conv_40_ptr);
12747 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
12748 FREE((void*)_res_conv_40);
12749 _res_constr.data[o] = _res_conv_40_conv;
12751 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
12754 void __attribute__((visibility("default"))) TS_CVec_EventZ_free(uint32_tArray _res) {
12755 LDKCVec_EventZ _res_constr;
12756 _res_constr.datalen = *((uint32_t*)_res);
12757 if (_res_constr.datalen > 0)
12758 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
12760 _res_constr.data = NULL;
12761 uint32_t* _res_vals = (uint32_t*)(_res + 4);
12762 for (size_t h = 0; h < _res_constr.datalen; h++) {
12763 uint32_t _res_conv_7 = _res_vals[h];
12764 void* _res_conv_7_ptr = (void*)(((uint64_t)_res_conv_7) & ~1);
12765 CHECK_ACCESS(_res_conv_7_ptr);
12766 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
12767 FREE((void*)_res_conv_7);
12768 _res_constr.data[h] = _res_conv_7_conv;
12770 CVec_EventZ_free(_res_constr);
12773 void __attribute__((visibility("default"))) TS_CVec_TransactionZ_free(ptrArray _res) {
12774 LDKCVec_TransactionZ _res_constr;
12775 _res_constr.datalen = *((uint32_t*)_res);
12776 if (_res_constr.datalen > 0)
12777 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
12779 _res_constr.data = NULL;
12780 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
12781 for (size_t m = 0; m < _res_constr.datalen; m++) {
12782 int8_tArray _res_conv_12 = _res_vals[m];
12783 LDKTransaction _res_conv_12_ref;
12784 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
12785 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
12786 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
12787 _res_conv_12_ref.data_is_owned = true;
12788 _res_constr.data[m] = _res_conv_12_ref;
12790 CVec_TransactionZ_free(_res_constr);
12793 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
12794 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
12795 *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
12796 return ((uint64_t)ret_conv);
12798 int64_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint32_t arg) {
12799 LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)(arg & ~1);
12800 int64_t ret_val = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
12804 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
12805 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
12806 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
12807 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
12808 return ((uint64_t)ret_conv);
12811 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
12812 void* b_ptr = (void*)(((uint64_t)b) & ~1);
12813 CHECK_ACCESS(b_ptr);
12814 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
12815 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
12816 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
12817 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
12818 return ((uint64_t)ret_conv);
12821 void __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
12822 if ((_res & 1) != 0) return;
12823 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12824 CHECK_ACCESS(_res_ptr);
12825 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
12827 C2Tuple_u32TxOutZ_free(_res_conv);
12830 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
12831 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
12832 _res_constr.datalen = *((uint32_t*)_res);
12833 if (_res_constr.datalen > 0)
12834 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
12836 _res_constr.data = NULL;
12837 uint32_t* _res_vals = (uint32_t*)(_res + 4);
12838 for (size_t u = 0; u < _res_constr.datalen; u++) {
12839 uint32_t _res_conv_20 = _res_vals[u];
12840 void* _res_conv_20_ptr = (void*)(((uint64_t)_res_conv_20) & ~1);
12841 CHECK_ACCESS(_res_conv_20_ptr);
12842 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
12843 FREE((void*)_res_conv_20);
12844 _res_constr.data[u] = _res_conv_20_conv;
12846 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
12849 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
12850 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
12851 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
12852 return ((uint64_t)ret_conv);
12854 int64_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint32_t arg) {
12855 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arg & ~1);
12856 int64_t ret_val = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
12860 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint32_t orig) {
12861 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
12862 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
12863 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
12864 return ((uint64_t)ret_conv);
12867 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
12868 LDKThirtyTwoBytes a_ref;
12869 CHECK(*((uint32_t*)a) == 32);
12870 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
12871 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
12872 b_constr.datalen = *((uint32_t*)b);
12873 if (b_constr.datalen > 0)
12874 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
12876 b_constr.data = NULL;
12877 uint32_t* b_vals = (uint32_t*)(b + 4);
12878 for (size_t u = 0; u < b_constr.datalen; u++) {
12879 uint32_t b_conv_20 = b_vals[u];
12880 void* b_conv_20_ptr = (void*)(((uint64_t)b_conv_20) & ~1);
12881 CHECK_ACCESS(b_conv_20_ptr);
12882 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
12883 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1));
12884 b_constr.data[u] = b_conv_20_conv;
12886 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
12887 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
12888 return ((uint64_t)ret_conv);
12891 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
12892 if ((_res & 1) != 0) return;
12893 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12894 CHECK_ACCESS(_res_ptr);
12895 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
12897 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
12900 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
12901 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
12902 _res_constr.datalen = *((uint32_t*)_res);
12903 if (_res_constr.datalen > 0)
12904 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
12906 _res_constr.data = NULL;
12907 uint32_t* _res_vals = (uint32_t*)(_res + 4);
12908 for (size_t n = 0; n < _res_constr.datalen; n++) {
12909 uint32_t _res_conv_39 = _res_vals[n];
12910 void* _res_conv_39_ptr = (void*)(((uint64_t)_res_conv_39) & ~1);
12911 CHECK_ACCESS(_res_conv_39_ptr);
12912 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
12913 FREE((void*)_res_conv_39);
12914 _res_constr.data[n] = _res_conv_39_conv;
12916 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
12919 void __attribute__((visibility("default"))) TS_CVec_BalanceZ_free(uint32_tArray _res) {
12920 LDKCVec_BalanceZ _res_constr;
12921 _res_constr.datalen = *((uint32_t*)_res);
12922 if (_res_constr.datalen > 0)
12923 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
12925 _res_constr.data = NULL;
12926 uint32_t* _res_vals = (uint32_t*)(_res + 4);
12927 for (size_t j = 0; j < _res_constr.datalen; j++) {
12928 uint32_t _res_conv_9 = _res_vals[j];
12929 void* _res_conv_9_ptr = (void*)(((uint64_t)_res_conv_9) & ~1);
12930 CHECK_ACCESS(_res_conv_9_ptr);
12931 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
12932 FREE((void*)_res_conv_9);
12933 _res_constr.data[j] = _res_conv_9_conv;
12935 CVec_BalanceZ_free(_res_constr);
12938 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
12939 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12940 CHECK_ACCESS(o_ptr);
12941 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
12942 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1));
12943 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
12944 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
12945 return (uint64_t)ret_conv;
12948 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
12949 LDKDecodeError e_conv;
12950 e_conv.inner = (void*)(e & (~1));
12951 e_conv.is_owned = (e & 1) || (e == 0);
12952 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12953 e_conv = DecodeError_clone(&e_conv);
12954 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
12955 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
12956 return (uint64_t)ret_conv;
12959 jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint32_t o) {
12960 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(o & ~1);
12961 jboolean ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
12965 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
12966 if ((_res & 1) != 0) return;
12967 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12968 CHECK_ACCESS(_res_ptr);
12969 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
12971 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
12974 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
12975 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
12976 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
12977 return (uint64_t)ret_conv;
12979 int64_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint32_t arg) {
12980 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
12981 int64_t ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
12985 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint32_t orig) {
12986 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
12987 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
12988 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
12989 return (uint64_t)ret_conv;
12992 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_ok() {
12993 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12994 *ret_conv = CResult_NoneLightningErrorZ_ok();
12995 return (uint64_t)ret_conv;
12998 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
12999 LDKLightningError e_conv;
13000 e_conv.inner = (void*)(e & (~1));
13001 e_conv.is_owned = (e & 1) || (e == 0);
13002 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13003 e_conv = LightningError_clone(&e_conv);
13004 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13005 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
13006 return (uint64_t)ret_conv;
13009 jboolean __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_is_ok(uint32_t o) {
13010 LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)(o & ~1);
13011 jboolean ret_val = CResult_NoneLightningErrorZ_is_ok(o_conv);
13015 void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
13016 if ((_res & 1) != 0) return;
13017 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13018 CHECK_ACCESS(_res_ptr);
13019 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
13021 CResult_NoneLightningErrorZ_free(_res_conv);
13024 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
13025 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13026 *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
13027 return (uint64_t)ret_conv;
13029 int64_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint32_t arg) {
13030 LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
13031 int64_t ret_val = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
13035 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
13036 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
13037 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13038 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
13039 return (uint64_t)ret_conv;
13042 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
13043 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
13044 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
13045 return ((uint64_t)ret_conv);
13047 int64_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint32_t arg) {
13048 LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)(arg & ~1);
13049 int64_t ret_val = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
13053 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint32_t orig) {
13054 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
13055 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
13056 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
13057 return ((uint64_t)ret_conv);
13060 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
13061 LDKPublicKey a_ref;
13062 CHECK(*((uint32_t*)a) == 33);
13063 memcpy(a_ref.compressed_form, (uint8_t*)(a + 4), 33);
13064 void* b_ptr = (void*)(((uint64_t)b) & ~1);
13065 CHECK_ACCESS(b_ptr);
13066 LDKType b_conv = *(LDKType*)(b_ptr);
13067 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
13068 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
13069 return ((uint64_t)ret_conv);
13072 void __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_free(uint32_t _res) {
13073 if ((_res & 1) != 0) return;
13074 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13075 CHECK_ACCESS(_res_ptr);
13076 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
13078 C2Tuple_PublicKeyTypeZ_free(_res_conv);
13081 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint32_tArray _res) {
13082 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
13083 _res_constr.datalen = *((uint32_t*)_res);
13084 if (_res_constr.datalen > 0)
13085 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
13087 _res_constr.data = NULL;
13088 uint32_t* _res_vals = (uint32_t*)(_res + 4);
13089 for (size_t z = 0; z < _res_constr.datalen; z++) {
13090 uint32_t _res_conv_25 = _res_vals[z];
13091 void* _res_conv_25_ptr = (void*)(((uint64_t)_res_conv_25) & ~1);
13092 CHECK_ACCESS(_res_conv_25_ptr);
13093 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
13094 FREE((void*)_res_conv_25);
13095 _res_constr.data[z] = _res_conv_25_conv;
13097 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
13100 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
13101 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13102 *ret_conv = CResult_boolLightningErrorZ_ok(o);
13103 return (uint64_t)ret_conv;
13106 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
13107 LDKLightningError e_conv;
13108 e_conv.inner = (void*)(e & (~1));
13109 e_conv.is_owned = (e & 1) || (e == 0);
13110 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13111 e_conv = LightningError_clone(&e_conv);
13112 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13113 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
13114 return (uint64_t)ret_conv;
13117 jboolean __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_is_ok(uint32_t o) {
13118 LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)(o & ~1);
13119 jboolean ret_val = CResult_boolLightningErrorZ_is_ok(o_conv);
13123 void __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
13124 if ((_res & 1) != 0) return;
13125 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13126 CHECK_ACCESS(_res_ptr);
13127 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
13129 CResult_boolLightningErrorZ_free(_res_conv);
13132 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
13133 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13134 *ret_conv = CResult_boolLightningErrorZ_clone(arg);
13135 return (uint64_t)ret_conv;
13137 int64_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint32_t arg) {
13138 LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
13139 int64_t ret_val = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
13143 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
13144 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
13145 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13146 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
13147 return (uint64_t)ret_conv;
13150 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
13151 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13152 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
13153 return ((uint64_t)ret_conv);
13155 int64_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint32_t arg) {
13156 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arg & ~1);
13157 int64_t ret_val = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
13161 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
13162 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
13163 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13164 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
13165 return ((uint64_t)ret_conv);
13168 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
13169 LDKChannelAnnouncement a_conv;
13170 a_conv.inner = (void*)(a & (~1));
13171 a_conv.is_owned = (a & 1) || (a == 0);
13172 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
13173 a_conv = ChannelAnnouncement_clone(&a_conv);
13174 LDKChannelUpdate b_conv;
13175 b_conv.inner = (void*)(b & (~1));
13176 b_conv.is_owned = (b & 1) || (b == 0);
13177 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
13178 b_conv = ChannelUpdate_clone(&b_conv);
13179 LDKChannelUpdate c_conv;
13180 c_conv.inner = (void*)(c & (~1));
13181 c_conv.is_owned = (c & 1) || (c == 0);
13182 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
13183 c_conv = ChannelUpdate_clone(&c_conv);
13184 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13185 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
13186 return ((uint64_t)ret_conv);
13189 void __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
13190 if ((_res & 1) != 0) return;
13191 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13192 CHECK_ACCESS(_res_ptr);
13193 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
13195 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
13198 void __attribute__((visibility("default"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
13199 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
13200 _res_constr.datalen = *((uint32_t*)_res);
13201 if (_res_constr.datalen > 0)
13202 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
13204 _res_constr.data = NULL;
13205 uint32_t* _res_vals = (uint32_t*)(_res + 4);
13206 for (size_t h = 0; h < _res_constr.datalen; h++) {
13207 uint32_t _res_conv_59 = _res_vals[h];
13208 void* _res_conv_59_ptr = (void*)(((uint64_t)_res_conv_59) & ~1);
13209 CHECK_ACCESS(_res_conv_59_ptr);
13210 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
13211 FREE((void*)_res_conv_59);
13212 _res_constr.data[h] = _res_conv_59_conv;
13214 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
13217 void __attribute__((visibility("default"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
13218 LDKCVec_NodeAnnouncementZ _res_constr;
13219 _res_constr.datalen = *((uint32_t*)_res);
13220 if (_res_constr.datalen > 0)
13221 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
13223 _res_constr.data = NULL;
13224 uint32_t* _res_vals = (uint32_t*)(_res + 4);
13225 for (size_t s = 0; s < _res_constr.datalen; s++) {
13226 uint32_t _res_conv_18 = _res_vals[s];
13227 LDKNodeAnnouncement _res_conv_18_conv;
13228 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
13229 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
13230 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
13231 _res_constr.data[s] = _res_conv_18_conv;
13233 CVec_NodeAnnouncementZ_free(_res_constr);
13236 void __attribute__((visibility("default"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
13237 LDKCVec_PublicKeyZ _res_constr;
13238 _res_constr.datalen = *((uint32_t*)_res);
13239 if (_res_constr.datalen > 0)
13240 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
13242 _res_constr.data = NULL;
13243 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
13244 for (size_t m = 0; m < _res_constr.datalen; m++) {
13245 int8_tArray _res_conv_12 = _res_vals[m];
13246 LDKPublicKey _res_conv_12_ref;
13247 CHECK(*((uint32_t*)_res_conv_12) == 33);
13248 memcpy(_res_conv_12_ref.compressed_form, (uint8_t*)(_res_conv_12 + 4), 33);
13249 _res_constr.data[m] = _res_conv_12_ref;
13251 CVec_PublicKeyZ_free(_res_constr);
13254 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
13256 o_ref.datalen = *((uint32_t*)o);
13257 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
13258 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
13259 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
13260 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
13261 return (uint64_t)ret_conv;
13264 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
13265 LDKPeerHandleError e_conv;
13266 e_conv.inner = (void*)(e & (~1));
13267 e_conv.is_owned = (e & 1) || (e == 0);
13268 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13269 e_conv = PeerHandleError_clone(&e_conv);
13270 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
13271 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
13272 return (uint64_t)ret_conv;
13275 jboolean __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint32_t o) {
13276 LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(o & ~1);
13277 jboolean ret_val = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
13281 void __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
13282 if ((_res & 1) != 0) return;
13283 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13284 CHECK_ACCESS(_res_ptr);
13285 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
13287 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
13290 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
13291 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
13292 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
13293 return (uint64_t)ret_conv;
13295 int64_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint32_t arg) {
13296 LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
13297 int64_t ret_val = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
13301 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
13302 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
13303 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
13304 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
13305 return (uint64_t)ret_conv;
13308 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_ok() {
13309 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
13310 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
13311 return (uint64_t)ret_conv;
13314 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
13315 LDKPeerHandleError e_conv;
13316 e_conv.inner = (void*)(e & (~1));
13317 e_conv.is_owned = (e & 1) || (e == 0);
13318 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13319 e_conv = PeerHandleError_clone(&e_conv);
13320 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
13321 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
13322 return (uint64_t)ret_conv;
13325 jboolean __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint32_t o) {
13326 LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)(o & ~1);
13327 jboolean ret_val = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
13331 void __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
13332 if ((_res & 1) != 0) return;
13333 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13334 CHECK_ACCESS(_res_ptr);
13335 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
13337 CResult_NonePeerHandleErrorZ_free(_res_conv);
13340 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
13341 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
13342 *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
13343 return (uint64_t)ret_conv;
13345 int64_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint32_t arg) {
13346 LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
13347 int64_t ret_val = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
13351 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
13352 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
13353 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
13354 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
13355 return (uint64_t)ret_conv;
13358 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
13359 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
13360 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
13361 return (uint64_t)ret_conv;
13364 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
13365 LDKPeerHandleError e_conv;
13366 e_conv.inner = (void*)(e & (~1));
13367 e_conv.is_owned = (e & 1) || (e == 0);
13368 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13369 e_conv = PeerHandleError_clone(&e_conv);
13370 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
13371 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
13372 return (uint64_t)ret_conv;
13375 jboolean __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint32_t o) {
13376 LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)(o & ~1);
13377 jboolean ret_val = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
13381 void __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
13382 if ((_res & 1) != 0) return;
13383 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13384 CHECK_ACCESS(_res_ptr);
13385 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
13387 CResult_boolPeerHandleErrorZ_free(_res_conv);
13390 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
13391 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
13392 *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
13393 return (uint64_t)ret_conv;
13395 int64_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint32_t arg) {
13396 LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
13397 int64_t ret_val = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
13401 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
13402 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
13403 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
13404 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
13405 return (uint64_t)ret_conv;
13408 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint32_t o) {
13410 o_conv.inner = (void*)(o & (~1));
13411 o_conv.is_owned = (o & 1) || (o == 0);
13412 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13413 o_conv = NodeId_clone(&o_conv);
13414 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13415 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
13416 return (uint64_t)ret_conv;
13419 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_err(uint32_t e) {
13420 LDKDecodeError e_conv;
13421 e_conv.inner = (void*)(e & (~1));
13422 e_conv.is_owned = (e & 1) || (e == 0);
13423 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13424 e_conv = DecodeError_clone(&e_conv);
13425 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13426 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
13427 return (uint64_t)ret_conv;
13430 jboolean __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint32_t o) {
13431 LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)(o & ~1);
13432 jboolean ret_val = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
13436 void __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_free(uint32_t _res) {
13437 if ((_res & 1) != 0) return;
13438 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13439 CHECK_ACCESS(_res_ptr);
13440 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
13442 CResult_NodeIdDecodeErrorZ_free(_res_conv);
13445 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
13446 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13447 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
13448 return (uint64_t)ret_conv;
13450 int64_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint32_t arg) {
13451 LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
13452 int64_t ret_val = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
13456 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint32_t orig) {
13457 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
13458 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13459 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
13460 return (uint64_t)ret_conv;
13463 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint32_t o) {
13464 void* o_ptr = (void*)(((uint64_t)o) & ~1);
13465 CHECK_ACCESS(o_ptr);
13466 LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
13467 o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)o) & ~1));
13468 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
13469 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
13470 return (uint64_t)ret_conv;
13473 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint32_t e) {
13474 LDKDecodeError e_conv;
13475 e_conv.inner = (void*)(e & (~1));
13476 e_conv.is_owned = (e & 1) || (e == 0);
13477 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13478 e_conv = DecodeError_clone(&e_conv);
13479 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
13480 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
13481 return (uint64_t)ret_conv;
13484 jboolean __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint32_t o) {
13485 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(o & ~1);
13486 jboolean ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
13490 void __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint32_t _res) {
13491 if ((_res & 1) != 0) return;
13492 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13493 CHECK_ACCESS(_res_ptr);
13494 LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
13496 CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
13499 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
13500 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
13501 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
13502 return (uint64_t)ret_conv;
13504 int64_t __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint32_t arg) {
13505 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
13506 int64_t ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
13510 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint32_t orig) {
13511 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(orig & ~1);
13512 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
13513 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
13514 return (uint64_t)ret_conv;
13517 uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_some(uint32_t o) {
13518 void* o_ptr = (void*)(((uint64_t)o) & ~1);
13519 CHECK_ACCESS(o_ptr);
13520 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
13521 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
13522 *ret_copy = COption_AccessZ_some(o_conv);
13523 uint64_t ret_ref = (uint64_t)ret_copy;
13527 uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_none() {
13528 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
13529 *ret_copy = COption_AccessZ_none();
13530 uint64_t ret_ref = (uint64_t)ret_copy;
13534 void __attribute__((visibility("default"))) TS_COption_AccessZ_free(uint32_t _res) {
13535 if ((_res & 1) != 0) return;
13536 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13537 CHECK_ACCESS(_res_ptr);
13538 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
13540 COption_AccessZ_free(_res_conv);
13543 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok(uint32_t o) {
13544 LDKDirectionalChannelInfo o_conv;
13545 o_conv.inner = (void*)(o & (~1));
13546 o_conv.is_owned = (o & 1) || (o == 0);
13547 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13548 o_conv = DirectionalChannelInfo_clone(&o_conv);
13549 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
13550 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
13551 return (uint64_t)ret_conv;
13554 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_err(uint32_t e) {
13555 LDKDecodeError e_conv;
13556 e_conv.inner = (void*)(e & (~1));
13557 e_conv.is_owned = (e & 1) || (e == 0);
13558 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13559 e_conv = DecodeError_clone(&e_conv);
13560 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
13561 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
13562 return (uint64_t)ret_conv;
13565 jboolean __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(uint32_t o) {
13566 LDKCResult_DirectionalChannelInfoDecodeErrorZ* o_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(o & ~1);
13567 jboolean ret_val = CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(o_conv);
13571 void __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_free(uint32_t _res) {
13572 if ((_res & 1) != 0) return;
13573 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13574 CHECK_ACCESS(_res_ptr);
13575 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(_res_ptr);
13577 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
13580 static inline uint64_t CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
13581 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
13582 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(arg);
13583 return (uint64_t)ret_conv;
13585 int64_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
13586 LDKCResult_DirectionalChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
13587 int64_t ret_val = CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
13591 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone(uint32_t orig) {
13592 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
13593 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
13594 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
13595 return (uint64_t)ret_conv;
13598 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
13599 LDKChannelInfo o_conv;
13600 o_conv.inner = (void*)(o & (~1));
13601 o_conv.is_owned = (o & 1) || (o == 0);
13602 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13603 o_conv = ChannelInfo_clone(&o_conv);
13604 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13605 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
13606 return (uint64_t)ret_conv;
13609 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
13610 LDKDecodeError e_conv;
13611 e_conv.inner = (void*)(e & (~1));
13612 e_conv.is_owned = (e & 1) || (e == 0);
13613 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13614 e_conv = DecodeError_clone(&e_conv);
13615 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13616 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
13617 return (uint64_t)ret_conv;
13620 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint32_t o) {
13621 LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(o & ~1);
13622 jboolean ret_val = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
13626 void __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
13627 if ((_res & 1) != 0) return;
13628 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13629 CHECK_ACCESS(_res_ptr);
13630 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
13632 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
13635 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
13636 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13637 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
13638 return (uint64_t)ret_conv;
13640 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
13641 LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
13642 int64_t ret_val = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
13646 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
13647 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
13648 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13649 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
13650 return (uint64_t)ret_conv;
13653 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
13654 LDKRoutingFees o_conv;
13655 o_conv.inner = (void*)(o & (~1));
13656 o_conv.is_owned = (o & 1) || (o == 0);
13657 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13658 o_conv = RoutingFees_clone(&o_conv);
13659 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13660 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
13661 return (uint64_t)ret_conv;
13664 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
13665 LDKDecodeError e_conv;
13666 e_conv.inner = (void*)(e & (~1));
13667 e_conv.is_owned = (e & 1) || (e == 0);
13668 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13669 e_conv = DecodeError_clone(&e_conv);
13670 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13671 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
13672 return (uint64_t)ret_conv;
13675 jboolean __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint32_t o) {
13676 LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(o & ~1);
13677 jboolean ret_val = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
13681 void __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
13682 if ((_res & 1) != 0) return;
13683 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13684 CHECK_ACCESS(_res_ptr);
13685 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
13687 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
13690 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
13691 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13692 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
13693 return (uint64_t)ret_conv;
13695 int64_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint32_t arg) {
13696 LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
13697 int64_t ret_val = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
13701 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
13702 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
13703 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13704 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
13705 return (uint64_t)ret_conv;
13708 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
13709 LDKNodeAnnouncementInfo o_conv;
13710 o_conv.inner = (void*)(o & (~1));
13711 o_conv.is_owned = (o & 1) || (o == 0);
13712 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13713 o_conv = NodeAnnouncementInfo_clone(&o_conv);
13714 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13715 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
13716 return (uint64_t)ret_conv;
13719 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
13720 LDKDecodeError e_conv;
13721 e_conv.inner = (void*)(e & (~1));
13722 e_conv.is_owned = (e & 1) || (e == 0);
13723 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13724 e_conv = DecodeError_clone(&e_conv);
13725 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13726 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
13727 return (uint64_t)ret_conv;
13730 jboolean __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint32_t o) {
13731 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(o & ~1);
13732 jboolean ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
13736 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
13737 if ((_res & 1) != 0) return;
13738 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13739 CHECK_ACCESS(_res_ptr);
13740 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
13742 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
13745 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
13746 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13747 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
13748 return (uint64_t)ret_conv;
13750 int64_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
13751 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
13752 int64_t ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
13756 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
13757 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
13758 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13759 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
13760 return (uint64_t)ret_conv;
13763 void __attribute__((visibility("default"))) TS_CVec_u64Z_free(int64_tArray _res) {
13764 LDKCVec_u64Z _res_constr;
13765 _res_constr.datalen = *((uint32_t*)_res);
13766 if (_res_constr.datalen > 0)
13767 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
13769 _res_constr.data = NULL;
13770 int64_t* _res_vals = (int64_t*)(_res + 4);
13771 for (size_t i = 0; i < _res_constr.datalen; i++) {
13772 int64_t _res_conv_8 = _res_vals[i];
13773 _res_constr.data[i] = _res_conv_8;
13775 CVec_u64Z_free(_res_constr);
13778 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
13779 LDKNodeInfo o_conv;
13780 o_conv.inner = (void*)(o & (~1));
13781 o_conv.is_owned = (o & 1) || (o == 0);
13782 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13783 o_conv = NodeInfo_clone(&o_conv);
13784 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13785 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
13786 return (uint64_t)ret_conv;
13789 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
13790 LDKDecodeError e_conv;
13791 e_conv.inner = (void*)(e & (~1));
13792 e_conv.is_owned = (e & 1) || (e == 0);
13793 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13794 e_conv = DecodeError_clone(&e_conv);
13795 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13796 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
13797 return (uint64_t)ret_conv;
13800 jboolean __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint32_t o) {
13801 LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(o & ~1);
13802 jboolean ret_val = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
13806 void __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
13807 if ((_res & 1) != 0) return;
13808 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13809 CHECK_ACCESS(_res_ptr);
13810 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
13812 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
13815 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
13816 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13817 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
13818 return (uint64_t)ret_conv;
13820 int64_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
13821 LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
13822 int64_t ret_val = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
13826 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
13827 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
13828 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13829 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
13830 return (uint64_t)ret_conv;
13833 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
13834 LDKNetworkGraph o_conv;
13835 o_conv.inner = (void*)(o & (~1));
13836 o_conv.is_owned = (o & 1) || (o == 0);
13837 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13838 o_conv = NetworkGraph_clone(&o_conv);
13839 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
13840 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
13841 return (uint64_t)ret_conv;
13844 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
13845 LDKDecodeError e_conv;
13846 e_conv.inner = (void*)(e & (~1));
13847 e_conv.is_owned = (e & 1) || (e == 0);
13848 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13849 e_conv = DecodeError_clone(&e_conv);
13850 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
13851 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
13852 return (uint64_t)ret_conv;
13855 jboolean __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint32_t o) {
13856 LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(o & ~1);
13857 jboolean ret_val = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
13861 void __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
13862 if ((_res & 1) != 0) return;
13863 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13864 CHECK_ACCESS(_res_ptr);
13865 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
13867 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
13870 static inline uint64_t CResult_NetworkGraphDecodeErrorZ_clone_ptr(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR arg) {
13871 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
13872 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(arg);
13873 return (uint64_t)ret_conv;
13875 int64_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_clone_ptr(uint32_t arg) {
13876 LDKCResult_NetworkGraphDecodeErrorZ* arg_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
13877 int64_t ret_val = CResult_NetworkGraphDecodeErrorZ_clone_ptr(arg_conv);
13881 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_clone(uint32_t orig) {
13882 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
13883 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
13884 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
13885 return (uint64_t)ret_conv;
13888 uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_some(uint32_tArray o) {
13889 LDKCVec_NetAddressZ o_constr;
13890 o_constr.datalen = *((uint32_t*)o);
13891 if (o_constr.datalen > 0)
13892 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
13894 o_constr.data = NULL;
13895 uint32_t* o_vals = (uint32_t*)(o + 4);
13896 for (size_t m = 0; m < o_constr.datalen; m++) {
13897 uint32_t o_conv_12 = o_vals[m];
13898 void* o_conv_12_ptr = (void*)(((uint64_t)o_conv_12) & ~1);
13899 CHECK_ACCESS(o_conv_12_ptr);
13900 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
13901 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o_conv_12) & ~1));
13902 o_constr.data[m] = o_conv_12_conv;
13904 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
13905 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
13906 uint64_t ret_ref = (uint64_t)ret_copy;
13910 uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_none() {
13911 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
13912 *ret_copy = COption_CVec_NetAddressZZ_none();
13913 uint64_t ret_ref = (uint64_t)ret_copy;
13917 void __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_free(uint32_t _res) {
13918 if ((_res & 1) != 0) return;
13919 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13920 CHECK_ACCESS(_res_ptr);
13921 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
13923 COption_CVec_NetAddressZZ_free(_res_conv);
13926 static inline uint64_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
13927 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
13928 *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
13929 uint64_t ret_ref = (uint64_t)ret_copy;
13932 int64_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_clone_ptr(uint32_t arg) {
13933 LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)arg;
13934 int64_t ret_val = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
13938 uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_clone(uint32_t orig) {
13939 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
13940 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
13941 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
13942 uint64_t ret_ref = (uint64_t)ret_copy;
13946 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint32_t o) {
13947 void* o_ptr = (void*)(((uint64_t)o) & ~1);
13948 CHECK_ACCESS(o_ptr);
13949 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
13950 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
13951 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
13952 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
13953 return (uint64_t)ret_conv;
13956 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_err(uint32_t e) {
13957 LDKDecodeError e_conv;
13958 e_conv.inner = (void*)(e & (~1));
13959 e_conv.is_owned = (e & 1) || (e == 0);
13960 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13961 e_conv = DecodeError_clone(&e_conv);
13962 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
13963 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
13964 return (uint64_t)ret_conv;
13967 jboolean __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint32_t o) {
13968 LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)(o & ~1);
13969 jboolean ret_val = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
13973 void __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_free(uint32_t _res) {
13974 if ((_res & 1) != 0) return;
13975 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13976 CHECK_ACCESS(_res_ptr);
13977 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
13979 CResult_NetAddressDecodeErrorZ_free(_res_conv);
13982 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
13983 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
13984 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
13985 return (uint64_t)ret_conv;
13987 int64_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint32_t arg) {
13988 LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
13989 int64_t ret_val = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
13993 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint32_t orig) {
13994 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
13995 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
13996 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
13997 return (uint64_t)ret_conv;
14000 void __attribute__((visibility("default"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
14001 LDKCVec_UpdateAddHTLCZ _res_constr;
14002 _res_constr.datalen = *((uint32_t*)_res);
14003 if (_res_constr.datalen > 0)
14004 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
14006 _res_constr.data = NULL;
14007 uint32_t* _res_vals = (uint32_t*)(_res + 4);
14008 for (size_t p = 0; p < _res_constr.datalen; p++) {
14009 uint32_t _res_conv_15 = _res_vals[p];
14010 LDKUpdateAddHTLC _res_conv_15_conv;
14011 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
14012 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
14013 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
14014 _res_constr.data[p] = _res_conv_15_conv;
14016 CVec_UpdateAddHTLCZ_free(_res_constr);
14019 void __attribute__((visibility("default"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
14020 LDKCVec_UpdateFulfillHTLCZ _res_constr;
14021 _res_constr.datalen = *((uint32_t*)_res);
14022 if (_res_constr.datalen > 0)
14023 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
14025 _res_constr.data = NULL;
14026 uint32_t* _res_vals = (uint32_t*)(_res + 4);
14027 for (size_t t = 0; t < _res_constr.datalen; t++) {
14028 uint32_t _res_conv_19 = _res_vals[t];
14029 LDKUpdateFulfillHTLC _res_conv_19_conv;
14030 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
14031 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
14032 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
14033 _res_constr.data[t] = _res_conv_19_conv;
14035 CVec_UpdateFulfillHTLCZ_free(_res_constr);
14038 void __attribute__((visibility("default"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
14039 LDKCVec_UpdateFailHTLCZ _res_constr;
14040 _res_constr.datalen = *((uint32_t*)_res);
14041 if (_res_constr.datalen > 0)
14042 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
14044 _res_constr.data = NULL;
14045 uint32_t* _res_vals = (uint32_t*)(_res + 4);
14046 for (size_t q = 0; q < _res_constr.datalen; q++) {
14047 uint32_t _res_conv_16 = _res_vals[q];
14048 LDKUpdateFailHTLC _res_conv_16_conv;
14049 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
14050 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
14051 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
14052 _res_constr.data[q] = _res_conv_16_conv;
14054 CVec_UpdateFailHTLCZ_free(_res_constr);
14057 void __attribute__((visibility("default"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
14058 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
14059 _res_constr.datalen = *((uint32_t*)_res);
14060 if (_res_constr.datalen > 0)
14061 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
14063 _res_constr.data = NULL;
14064 uint32_t* _res_vals = (uint32_t*)(_res + 4);
14065 for (size_t z = 0; z < _res_constr.datalen; z++) {
14066 uint32_t _res_conv_25 = _res_vals[z];
14067 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
14068 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
14069 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
14070 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
14071 _res_constr.data[z] = _res_conv_25_conv;
14073 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
14076 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
14077 LDKAcceptChannel o_conv;
14078 o_conv.inner = (void*)(o & (~1));
14079 o_conv.is_owned = (o & 1) || (o == 0);
14080 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14081 o_conv = AcceptChannel_clone(&o_conv);
14082 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
14083 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
14084 return (uint64_t)ret_conv;
14087 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
14088 LDKDecodeError e_conv;
14089 e_conv.inner = (void*)(e & (~1));
14090 e_conv.is_owned = (e & 1) || (e == 0);
14091 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14092 e_conv = DecodeError_clone(&e_conv);
14093 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
14094 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
14095 return (uint64_t)ret_conv;
14098 jboolean __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint32_t o) {
14099 LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(o & ~1);
14100 jboolean ret_val = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
14104 void __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
14105 if ((_res & 1) != 0) return;
14106 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14107 CHECK_ACCESS(_res_ptr);
14108 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
14110 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
14113 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
14114 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
14115 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
14116 return (uint64_t)ret_conv;
14118 int64_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint32_t arg) {
14119 LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
14120 int64_t ret_val = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
14124 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
14125 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
14126 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
14127 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
14128 return (uint64_t)ret_conv;
14131 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
14132 LDKAnnouncementSignatures o_conv;
14133 o_conv.inner = (void*)(o & (~1));
14134 o_conv.is_owned = (o & 1) || (o == 0);
14135 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14136 o_conv = AnnouncementSignatures_clone(&o_conv);
14137 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
14138 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
14139 return (uint64_t)ret_conv;
14142 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
14143 LDKDecodeError e_conv;
14144 e_conv.inner = (void*)(e & (~1));
14145 e_conv.is_owned = (e & 1) || (e == 0);
14146 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14147 e_conv = DecodeError_clone(&e_conv);
14148 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
14149 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
14150 return (uint64_t)ret_conv;
14153 jboolean __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint32_t o) {
14154 LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(o & ~1);
14155 jboolean ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
14159 void __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
14160 if ((_res & 1) != 0) return;
14161 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14162 CHECK_ACCESS(_res_ptr);
14163 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
14165 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
14168 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
14169 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
14170 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
14171 return (uint64_t)ret_conv;
14173 int64_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
14174 LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
14175 int64_t ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
14179 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
14180 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
14181 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
14182 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
14183 return (uint64_t)ret_conv;
14186 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
14187 LDKChannelReestablish o_conv;
14188 o_conv.inner = (void*)(o & (~1));
14189 o_conv.is_owned = (o & 1) || (o == 0);
14190 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14191 o_conv = ChannelReestablish_clone(&o_conv);
14192 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
14193 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
14194 return (uint64_t)ret_conv;
14197 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
14198 LDKDecodeError e_conv;
14199 e_conv.inner = (void*)(e & (~1));
14200 e_conv.is_owned = (e & 1) || (e == 0);
14201 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14202 e_conv = DecodeError_clone(&e_conv);
14203 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
14204 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
14205 return (uint64_t)ret_conv;
14208 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint32_t o) {
14209 LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(o & ~1);
14210 jboolean ret_val = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
14214 void __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
14215 if ((_res & 1) != 0) return;
14216 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14217 CHECK_ACCESS(_res_ptr);
14218 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
14220 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
14223 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
14224 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
14225 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
14226 return (uint64_t)ret_conv;
14228 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint32_t arg) {
14229 LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
14230 int64_t ret_val = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
14234 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
14235 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
14236 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
14237 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
14238 return (uint64_t)ret_conv;
14241 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
14242 LDKClosingSigned o_conv;
14243 o_conv.inner = (void*)(o & (~1));
14244 o_conv.is_owned = (o & 1) || (o == 0);
14245 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14246 o_conv = ClosingSigned_clone(&o_conv);
14247 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
14248 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
14249 return (uint64_t)ret_conv;
14252 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
14253 LDKDecodeError e_conv;
14254 e_conv.inner = (void*)(e & (~1));
14255 e_conv.is_owned = (e & 1) || (e == 0);
14256 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14257 e_conv = DecodeError_clone(&e_conv);
14258 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
14259 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
14260 return (uint64_t)ret_conv;
14263 jboolean __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint32_t o) {
14264 LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(o & ~1);
14265 jboolean ret_val = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
14269 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
14270 if ((_res & 1) != 0) return;
14271 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14272 CHECK_ACCESS(_res_ptr);
14273 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
14275 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
14278 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
14279 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
14280 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
14281 return (uint64_t)ret_conv;
14283 int64_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
14284 LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
14285 int64_t ret_val = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
14289 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
14290 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
14291 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
14292 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
14293 return (uint64_t)ret_conv;
14296 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint32_t o) {
14297 LDKClosingSignedFeeRange o_conv;
14298 o_conv.inner = (void*)(o & (~1));
14299 o_conv.is_owned = (o & 1) || (o == 0);
14300 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14301 o_conv = ClosingSignedFeeRange_clone(&o_conv);
14302 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
14303 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
14304 return (uint64_t)ret_conv;
14307 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint32_t e) {
14308 LDKDecodeError e_conv;
14309 e_conv.inner = (void*)(e & (~1));
14310 e_conv.is_owned = (e & 1) || (e == 0);
14311 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14312 e_conv = DecodeError_clone(&e_conv);
14313 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
14314 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
14315 return (uint64_t)ret_conv;
14318 jboolean __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint32_t o) {
14319 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(o & ~1);
14320 jboolean ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
14324 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint32_t _res) {
14325 if ((_res & 1) != 0) return;
14326 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14327 CHECK_ACCESS(_res_ptr);
14328 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
14330 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
14333 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
14334 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
14335 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
14336 return (uint64_t)ret_conv;
14338 int64_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
14339 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
14340 int64_t ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
14344 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint32_t orig) {
14345 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
14346 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
14347 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
14348 return (uint64_t)ret_conv;
14351 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
14352 LDKCommitmentSigned o_conv;
14353 o_conv.inner = (void*)(o & (~1));
14354 o_conv.is_owned = (o & 1) || (o == 0);
14355 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14356 o_conv = CommitmentSigned_clone(&o_conv);
14357 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
14358 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
14359 return (uint64_t)ret_conv;
14362 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
14363 LDKDecodeError e_conv;
14364 e_conv.inner = (void*)(e & (~1));
14365 e_conv.is_owned = (e & 1) || (e == 0);
14366 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14367 e_conv = DecodeError_clone(&e_conv);
14368 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
14369 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
14370 return (uint64_t)ret_conv;
14373 jboolean __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint32_t o) {
14374 LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(o & ~1);
14375 jboolean ret_val = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
14379 void __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
14380 if ((_res & 1) != 0) return;
14381 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14382 CHECK_ACCESS(_res_ptr);
14383 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
14385 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
14388 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
14389 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
14390 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
14391 return (uint64_t)ret_conv;
14393 int64_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
14394 LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
14395 int64_t ret_val = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
14399 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
14400 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
14401 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
14402 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
14403 return (uint64_t)ret_conv;
14406 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
14407 LDKFundingCreated o_conv;
14408 o_conv.inner = (void*)(o & (~1));
14409 o_conv.is_owned = (o & 1) || (o == 0);
14410 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14411 o_conv = FundingCreated_clone(&o_conv);
14412 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
14413 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
14414 return (uint64_t)ret_conv;
14417 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
14418 LDKDecodeError e_conv;
14419 e_conv.inner = (void*)(e & (~1));
14420 e_conv.is_owned = (e & 1) || (e == 0);
14421 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14422 e_conv = DecodeError_clone(&e_conv);
14423 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
14424 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
14425 return (uint64_t)ret_conv;
14428 jboolean __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint32_t o) {
14429 LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(o & ~1);
14430 jboolean ret_val = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
14434 void __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
14435 if ((_res & 1) != 0) return;
14436 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14437 CHECK_ACCESS(_res_ptr);
14438 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
14440 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
14443 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
14444 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
14445 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
14446 return (uint64_t)ret_conv;
14448 int64_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint32_t arg) {
14449 LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
14450 int64_t ret_val = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
14454 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
14455 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
14456 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
14457 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
14458 return (uint64_t)ret_conv;
14461 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
14462 LDKFundingSigned o_conv;
14463 o_conv.inner = (void*)(o & (~1));
14464 o_conv.is_owned = (o & 1) || (o == 0);
14465 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14466 o_conv = FundingSigned_clone(&o_conv);
14467 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
14468 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
14469 return (uint64_t)ret_conv;
14472 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
14473 LDKDecodeError e_conv;
14474 e_conv.inner = (void*)(e & (~1));
14475 e_conv.is_owned = (e & 1) || (e == 0);
14476 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14477 e_conv = DecodeError_clone(&e_conv);
14478 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
14479 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
14480 return (uint64_t)ret_conv;
14483 jboolean __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint32_t o) {
14484 LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(o & ~1);
14485 jboolean ret_val = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
14489 void __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
14490 if ((_res & 1) != 0) return;
14491 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14492 CHECK_ACCESS(_res_ptr);
14493 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
14495 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
14498 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
14499 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
14500 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
14501 return (uint64_t)ret_conv;
14503 int64_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
14504 LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
14505 int64_t ret_val = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
14509 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
14510 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
14511 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
14512 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
14513 return (uint64_t)ret_conv;
14516 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_ok(uint32_t o) {
14517 LDKFundingLocked o_conv;
14518 o_conv.inner = (void*)(o & (~1));
14519 o_conv.is_owned = (o & 1) || (o == 0);
14520 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14521 o_conv = FundingLocked_clone(&o_conv);
14522 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
14523 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
14524 return (uint64_t)ret_conv;
14527 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_err(uint32_t e) {
14528 LDKDecodeError e_conv;
14529 e_conv.inner = (void*)(e & (~1));
14530 e_conv.is_owned = (e & 1) || (e == 0);
14531 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14532 e_conv = DecodeError_clone(&e_conv);
14533 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
14534 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
14535 return (uint64_t)ret_conv;
14538 jboolean __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_is_ok(uint32_t o) {
14539 LDKCResult_FundingLockedDecodeErrorZ* o_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(o & ~1);
14540 jboolean ret_val = CResult_FundingLockedDecodeErrorZ_is_ok(o_conv);
14544 void __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_free(uint32_t _res) {
14545 if ((_res & 1) != 0) return;
14546 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14547 CHECK_ACCESS(_res_ptr);
14548 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(_res_ptr);
14550 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
14553 static inline uint64_t CResult_FundingLockedDecodeErrorZ_clone_ptr(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR arg) {
14554 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
14555 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(arg);
14556 return (uint64_t)ret_conv;
14558 int64_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_clone_ptr(uint32_t arg) {
14559 LDKCResult_FundingLockedDecodeErrorZ* arg_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
14560 int64_t ret_val = CResult_FundingLockedDecodeErrorZ_clone_ptr(arg_conv);
14564 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_clone(uint32_t orig) {
14565 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
14566 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
14567 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
14568 return (uint64_t)ret_conv;
14571 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
14573 o_conv.inner = (void*)(o & (~1));
14574 o_conv.is_owned = (o & 1) || (o == 0);
14575 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14576 o_conv = Init_clone(&o_conv);
14577 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
14578 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
14579 return (uint64_t)ret_conv;
14582 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
14583 LDKDecodeError e_conv;
14584 e_conv.inner = (void*)(e & (~1));
14585 e_conv.is_owned = (e & 1) || (e == 0);
14586 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14587 e_conv = DecodeError_clone(&e_conv);
14588 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
14589 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
14590 return (uint64_t)ret_conv;
14593 jboolean __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_is_ok(uint32_t o) {
14594 LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)(o & ~1);
14595 jboolean ret_val = CResult_InitDecodeErrorZ_is_ok(o_conv);
14599 void __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
14600 if ((_res & 1) != 0) return;
14601 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14602 CHECK_ACCESS(_res_ptr);
14603 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
14605 CResult_InitDecodeErrorZ_free(_res_conv);
14608 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
14609 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
14610 *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
14611 return (uint64_t)ret_conv;
14613 int64_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint32_t arg) {
14614 LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
14615 int64_t ret_val = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
14619 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
14620 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
14621 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
14622 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
14623 return (uint64_t)ret_conv;
14626 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
14627 LDKOpenChannel o_conv;
14628 o_conv.inner = (void*)(o & (~1));
14629 o_conv.is_owned = (o & 1) || (o == 0);
14630 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14631 o_conv = OpenChannel_clone(&o_conv);
14632 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
14633 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
14634 return (uint64_t)ret_conv;
14637 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
14638 LDKDecodeError e_conv;
14639 e_conv.inner = (void*)(e & (~1));
14640 e_conv.is_owned = (e & 1) || (e == 0);
14641 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14642 e_conv = DecodeError_clone(&e_conv);
14643 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
14644 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
14645 return (uint64_t)ret_conv;
14648 jboolean __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint32_t o) {
14649 LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(o & ~1);
14650 jboolean ret_val = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
14654 void __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
14655 if ((_res & 1) != 0) return;
14656 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14657 CHECK_ACCESS(_res_ptr);
14658 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
14660 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
14663 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
14664 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
14665 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
14666 return (uint64_t)ret_conv;
14668 int64_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint32_t arg) {
14669 LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
14670 int64_t ret_val = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
14674 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
14675 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
14676 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
14677 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
14678 return (uint64_t)ret_conv;
14681 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
14682 LDKRevokeAndACK o_conv;
14683 o_conv.inner = (void*)(o & (~1));
14684 o_conv.is_owned = (o & 1) || (o == 0);
14685 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14686 o_conv = RevokeAndACK_clone(&o_conv);
14687 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
14688 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
14689 return (uint64_t)ret_conv;
14692 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
14693 LDKDecodeError e_conv;
14694 e_conv.inner = (void*)(e & (~1));
14695 e_conv.is_owned = (e & 1) || (e == 0);
14696 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14697 e_conv = DecodeError_clone(&e_conv);
14698 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
14699 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
14700 return (uint64_t)ret_conv;
14703 jboolean __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint32_t o) {
14704 LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(o & ~1);
14705 jboolean ret_val = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
14709 void __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
14710 if ((_res & 1) != 0) return;
14711 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14712 CHECK_ACCESS(_res_ptr);
14713 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
14715 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
14718 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
14719 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
14720 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
14721 return (uint64_t)ret_conv;
14723 int64_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint32_t arg) {
14724 LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
14725 int64_t ret_val = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
14729 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
14730 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
14731 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
14732 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
14733 return (uint64_t)ret_conv;
14736 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
14737 LDKShutdown o_conv;
14738 o_conv.inner = (void*)(o & (~1));
14739 o_conv.is_owned = (o & 1) || (o == 0);
14740 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14741 o_conv = Shutdown_clone(&o_conv);
14742 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
14743 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
14744 return (uint64_t)ret_conv;
14747 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
14748 LDKDecodeError e_conv;
14749 e_conv.inner = (void*)(e & (~1));
14750 e_conv.is_owned = (e & 1) || (e == 0);
14751 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14752 e_conv = DecodeError_clone(&e_conv);
14753 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
14754 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
14755 return (uint64_t)ret_conv;
14758 jboolean __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint32_t o) {
14759 LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)(o & ~1);
14760 jboolean ret_val = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
14764 void __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
14765 if ((_res & 1) != 0) return;
14766 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14767 CHECK_ACCESS(_res_ptr);
14768 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
14770 CResult_ShutdownDecodeErrorZ_free(_res_conv);
14773 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
14774 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
14775 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
14776 return (uint64_t)ret_conv;
14778 int64_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint32_t arg) {
14779 LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
14780 int64_t ret_val = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
14784 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
14785 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
14786 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
14787 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
14788 return (uint64_t)ret_conv;
14791 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
14792 LDKUpdateFailHTLC o_conv;
14793 o_conv.inner = (void*)(o & (~1));
14794 o_conv.is_owned = (o & 1) || (o == 0);
14795 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14796 o_conv = UpdateFailHTLC_clone(&o_conv);
14797 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
14798 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
14799 return (uint64_t)ret_conv;
14802 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
14803 LDKDecodeError e_conv;
14804 e_conv.inner = (void*)(e & (~1));
14805 e_conv.is_owned = (e & 1) || (e == 0);
14806 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14807 e_conv = DecodeError_clone(&e_conv);
14808 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
14809 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
14810 return (uint64_t)ret_conv;
14813 jboolean __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint32_t o) {
14814 LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(o & ~1);
14815 jboolean ret_val = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
14819 void __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
14820 if ((_res & 1) != 0) return;
14821 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14822 CHECK_ACCESS(_res_ptr);
14823 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
14825 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
14828 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
14829 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
14830 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
14831 return (uint64_t)ret_conv;
14833 int64_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
14834 LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
14835 int64_t ret_val = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
14839 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
14840 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
14841 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
14842 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
14843 return (uint64_t)ret_conv;
14846 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
14847 LDKUpdateFailMalformedHTLC o_conv;
14848 o_conv.inner = (void*)(o & (~1));
14849 o_conv.is_owned = (o & 1) || (o == 0);
14850 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14851 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
14852 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
14853 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
14854 return (uint64_t)ret_conv;
14857 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
14858 LDKDecodeError e_conv;
14859 e_conv.inner = (void*)(e & (~1));
14860 e_conv.is_owned = (e & 1) || (e == 0);
14861 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14862 e_conv = DecodeError_clone(&e_conv);
14863 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
14864 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
14865 return (uint64_t)ret_conv;
14868 jboolean __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint32_t o) {
14869 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(o & ~1);
14870 jboolean ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
14874 void __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
14875 if ((_res & 1) != 0) return;
14876 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14877 CHECK_ACCESS(_res_ptr);
14878 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
14880 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
14883 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
14884 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
14885 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
14886 return (uint64_t)ret_conv;
14888 int64_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
14889 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
14890 int64_t ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
14894 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
14895 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
14896 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
14897 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
14898 return (uint64_t)ret_conv;
14901 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
14902 LDKUpdateFee o_conv;
14903 o_conv.inner = (void*)(o & (~1));
14904 o_conv.is_owned = (o & 1) || (o == 0);
14905 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14906 o_conv = UpdateFee_clone(&o_conv);
14907 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
14908 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
14909 return (uint64_t)ret_conv;
14912 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
14913 LDKDecodeError e_conv;
14914 e_conv.inner = (void*)(e & (~1));
14915 e_conv.is_owned = (e & 1) || (e == 0);
14916 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14917 e_conv = DecodeError_clone(&e_conv);
14918 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
14919 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
14920 return (uint64_t)ret_conv;
14923 jboolean __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint32_t o) {
14924 LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(o & ~1);
14925 jboolean ret_val = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
14929 void __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
14930 if ((_res & 1) != 0) return;
14931 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14932 CHECK_ACCESS(_res_ptr);
14933 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
14935 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
14938 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
14939 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
14940 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
14941 return (uint64_t)ret_conv;
14943 int64_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint32_t arg) {
14944 LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
14945 int64_t ret_val = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
14949 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
14950 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
14951 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
14952 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
14953 return (uint64_t)ret_conv;
14956 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
14957 LDKUpdateFulfillHTLC o_conv;
14958 o_conv.inner = (void*)(o & (~1));
14959 o_conv.is_owned = (o & 1) || (o == 0);
14960 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14961 o_conv = UpdateFulfillHTLC_clone(&o_conv);
14962 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
14963 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
14964 return (uint64_t)ret_conv;
14967 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
14968 LDKDecodeError e_conv;
14969 e_conv.inner = (void*)(e & (~1));
14970 e_conv.is_owned = (e & 1) || (e == 0);
14971 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14972 e_conv = DecodeError_clone(&e_conv);
14973 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
14974 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
14975 return (uint64_t)ret_conv;
14978 jboolean __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint32_t o) {
14979 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(o & ~1);
14980 jboolean ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
14984 void __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
14985 if ((_res & 1) != 0) return;
14986 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14987 CHECK_ACCESS(_res_ptr);
14988 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
14990 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
14993 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
14994 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
14995 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
14996 return (uint64_t)ret_conv;
14998 int64_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
14999 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
15000 int64_t ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
15004 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
15005 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
15006 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
15007 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
15008 return (uint64_t)ret_conv;
15011 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
15012 LDKUpdateAddHTLC o_conv;
15013 o_conv.inner = (void*)(o & (~1));
15014 o_conv.is_owned = (o & 1) || (o == 0);
15015 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15016 o_conv = UpdateAddHTLC_clone(&o_conv);
15017 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
15018 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
15019 return (uint64_t)ret_conv;
15022 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
15023 LDKDecodeError e_conv;
15024 e_conv.inner = (void*)(e & (~1));
15025 e_conv.is_owned = (e & 1) || (e == 0);
15026 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15027 e_conv = DecodeError_clone(&e_conv);
15028 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
15029 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
15030 return (uint64_t)ret_conv;
15033 jboolean __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint32_t o) {
15034 LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(o & ~1);
15035 jboolean ret_val = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
15039 void __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
15040 if ((_res & 1) != 0) return;
15041 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15042 CHECK_ACCESS(_res_ptr);
15043 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
15045 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
15048 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
15049 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
15050 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
15051 return (uint64_t)ret_conv;
15053 int64_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
15054 LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
15055 int64_t ret_val = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
15059 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
15060 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
15061 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
15062 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
15063 return (uint64_t)ret_conv;
15066 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
15068 o_conv.inner = (void*)(o & (~1));
15069 o_conv.is_owned = (o & 1) || (o == 0);
15070 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15071 o_conv = Ping_clone(&o_conv);
15072 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
15073 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
15074 return (uint64_t)ret_conv;
15077 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
15078 LDKDecodeError e_conv;
15079 e_conv.inner = (void*)(e & (~1));
15080 e_conv.is_owned = (e & 1) || (e == 0);
15081 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15082 e_conv = DecodeError_clone(&e_conv);
15083 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
15084 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
15085 return (uint64_t)ret_conv;
15088 jboolean __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_is_ok(uint32_t o) {
15089 LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)(o & ~1);
15090 jboolean ret_val = CResult_PingDecodeErrorZ_is_ok(o_conv);
15094 void __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
15095 if ((_res & 1) != 0) return;
15096 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15097 CHECK_ACCESS(_res_ptr);
15098 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
15100 CResult_PingDecodeErrorZ_free(_res_conv);
15103 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
15104 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
15105 *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
15106 return (uint64_t)ret_conv;
15108 int64_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint32_t arg) {
15109 LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
15110 int64_t ret_val = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
15114 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
15115 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
15116 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
15117 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
15118 return (uint64_t)ret_conv;
15121 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
15123 o_conv.inner = (void*)(o & (~1));
15124 o_conv.is_owned = (o & 1) || (o == 0);
15125 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15126 o_conv = Pong_clone(&o_conv);
15127 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
15128 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
15129 return (uint64_t)ret_conv;
15132 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
15133 LDKDecodeError e_conv;
15134 e_conv.inner = (void*)(e & (~1));
15135 e_conv.is_owned = (e & 1) || (e == 0);
15136 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15137 e_conv = DecodeError_clone(&e_conv);
15138 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
15139 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
15140 return (uint64_t)ret_conv;
15143 jboolean __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_is_ok(uint32_t o) {
15144 LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)(o & ~1);
15145 jboolean ret_val = CResult_PongDecodeErrorZ_is_ok(o_conv);
15149 void __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
15150 if ((_res & 1) != 0) return;
15151 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15152 CHECK_ACCESS(_res_ptr);
15153 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
15155 CResult_PongDecodeErrorZ_free(_res_conv);
15158 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
15159 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
15160 *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
15161 return (uint64_t)ret_conv;
15163 int64_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint32_t arg) {
15164 LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
15165 int64_t ret_val = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
15169 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
15170 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
15171 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
15172 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
15173 return (uint64_t)ret_conv;
15176 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
15177 LDKUnsignedChannelAnnouncement o_conv;
15178 o_conv.inner = (void*)(o & (~1));
15179 o_conv.is_owned = (o & 1) || (o == 0);
15180 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15181 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
15182 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
15183 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
15184 return (uint64_t)ret_conv;
15187 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
15188 LDKDecodeError e_conv;
15189 e_conv.inner = (void*)(e & (~1));
15190 e_conv.is_owned = (e & 1) || (e == 0);
15191 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15192 e_conv = DecodeError_clone(&e_conv);
15193 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
15194 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
15195 return (uint64_t)ret_conv;
15198 jboolean __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
15199 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(o & ~1);
15200 jboolean ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
15204 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
15205 if ((_res & 1) != 0) return;
15206 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15207 CHECK_ACCESS(_res_ptr);
15208 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
15210 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
15213 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
15214 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
15215 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
15216 return (uint64_t)ret_conv;
15218 int64_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
15219 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
15220 int64_t ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
15224 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
15225 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
15226 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
15227 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
15228 return (uint64_t)ret_conv;
15231 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
15232 LDKChannelAnnouncement o_conv;
15233 o_conv.inner = (void*)(o & (~1));
15234 o_conv.is_owned = (o & 1) || (o == 0);
15235 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15236 o_conv = ChannelAnnouncement_clone(&o_conv);
15237 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
15238 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
15239 return (uint64_t)ret_conv;
15242 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
15243 LDKDecodeError e_conv;
15244 e_conv.inner = (void*)(e & (~1));
15245 e_conv.is_owned = (e & 1) || (e == 0);
15246 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15247 e_conv = DecodeError_clone(&e_conv);
15248 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
15249 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
15250 return (uint64_t)ret_conv;
15253 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
15254 LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(o & ~1);
15255 jboolean ret_val = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
15259 void __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
15260 if ((_res & 1) != 0) return;
15261 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15262 CHECK_ACCESS(_res_ptr);
15263 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
15265 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
15268 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
15269 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
15270 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
15271 return (uint64_t)ret_conv;
15273 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
15274 LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
15275 int64_t ret_val = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
15279 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
15280 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
15281 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
15282 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
15283 return (uint64_t)ret_conv;
15286 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
15287 LDKUnsignedChannelUpdate o_conv;
15288 o_conv.inner = (void*)(o & (~1));
15289 o_conv.is_owned = (o & 1) || (o == 0);
15290 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15291 o_conv = UnsignedChannelUpdate_clone(&o_conv);
15292 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
15293 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
15294 return (uint64_t)ret_conv;
15297 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
15298 LDKDecodeError e_conv;
15299 e_conv.inner = (void*)(e & (~1));
15300 e_conv.is_owned = (e & 1) || (e == 0);
15301 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15302 e_conv = DecodeError_clone(&e_conv);
15303 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
15304 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
15305 return (uint64_t)ret_conv;
15308 jboolean __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint32_t o) {
15309 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(o & ~1);
15310 jboolean ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
15314 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
15315 if ((_res & 1) != 0) return;
15316 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15317 CHECK_ACCESS(_res_ptr);
15318 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
15320 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
15323 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
15324 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
15325 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
15326 return (uint64_t)ret_conv;
15328 int64_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
15329 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
15330 int64_t ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
15334 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
15335 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
15336 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
15337 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
15338 return (uint64_t)ret_conv;
15341 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
15342 LDKChannelUpdate o_conv;
15343 o_conv.inner = (void*)(o & (~1));
15344 o_conv.is_owned = (o & 1) || (o == 0);
15345 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15346 o_conv = ChannelUpdate_clone(&o_conv);
15347 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
15348 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
15349 return (uint64_t)ret_conv;
15352 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
15353 LDKDecodeError e_conv;
15354 e_conv.inner = (void*)(e & (~1));
15355 e_conv.is_owned = (e & 1) || (e == 0);
15356 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15357 e_conv = DecodeError_clone(&e_conv);
15358 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
15359 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
15360 return (uint64_t)ret_conv;
15363 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint32_t o) {
15364 LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(o & ~1);
15365 jboolean ret_val = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
15369 void __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
15370 if ((_res & 1) != 0) return;
15371 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15372 CHECK_ACCESS(_res_ptr);
15373 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
15375 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
15378 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
15379 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
15380 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
15381 return (uint64_t)ret_conv;
15383 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
15384 LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
15385 int64_t ret_val = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
15389 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
15390 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
15391 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
15392 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
15393 return (uint64_t)ret_conv;
15396 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
15397 LDKErrorMessage o_conv;
15398 o_conv.inner = (void*)(o & (~1));
15399 o_conv.is_owned = (o & 1) || (o == 0);
15400 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15401 o_conv = ErrorMessage_clone(&o_conv);
15402 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
15403 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
15404 return (uint64_t)ret_conv;
15407 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
15408 LDKDecodeError e_conv;
15409 e_conv.inner = (void*)(e & (~1));
15410 e_conv.is_owned = (e & 1) || (e == 0);
15411 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15412 e_conv = DecodeError_clone(&e_conv);
15413 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
15414 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
15415 return (uint64_t)ret_conv;
15418 jboolean __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint32_t o) {
15419 LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(o & ~1);
15420 jboolean ret_val = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
15424 void __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
15425 if ((_res & 1) != 0) return;
15426 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15427 CHECK_ACCESS(_res_ptr);
15428 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
15430 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
15433 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
15434 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
15435 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
15436 return (uint64_t)ret_conv;
15438 int64_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint32_t arg) {
15439 LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
15440 int64_t ret_val = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
15444 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
15445 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
15446 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
15447 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
15448 return (uint64_t)ret_conv;
15451 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
15452 LDKUnsignedNodeAnnouncement o_conv;
15453 o_conv.inner = (void*)(o & (~1));
15454 o_conv.is_owned = (o & 1) || (o == 0);
15455 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15456 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
15457 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
15458 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
15459 return (uint64_t)ret_conv;
15462 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
15463 LDKDecodeError e_conv;
15464 e_conv.inner = (void*)(e & (~1));
15465 e_conv.is_owned = (e & 1) || (e == 0);
15466 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15467 e_conv = DecodeError_clone(&e_conv);
15468 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
15469 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
15470 return (uint64_t)ret_conv;
15473 jboolean __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
15474 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(o & ~1);
15475 jboolean ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
15479 void __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
15480 if ((_res & 1) != 0) return;
15481 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15482 CHECK_ACCESS(_res_ptr);
15483 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
15485 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
15488 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
15489 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
15490 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
15491 return (uint64_t)ret_conv;
15493 int64_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
15494 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
15495 int64_t ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
15499 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
15500 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
15501 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
15502 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
15503 return (uint64_t)ret_conv;
15506 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
15507 LDKNodeAnnouncement o_conv;
15508 o_conv.inner = (void*)(o & (~1));
15509 o_conv.is_owned = (o & 1) || (o == 0);
15510 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15511 o_conv = NodeAnnouncement_clone(&o_conv);
15512 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
15513 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
15514 return (uint64_t)ret_conv;
15517 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
15518 LDKDecodeError e_conv;
15519 e_conv.inner = (void*)(e & (~1));
15520 e_conv.is_owned = (e & 1) || (e == 0);
15521 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15522 e_conv = DecodeError_clone(&e_conv);
15523 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
15524 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
15525 return (uint64_t)ret_conv;
15528 jboolean __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
15529 LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(o & ~1);
15530 jboolean ret_val = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
15534 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
15535 if ((_res & 1) != 0) return;
15536 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15537 CHECK_ACCESS(_res_ptr);
15538 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
15540 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
15543 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
15544 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
15545 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
15546 return (uint64_t)ret_conv;
15548 int64_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
15549 LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
15550 int64_t ret_val = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
15554 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
15555 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
15556 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
15557 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
15558 return (uint64_t)ret_conv;
15561 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
15562 LDKQueryShortChannelIds o_conv;
15563 o_conv.inner = (void*)(o & (~1));
15564 o_conv.is_owned = (o & 1) || (o == 0);
15565 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15566 o_conv = QueryShortChannelIds_clone(&o_conv);
15567 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
15568 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
15569 return (uint64_t)ret_conv;
15572 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
15573 LDKDecodeError e_conv;
15574 e_conv.inner = (void*)(e & (~1));
15575 e_conv.is_owned = (e & 1) || (e == 0);
15576 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15577 e_conv = DecodeError_clone(&e_conv);
15578 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
15579 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
15580 return (uint64_t)ret_conv;
15583 jboolean __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint32_t o) {
15584 LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(o & ~1);
15585 jboolean ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
15589 void __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
15590 if ((_res & 1) != 0) return;
15591 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15592 CHECK_ACCESS(_res_ptr);
15593 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
15595 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
15598 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
15599 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
15600 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
15601 return (uint64_t)ret_conv;
15603 int64_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint32_t arg) {
15604 LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
15605 int64_t ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
15609 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
15610 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
15611 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
15612 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
15613 return (uint64_t)ret_conv;
15616 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
15617 LDKReplyShortChannelIdsEnd o_conv;
15618 o_conv.inner = (void*)(o & (~1));
15619 o_conv.is_owned = (o & 1) || (o == 0);
15620 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15621 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
15622 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
15623 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
15624 return (uint64_t)ret_conv;
15627 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
15628 LDKDecodeError e_conv;
15629 e_conv.inner = (void*)(e & (~1));
15630 e_conv.is_owned = (e & 1) || (e == 0);
15631 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15632 e_conv = DecodeError_clone(&e_conv);
15633 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
15634 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
15635 return (uint64_t)ret_conv;
15638 jboolean __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint32_t o) {
15639 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(o & ~1);
15640 jboolean ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
15644 void __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
15645 if ((_res & 1) != 0) return;
15646 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15647 CHECK_ACCESS(_res_ptr);
15648 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
15650 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
15653 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
15654 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
15655 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
15656 return (uint64_t)ret_conv;
15658 int64_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint32_t arg) {
15659 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
15660 int64_t ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
15664 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
15665 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
15666 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
15667 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
15668 return (uint64_t)ret_conv;
15671 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
15672 LDKQueryChannelRange o_conv;
15673 o_conv.inner = (void*)(o & (~1));
15674 o_conv.is_owned = (o & 1) || (o == 0);
15675 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15676 o_conv = QueryChannelRange_clone(&o_conv);
15677 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
15678 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
15679 return (uint64_t)ret_conv;
15682 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
15683 LDKDecodeError e_conv;
15684 e_conv.inner = (void*)(e & (~1));
15685 e_conv.is_owned = (e & 1) || (e == 0);
15686 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15687 e_conv = DecodeError_clone(&e_conv);
15688 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
15689 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
15690 return (uint64_t)ret_conv;
15693 jboolean __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint32_t o) {
15694 LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(o & ~1);
15695 jboolean ret_val = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
15699 void __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
15700 if ((_res & 1) != 0) return;
15701 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15702 CHECK_ACCESS(_res_ptr);
15703 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
15705 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
15708 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
15709 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
15710 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
15711 return (uint64_t)ret_conv;
15713 int64_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
15714 LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
15715 int64_t ret_val = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
15719 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
15720 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
15721 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
15722 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
15723 return (uint64_t)ret_conv;
15726 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
15727 LDKReplyChannelRange o_conv;
15728 o_conv.inner = (void*)(o & (~1));
15729 o_conv.is_owned = (o & 1) || (o == 0);
15730 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15731 o_conv = ReplyChannelRange_clone(&o_conv);
15732 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
15733 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
15734 return (uint64_t)ret_conv;
15737 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
15738 LDKDecodeError e_conv;
15739 e_conv.inner = (void*)(e & (~1));
15740 e_conv.is_owned = (e & 1) || (e == 0);
15741 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15742 e_conv = DecodeError_clone(&e_conv);
15743 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
15744 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
15745 return (uint64_t)ret_conv;
15748 jboolean __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint32_t o) {
15749 LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(o & ~1);
15750 jboolean ret_val = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
15754 void __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
15755 if ((_res & 1) != 0) return;
15756 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15757 CHECK_ACCESS(_res_ptr);
15758 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
15760 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
15763 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
15764 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
15765 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
15766 return (uint64_t)ret_conv;
15768 int64_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
15769 LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
15770 int64_t ret_val = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
15774 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
15775 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
15776 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
15777 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
15778 return (uint64_t)ret_conv;
15781 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
15782 LDKGossipTimestampFilter o_conv;
15783 o_conv.inner = (void*)(o & (~1));
15784 o_conv.is_owned = (o & 1) || (o == 0);
15785 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15786 o_conv = GossipTimestampFilter_clone(&o_conv);
15787 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
15788 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
15789 return (uint64_t)ret_conv;
15792 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
15793 LDKDecodeError e_conv;
15794 e_conv.inner = (void*)(e & (~1));
15795 e_conv.is_owned = (e & 1) || (e == 0);
15796 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15797 e_conv = DecodeError_clone(&e_conv);
15798 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
15799 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
15800 return (uint64_t)ret_conv;
15803 jboolean __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint32_t o) {
15804 LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(o & ~1);
15805 jboolean ret_val = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
15809 void __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
15810 if ((_res & 1) != 0) return;
15811 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15812 CHECK_ACCESS(_res_ptr);
15813 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
15815 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
15818 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
15819 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
15820 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
15821 return (uint64_t)ret_conv;
15823 int64_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint32_t arg) {
15824 LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
15825 int64_t ret_val = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
15829 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
15830 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
15831 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
15832 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
15833 return (uint64_t)ret_conv;
15836 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint32_t o) {
15838 o_conv.inner = (void*)(o & (~1));
15839 o_conv.is_owned = (o & 1) || (o == 0);
15840 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15841 o_conv = Invoice_clone(&o_conv);
15842 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
15843 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
15844 return (uint64_t)ret_conv;
15847 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint32_t e) {
15848 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15849 CHECK_ACCESS(e_ptr);
15850 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
15851 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uint64_t)e) & ~1));
15852 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
15853 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
15854 return (uint64_t)ret_conv;
15857 jboolean __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_is_ok(uint32_t o) {
15858 LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(o & ~1);
15859 jboolean ret_val = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
15863 void __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint32_t _res) {
15864 if ((_res & 1) != 0) return;
15865 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15866 CHECK_ACCESS(_res_ptr);
15867 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
15869 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
15872 static inline uint64_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
15873 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
15874 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
15875 return (uint64_t)ret_conv;
15877 int64_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr(uint32_t arg) {
15878 LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
15879 int64_t ret_val = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
15883 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint32_t orig) {
15884 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
15885 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
15886 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
15887 return (uint64_t)ret_conv;
15890 uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_some(uint32_t o) {
15891 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15892 CHECK_ACCESS(o_ptr);
15893 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
15894 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
15895 *ret_copy = COption_FilterZ_some(o_conv);
15896 uint64_t ret_ref = (uint64_t)ret_copy;
15900 uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_none() {
15901 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
15902 *ret_copy = COption_FilterZ_none();
15903 uint64_t ret_ref = (uint64_t)ret_copy;
15907 void __attribute__((visibility("default"))) TS_COption_FilterZ_free(uint32_t _res) {
15908 if ((_res & 1) != 0) return;
15909 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15910 CHECK_ACCESS(_res_ptr);
15911 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
15913 COption_FilterZ_free(_res_conv);
15916 uint32_t __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint32_t o) {
15917 LDKLockedChannelMonitor o_conv;
15918 o_conv.inner = (void*)(o & (~1));
15919 o_conv.is_owned = (o & 1) || (o == 0);
15920 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15921 // Warning: we need a move here but no clone is available for LDKLockedChannelMonitor
15922 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
15923 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
15924 return (uint64_t)ret_conv;
15927 uint32_t __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
15928 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
15929 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
15930 return (uint64_t)ret_conv;
15933 jboolean __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint32_t o) {
15934 LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(o & ~1);
15935 jboolean ret_val = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
15939 void __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint32_t _res) {
15940 if ((_res & 1) != 0) return;
15941 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15942 CHECK_ACCESS(_res_ptr);
15943 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
15945 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
15948 void __attribute__((visibility("default"))) TS_CVec_OutPointZ_free(uint32_tArray _res) {
15949 LDKCVec_OutPointZ _res_constr;
15950 _res_constr.datalen = *((uint32_t*)_res);
15951 if (_res_constr.datalen > 0)
15952 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
15954 _res_constr.data = NULL;
15955 uint32_t* _res_vals = (uint32_t*)(_res + 4);
15956 for (size_t k = 0; k < _res_constr.datalen; k++) {
15957 uint32_t _res_conv_10 = _res_vals[k];
15958 LDKOutPoint _res_conv_10_conv;
15959 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
15960 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
15961 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
15962 _res_constr.data[k] = _res_conv_10_conv;
15964 CVec_OutPointZ_free(_res_constr);
15967 void __attribute__((visibility("default"))) TS_PaymentPurpose_free(uint32_t this_ptr) {
15968 if ((this_ptr & 1) != 0) return;
15969 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
15970 CHECK_ACCESS(this_ptr_ptr);
15971 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
15972 FREE((void*)this_ptr);
15973 PaymentPurpose_free(this_ptr_conv);
15976 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
15977 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
15978 *ret_copy = PaymentPurpose_clone(arg);
15979 uint64_t ret_ref = (uint64_t)ret_copy;
15982 int64_t __attribute__((visibility("default"))) TS_PaymentPurpose_clone_ptr(uint32_t arg) {
15983 LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)arg;
15984 int64_t ret_val = PaymentPurpose_clone_ptr(arg_conv);
15988 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_clone(uint32_t orig) {
15989 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
15990 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
15991 *ret_copy = PaymentPurpose_clone(orig_conv);
15992 uint64_t ret_ref = (uint64_t)ret_copy;
15996 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret, int64_t user_payment_id) {
15997 LDKThirtyTwoBytes payment_preimage_ref;
15998 CHECK(*((uint32_t*)payment_preimage) == 32);
15999 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
16000 LDKThirtyTwoBytes payment_secret_ref;
16001 CHECK(*((uint32_t*)payment_secret) == 32);
16002 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
16003 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
16004 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref, user_payment_id);
16005 uint64_t ret_ref = (uint64_t)ret_copy;
16009 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
16010 LDKThirtyTwoBytes a_ref;
16011 CHECK(*((uint32_t*)a) == 32);
16012 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
16013 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
16014 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
16015 uint64_t ret_ref = (uint64_t)ret_copy;
16019 void __attribute__((visibility("default"))) TS_ClosureReason_free(uint32_t this_ptr) {
16020 if ((this_ptr & 1) != 0) return;
16021 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16022 CHECK_ACCESS(this_ptr_ptr);
16023 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
16024 FREE((void*)this_ptr);
16025 ClosureReason_free(this_ptr_conv);
16028 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
16029 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16030 *ret_copy = ClosureReason_clone(arg);
16031 uint64_t ret_ref = (uint64_t)ret_copy;
16034 int64_t __attribute__((visibility("default"))) TS_ClosureReason_clone_ptr(uint32_t arg) {
16035 LDKClosureReason* arg_conv = (LDKClosureReason*)arg;
16036 int64_t ret_val = ClosureReason_clone_ptr(arg_conv);
16040 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_clone(uint32_t orig) {
16041 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
16042 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16043 *ret_copy = ClosureReason_clone(orig_conv);
16044 uint64_t ret_ref = (uint64_t)ret_copy;
16048 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
16049 LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
16050 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16051 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
16052 uint64_t ret_ref = (uint64_t)ret_copy;
16056 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_holder_force_closed() {
16057 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16058 *ret_copy = ClosureReason_holder_force_closed();
16059 uint64_t ret_ref = (uint64_t)ret_copy;
16063 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_cooperative_closure() {
16064 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16065 *ret_copy = ClosureReason_cooperative_closure();
16066 uint64_t ret_ref = (uint64_t)ret_copy;
16070 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_commitment_tx_confirmed() {
16071 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16072 *ret_copy = ClosureReason_commitment_tx_confirmed();
16073 uint64_t ret_ref = (uint64_t)ret_copy;
16077 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_processing_error(jstring err) {
16078 LDKStr err_conv = str_ref_to_owned_c(err);
16079 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16080 *ret_copy = ClosureReason_processing_error(err_conv);
16081 uint64_t ret_ref = (uint64_t)ret_copy;
16085 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_disconnected_peer() {
16086 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16087 *ret_copy = ClosureReason_disconnected_peer();
16088 uint64_t ret_ref = (uint64_t)ret_copy;
16092 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_outdated_channel_manager() {
16093 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16094 *ret_copy = ClosureReason_outdated_channel_manager();
16095 uint64_t ret_ref = (uint64_t)ret_copy;
16099 int8_tArray __attribute__((visibility("default"))) TS_ClosureReason_write(uint32_t obj) {
16100 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
16101 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
16102 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16103 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16104 CVec_u8Z_free(ret_var);
16108 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_read(int8_tArray ser) {
16109 LDKu8slice ser_ref;
16110 ser_ref.datalen = *((uint32_t*)ser);
16111 ser_ref.data = (int8_t*)(ser + 4);
16112 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16113 *ret_conv = ClosureReason_read(ser_ref);
16114 return (uint64_t)ret_conv;
16117 void __attribute__((visibility("default"))) TS_Event_free(uint32_t this_ptr) {
16118 if ((this_ptr & 1) != 0) return;
16119 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16120 CHECK_ACCESS(this_ptr_ptr);
16121 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
16122 FREE((void*)this_ptr);
16123 Event_free(this_ptr_conv);
16126 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
16127 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16128 *ret_copy = Event_clone(arg);
16129 uint64_t ret_ref = (uint64_t)ret_copy;
16132 int64_t __attribute__((visibility("default"))) TS_Event_clone_ptr(uint32_t arg) {
16133 LDKEvent* arg_conv = (LDKEvent*)arg;
16134 int64_t ret_val = Event_clone_ptr(arg_conv);
16138 uint32_t __attribute__((visibility("default"))) TS_Event_clone(uint32_t orig) {
16139 LDKEvent* orig_conv = (LDKEvent*)orig;
16140 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16141 *ret_copy = Event_clone(orig_conv);
16142 uint64_t ret_ref = (uint64_t)ret_copy;
16146 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) {
16147 LDKThirtyTwoBytes temporary_channel_id_ref;
16148 CHECK(*((uint32_t*)temporary_channel_id) == 32);
16149 memcpy(temporary_channel_id_ref.data, (uint8_t*)(temporary_channel_id + 4), 32);
16150 LDKCVec_u8Z output_script_ref;
16151 output_script_ref.datalen = *((uint32_t*)output_script);
16152 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
16153 memcpy(output_script_ref.data, (uint8_t*)(output_script + 4), output_script_ref.datalen);
16154 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16155 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
16156 uint64_t ret_ref = (uint64_t)ret_copy;
16160 uint32_t __attribute__((visibility("default"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amt, uint32_t purpose) {
16161 LDKThirtyTwoBytes payment_hash_ref;
16162 CHECK(*((uint32_t*)payment_hash) == 32);
16163 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
16164 void* purpose_ptr = (void*)(((uint64_t)purpose) & ~1);
16165 CHECK_ACCESS(purpose_ptr);
16166 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
16167 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uint64_t)purpose) & ~1));
16168 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16169 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
16170 uint64_t ret_ref = (uint64_t)ret_copy;
16174 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) {
16175 LDKThirtyTwoBytes payment_id_ref;
16176 CHECK(*((uint32_t*)payment_id) == 32);
16177 memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32);
16178 LDKThirtyTwoBytes payment_preimage_ref;
16179 CHECK(*((uint32_t*)payment_preimage) == 32);
16180 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
16181 LDKThirtyTwoBytes payment_hash_ref;
16182 CHECK(*((uint32_t*)payment_hash) == 32);
16183 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
16184 void* fee_paid_msat_ptr = (void*)(((uint64_t)fee_paid_msat) & ~1);
16185 CHECK_ACCESS(fee_paid_msat_ptr);
16186 LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
16187 fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_paid_msat) & ~1));
16188 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16189 *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
16190 uint64_t ret_ref = (uint64_t)ret_copy;
16194 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) {
16195 LDKThirtyTwoBytes payment_id_ref;
16196 CHECK(*((uint32_t*)payment_id) == 32);
16197 memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32);
16198 LDKThirtyTwoBytes payment_hash_ref;
16199 CHECK(*((uint32_t*)payment_hash) == 32);
16200 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
16201 void* network_update_ptr = (void*)(((uint64_t)network_update) & ~1);
16202 CHECK_ACCESS(network_update_ptr);
16203 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
16204 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1));
16205 LDKCVec_RouteHopZ path_constr;
16206 path_constr.datalen = *((uint32_t*)path);
16207 if (path_constr.datalen > 0)
16208 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
16210 path_constr.data = NULL;
16211 uint32_t* path_vals = (uint32_t*)(path + 4);
16212 for (size_t k = 0; k < path_constr.datalen; k++) {
16213 uint32_t path_conv_10 = path_vals[k];
16214 LDKRouteHop path_conv_10_conv;
16215 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
16216 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
16217 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
16218 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
16219 path_constr.data[k] = path_conv_10_conv;
16221 void* short_channel_id_ptr = (void*)(((uint64_t)short_channel_id) & ~1);
16222 CHECK_ACCESS(short_channel_id_ptr);
16223 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
16224 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id) & ~1));
16225 LDKRouteParameters retry_conv;
16226 retry_conv.inner = (void*)(retry & (~1));
16227 retry_conv.is_owned = (retry & 1) || (retry == 0);
16228 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
16229 retry_conv = RouteParameters_clone(&retry_conv);
16230 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16231 *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);
16232 uint64_t ret_ref = (uint64_t)ret_copy;
16236 uint32_t __attribute__((visibility("default"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
16237 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16238 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
16239 uint64_t ret_ref = (uint64_t)ret_copy;
16243 uint32_t __attribute__((visibility("default"))) TS_Event_spendable_outputs(uint32_tArray outputs) {
16244 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
16245 outputs_constr.datalen = *((uint32_t*)outputs);
16246 if (outputs_constr.datalen > 0)
16247 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
16249 outputs_constr.data = NULL;
16250 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
16251 for (size_t b = 0; b < outputs_constr.datalen; b++) {
16252 uint32_t outputs_conv_27 = outputs_vals[b];
16253 void* outputs_conv_27_ptr = (void*)(((uint64_t)outputs_conv_27) & ~1);
16254 CHECK_ACCESS(outputs_conv_27_ptr);
16255 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
16256 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1));
16257 outputs_constr.data[b] = outputs_conv_27_conv;
16259 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16260 *ret_copy = Event_spendable_outputs(outputs_constr);
16261 uint64_t ret_ref = (uint64_t)ret_copy;
16265 uint32_t __attribute__((visibility("default"))) TS_Event_payment_forwarded(uint32_t fee_earned_msat, jboolean claim_from_onchain_tx) {
16266 void* fee_earned_msat_ptr = (void*)(((uint64_t)fee_earned_msat) & ~1);
16267 CHECK_ACCESS(fee_earned_msat_ptr);
16268 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
16269 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1));
16270 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16271 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
16272 uint64_t ret_ref = (uint64_t)ret_copy;
16276 uint32_t __attribute__((visibility("default"))) TS_Event_channel_closed(int8_tArray channel_id, int64_t user_channel_id, uint32_t reason) {
16277 LDKThirtyTwoBytes channel_id_ref;
16278 CHECK(*((uint32_t*)channel_id) == 32);
16279 memcpy(channel_id_ref.data, (uint8_t*)(channel_id + 4), 32);
16280 void* reason_ptr = (void*)(((uint64_t)reason) & ~1);
16281 CHECK_ACCESS(reason_ptr);
16282 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
16283 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1));
16284 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16285 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
16286 uint64_t ret_ref = (uint64_t)ret_copy;
16290 uint32_t __attribute__((visibility("default"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
16291 LDKThirtyTwoBytes channel_id_ref;
16292 CHECK(*((uint32_t*)channel_id) == 32);
16293 memcpy(channel_id_ref.data, (uint8_t*)(channel_id + 4), 32);
16294 LDKTransaction transaction_ref;
16295 transaction_ref.datalen = *((uint32_t*)transaction);
16296 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
16297 memcpy(transaction_ref.data, (uint8_t*)(transaction + 4), transaction_ref.datalen);
16298 transaction_ref.data_is_owned = true;
16299 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16300 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
16301 uint64_t ret_ref = (uint64_t)ret_copy;
16305 int8_tArray __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) {
16306 LDKEvent* obj_conv = (LDKEvent*)obj;
16307 LDKCVec_u8Z ret_var = Event_write(obj_conv);
16308 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16309 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16310 CVec_u8Z_free(ret_var);
16314 uint32_t __attribute__((visibility("default"))) TS_Event_read(int8_tArray ser) {
16315 LDKu8slice ser_ref;
16316 ser_ref.datalen = *((uint32_t*)ser);
16317 ser_ref.data = (int8_t*)(ser + 4);
16318 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16319 *ret_conv = Event_read(ser_ref);
16320 return (uint64_t)ret_conv;
16323 void __attribute__((visibility("default"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
16324 if ((this_ptr & 1) != 0) return;
16325 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16326 CHECK_ACCESS(this_ptr_ptr);
16327 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
16328 FREE((void*)this_ptr);
16329 MessageSendEvent_free(this_ptr_conv);
16332 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
16333 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16334 *ret_copy = MessageSendEvent_clone(arg);
16335 uint64_t ret_ref = (uint64_t)ret_copy;
16338 int64_t __attribute__((visibility("default"))) TS_MessageSendEvent_clone_ptr(uint32_t arg) {
16339 LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)arg;
16340 int64_t ret_val = MessageSendEvent_clone_ptr(arg_conv);
16344 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_clone(uint32_t orig) {
16345 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
16346 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16347 *ret_copy = MessageSendEvent_clone(orig_conv);
16348 uint64_t ret_ref = (uint64_t)ret_copy;
16352 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint32_t msg) {
16353 LDKPublicKey node_id_ref;
16354 CHECK(*((uint32_t*)node_id) == 33);
16355 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16356 LDKAcceptChannel msg_conv;
16357 msg_conv.inner = (void*)(msg & (~1));
16358 msg_conv.is_owned = (msg & 1) || (msg == 0);
16359 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16360 msg_conv = AcceptChannel_clone(&msg_conv);
16361 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16362 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
16363 uint64_t ret_ref = (uint64_t)ret_copy;
16367 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint32_t msg) {
16368 LDKPublicKey node_id_ref;
16369 CHECK(*((uint32_t*)node_id) == 33);
16370 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16371 LDKOpenChannel msg_conv;
16372 msg_conv.inner = (void*)(msg & (~1));
16373 msg_conv.is_owned = (msg & 1) || (msg == 0);
16374 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16375 msg_conv = OpenChannel_clone(&msg_conv);
16376 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16377 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
16378 uint64_t ret_ref = (uint64_t)ret_copy;
16382 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint32_t msg) {
16383 LDKPublicKey node_id_ref;
16384 CHECK(*((uint32_t*)node_id) == 33);
16385 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16386 LDKFundingCreated msg_conv;
16387 msg_conv.inner = (void*)(msg & (~1));
16388 msg_conv.is_owned = (msg & 1) || (msg == 0);
16389 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16390 msg_conv = FundingCreated_clone(&msg_conv);
16391 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16392 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
16393 uint64_t ret_ref = (uint64_t)ret_copy;
16397 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint32_t msg) {
16398 LDKPublicKey node_id_ref;
16399 CHECK(*((uint32_t*)node_id) == 33);
16400 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16401 LDKFundingSigned msg_conv;
16402 msg_conv.inner = (void*)(msg & (~1));
16403 msg_conv.is_owned = (msg & 1) || (msg == 0);
16404 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16405 msg_conv = FundingSigned_clone(&msg_conv);
16406 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16407 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
16408 uint64_t ret_ref = (uint64_t)ret_copy;
16412 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_locked(int8_tArray node_id, uint32_t msg) {
16413 LDKPublicKey node_id_ref;
16414 CHECK(*((uint32_t*)node_id) == 33);
16415 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16416 LDKFundingLocked msg_conv;
16417 msg_conv.inner = (void*)(msg & (~1));
16418 msg_conv.is_owned = (msg & 1) || (msg == 0);
16419 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16420 msg_conv = FundingLocked_clone(&msg_conv);
16421 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16422 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
16423 uint64_t ret_ref = (uint64_t)ret_copy;
16427 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint32_t msg) {
16428 LDKPublicKey node_id_ref;
16429 CHECK(*((uint32_t*)node_id) == 33);
16430 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16431 LDKAnnouncementSignatures msg_conv;
16432 msg_conv.inner = (void*)(msg & (~1));
16433 msg_conv.is_owned = (msg & 1) || (msg == 0);
16434 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16435 msg_conv = AnnouncementSignatures_clone(&msg_conv);
16436 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16437 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
16438 uint64_t ret_ref = (uint64_t)ret_copy;
16442 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint32_t updates) {
16443 LDKPublicKey node_id_ref;
16444 CHECK(*((uint32_t*)node_id) == 33);
16445 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16446 LDKCommitmentUpdate updates_conv;
16447 updates_conv.inner = (void*)(updates & (~1));
16448 updates_conv.is_owned = (updates & 1) || (updates == 0);
16449 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
16450 updates_conv = CommitmentUpdate_clone(&updates_conv);
16451 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16452 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
16453 uint64_t ret_ref = (uint64_t)ret_copy;
16457 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint32_t msg) {
16458 LDKPublicKey node_id_ref;
16459 CHECK(*((uint32_t*)node_id) == 33);
16460 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16461 LDKRevokeAndACK msg_conv;
16462 msg_conv.inner = (void*)(msg & (~1));
16463 msg_conv.is_owned = (msg & 1) || (msg == 0);
16464 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16465 msg_conv = RevokeAndACK_clone(&msg_conv);
16466 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16467 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
16468 uint64_t ret_ref = (uint64_t)ret_copy;
16472 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint32_t msg) {
16473 LDKPublicKey node_id_ref;
16474 CHECK(*((uint32_t*)node_id) == 33);
16475 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16476 LDKClosingSigned msg_conv;
16477 msg_conv.inner = (void*)(msg & (~1));
16478 msg_conv.is_owned = (msg & 1) || (msg == 0);
16479 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16480 msg_conv = ClosingSigned_clone(&msg_conv);
16481 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16482 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
16483 uint64_t ret_ref = (uint64_t)ret_copy;
16487 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint32_t msg) {
16488 LDKPublicKey node_id_ref;
16489 CHECK(*((uint32_t*)node_id) == 33);
16490 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16491 LDKShutdown msg_conv;
16492 msg_conv.inner = (void*)(msg & (~1));
16493 msg_conv.is_owned = (msg & 1) || (msg == 0);
16494 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16495 msg_conv = Shutdown_clone(&msg_conv);
16496 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16497 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
16498 uint64_t ret_ref = (uint64_t)ret_copy;
16502 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint32_t msg) {
16503 LDKPublicKey node_id_ref;
16504 CHECK(*((uint32_t*)node_id) == 33);
16505 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16506 LDKChannelReestablish msg_conv;
16507 msg_conv.inner = (void*)(msg & (~1));
16508 msg_conv.is_owned = (msg & 1) || (msg == 0);
16509 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16510 msg_conv = ChannelReestablish_clone(&msg_conv);
16511 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16512 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
16513 uint64_t ret_ref = (uint64_t)ret_copy;
16517 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_announcement(uint32_t msg, uint32_t update_msg) {
16518 LDKChannelAnnouncement msg_conv;
16519 msg_conv.inner = (void*)(msg & (~1));
16520 msg_conv.is_owned = (msg & 1) || (msg == 0);
16521 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16522 msg_conv = ChannelAnnouncement_clone(&msg_conv);
16523 LDKChannelUpdate update_msg_conv;
16524 update_msg_conv.inner = (void*)(update_msg & (~1));
16525 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
16526 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
16527 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
16528 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16529 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
16530 uint64_t ret_ref = (uint64_t)ret_copy;
16534 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_node_announcement(uint32_t msg) {
16535 LDKNodeAnnouncement msg_conv;
16536 msg_conv.inner = (void*)(msg & (~1));
16537 msg_conv.is_owned = (msg & 1) || (msg == 0);
16538 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16539 msg_conv = NodeAnnouncement_clone(&msg_conv);
16540 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16541 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
16542 uint64_t ret_ref = (uint64_t)ret_copy;
16546 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_update(uint32_t msg) {
16547 LDKChannelUpdate msg_conv;
16548 msg_conv.inner = (void*)(msg & (~1));
16549 msg_conv.is_owned = (msg & 1) || (msg == 0);
16550 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16551 msg_conv = ChannelUpdate_clone(&msg_conv);
16552 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16553 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
16554 uint64_t ret_ref = (uint64_t)ret_copy;
16558 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint32_t msg) {
16559 LDKPublicKey node_id_ref;
16560 CHECK(*((uint32_t*)node_id) == 33);
16561 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16562 LDKChannelUpdate msg_conv;
16563 msg_conv.inner = (void*)(msg & (~1));
16564 msg_conv.is_owned = (msg & 1) || (msg == 0);
16565 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16566 msg_conv = ChannelUpdate_clone(&msg_conv);
16567 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16568 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
16569 uint64_t ret_ref = (uint64_t)ret_copy;
16573 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint32_t action) {
16574 LDKPublicKey node_id_ref;
16575 CHECK(*((uint32_t*)node_id) == 33);
16576 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16577 void* action_ptr = (void*)(((uint64_t)action) & ~1);
16578 CHECK_ACCESS(action_ptr);
16579 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
16580 action_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action) & ~1));
16581 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16582 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
16583 uint64_t ret_ref = (uint64_t)ret_copy;
16587 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint32_t msg) {
16588 LDKPublicKey node_id_ref;
16589 CHECK(*((uint32_t*)node_id) == 33);
16590 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16591 LDKQueryChannelRange msg_conv;
16592 msg_conv.inner = (void*)(msg & (~1));
16593 msg_conv.is_owned = (msg & 1) || (msg == 0);
16594 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16595 msg_conv = QueryChannelRange_clone(&msg_conv);
16596 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16597 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
16598 uint64_t ret_ref = (uint64_t)ret_copy;
16602 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint32_t msg) {
16603 LDKPublicKey node_id_ref;
16604 CHECK(*((uint32_t*)node_id) == 33);
16605 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16606 LDKQueryShortChannelIds msg_conv;
16607 msg_conv.inner = (void*)(msg & (~1));
16608 msg_conv.is_owned = (msg & 1) || (msg == 0);
16609 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16610 msg_conv = QueryShortChannelIds_clone(&msg_conv);
16611 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16612 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
16613 uint64_t ret_ref = (uint64_t)ret_copy;
16617 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint32_t msg) {
16618 LDKPublicKey node_id_ref;
16619 CHECK(*((uint32_t*)node_id) == 33);
16620 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16621 LDKReplyChannelRange msg_conv;
16622 msg_conv.inner = (void*)(msg & (~1));
16623 msg_conv.is_owned = (msg & 1) || (msg == 0);
16624 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16625 msg_conv = ReplyChannelRange_clone(&msg_conv);
16626 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16627 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
16628 uint64_t ret_ref = (uint64_t)ret_copy;
16632 void __attribute__((visibility("default"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
16633 if ((this_ptr & 1) != 0) return;
16634 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16635 CHECK_ACCESS(this_ptr_ptr);
16636 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
16637 FREE((void*)this_ptr);
16638 MessageSendEventsProvider_free(this_ptr_conv);
16641 void __attribute__((visibility("default"))) TS_EventsProvider_free(uint32_t this_ptr) {
16642 if ((this_ptr & 1) != 0) return;
16643 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16644 CHECK_ACCESS(this_ptr_ptr);
16645 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
16646 FREE((void*)this_ptr);
16647 EventsProvider_free(this_ptr_conv);
16650 void __attribute__((visibility("default"))) TS_EventHandler_free(uint32_t this_ptr) {
16651 if ((this_ptr & 1) != 0) return;
16652 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16653 CHECK_ACCESS(this_ptr_ptr);
16654 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
16655 FREE((void*)this_ptr);
16656 EventHandler_free(this_ptr_conv);
16659 void __attribute__((visibility("default"))) TS_APIError_free(uint32_t this_ptr) {
16660 if ((this_ptr & 1) != 0) return;
16661 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16662 CHECK_ACCESS(this_ptr_ptr);
16663 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
16664 FREE((void*)this_ptr);
16665 APIError_free(this_ptr_conv);
16668 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
16669 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16670 *ret_copy = APIError_clone(arg);
16671 uint64_t ret_ref = (uint64_t)ret_copy;
16674 int64_t __attribute__((visibility("default"))) TS_APIError_clone_ptr(uint32_t arg) {
16675 LDKAPIError* arg_conv = (LDKAPIError*)arg;
16676 int64_t ret_val = APIError_clone_ptr(arg_conv);
16680 uint32_t __attribute__((visibility("default"))) TS_APIError_clone(uint32_t orig) {
16681 LDKAPIError* orig_conv = (LDKAPIError*)orig;
16682 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16683 *ret_copy = APIError_clone(orig_conv);
16684 uint64_t ret_ref = (uint64_t)ret_copy;
16688 uint32_t __attribute__((visibility("default"))) TS_APIError_apimisuse_error(jstring err) {
16689 LDKStr err_conv = str_ref_to_owned_c(err);
16690 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16691 *ret_copy = APIError_apimisuse_error(err_conv);
16692 uint64_t ret_ref = (uint64_t)ret_copy;
16696 uint32_t __attribute__((visibility("default"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
16697 LDKStr err_conv = str_ref_to_owned_c(err);
16698 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16699 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
16700 uint64_t ret_ref = (uint64_t)ret_copy;
16704 uint32_t __attribute__((visibility("default"))) TS_APIError_route_error(jstring err) {
16705 LDKStr err_conv = str_ref_to_owned_c(err);
16706 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16707 *ret_copy = APIError_route_error(err_conv);
16708 uint64_t ret_ref = (uint64_t)ret_copy;
16712 uint32_t __attribute__((visibility("default"))) TS_APIError_channel_unavailable(jstring err) {
16713 LDKStr err_conv = str_ref_to_owned_c(err);
16714 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16715 *ret_copy = APIError_channel_unavailable(err_conv);
16716 uint64_t ret_ref = (uint64_t)ret_copy;
16720 uint32_t __attribute__((visibility("default"))) TS_APIError_monitor_update_failed() {
16721 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16722 *ret_copy = APIError_monitor_update_failed();
16723 uint64_t ret_ref = (uint64_t)ret_copy;
16727 uint32_t __attribute__((visibility("default"))) TS_APIError_incompatible_shutdown_script(uint32_t script) {
16728 LDKShutdownScript script_conv;
16729 script_conv.inner = (void*)(script & (~1));
16730 script_conv.is_owned = (script & 1) || (script == 0);
16731 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
16732 script_conv = ShutdownScript_clone(&script_conv);
16733 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16734 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
16735 uint64_t ret_ref = (uint64_t)ret_copy;
16739 uint32_t __attribute__((visibility("default"))) TS_sign(int8_tArray msg, int8_tArray sk) {
16740 LDKu8slice msg_ref;
16741 msg_ref.datalen = *((uint32_t*)msg);
16742 msg_ref.data = (int8_t*)(msg + 4);
16743 unsigned char sk_arr[32];
16744 CHECK(*((uint32_t*)sk) == 32);
16745 memcpy(sk_arr, (uint8_t*)(sk + 4), 32);
16746 unsigned char (*sk_ref)[32] = &sk_arr;
16747 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16748 *ret_conv = sign(msg_ref, sk_ref);
16749 return (uint64_t)ret_conv;
16752 uint32_t __attribute__((visibility("default"))) TS_recover_pk(int8_tArray msg, jstring sig) {
16753 LDKu8slice msg_ref;
16754 msg_ref.datalen = *((uint32_t*)msg);
16755 msg_ref.data = (int8_t*)(msg + 4);
16756 LDKStr sig_conv = str_ref_to_owned_c(sig);
16757 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
16758 *ret_conv = recover_pk(msg_ref, sig_conv);
16759 return (uint64_t)ret_conv;
16762 jboolean __attribute__((visibility("default"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
16763 LDKu8slice msg_ref;
16764 msg_ref.datalen = *((uint32_t*)msg);
16765 msg_ref.data = (int8_t*)(msg + 4);
16766 LDKStr sig_conv = str_ref_to_owned_c(sig);
16767 LDKPublicKey pk_ref;
16768 CHECK(*((uint32_t*)pk) == 33);
16769 memcpy(pk_ref.compressed_form, (uint8_t*)(pk + 4), 33);
16770 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
16774 uint32_t __attribute__((visibility("default"))) TS_Level_clone(uint32_t orig) {
16775 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
16776 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
16780 uint32_t __attribute__((visibility("default"))) TS_Level_trace() {
16781 uint32_t ret_conv = LDKLevel_to_js(Level_trace());
16785 uint32_t __attribute__((visibility("default"))) TS_Level_debug() {
16786 uint32_t ret_conv = LDKLevel_to_js(Level_debug());
16790 uint32_t __attribute__((visibility("default"))) TS_Level_info() {
16791 uint32_t ret_conv = LDKLevel_to_js(Level_info());
16795 uint32_t __attribute__((visibility("default"))) TS_Level_warn() {
16796 uint32_t ret_conv = LDKLevel_to_js(Level_warn());
16800 uint32_t __attribute__((visibility("default"))) TS_Level_error() {
16801 uint32_t ret_conv = LDKLevel_to_js(Level_error());
16805 jboolean __attribute__((visibility("default"))) TS_Level_eq(uint32_t a, uint32_t b) {
16806 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
16807 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
16808 jboolean ret_val = Level_eq(a_conv, b_conv);
16812 int64_t __attribute__((visibility("default"))) TS_Level_hash(uint32_t o) {
16813 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
16814 int64_t ret_val = Level_hash(o_conv);
16818 uint32_t __attribute__((visibility("default"))) TS_Level_max() {
16819 uint32_t ret_conv = LDKLevel_to_js(Level_max());
16823 void __attribute__((visibility("default"))) TS_Record_free(uint32_t this_obj) {
16824 LDKRecord this_obj_conv;
16825 this_obj_conv.inner = (void*)(this_obj & (~1));
16826 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16827 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
16828 Record_free(this_obj_conv);
16831 uint32_t __attribute__((visibility("default"))) TS_Record_get_level(uint32_t this_ptr) {
16832 LDKRecord this_ptr_conv;
16833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16834 this_ptr_conv.is_owned = false;
16835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16836 uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
16840 void __attribute__((visibility("default"))) TS_Record_set_level(uint32_t this_ptr, uint32_t val) {
16841 LDKRecord this_ptr_conv;
16842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16843 this_ptr_conv.is_owned = false;
16844 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16845 LDKLevel val_conv = LDKLevel_from_js(val);
16846 Record_set_level(&this_ptr_conv, val_conv);
16849 jstring __attribute__((visibility("default"))) TS_Record_get_args(uint32_t this_ptr) {
16850 LDKRecord this_ptr_conv;
16851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16852 this_ptr_conv.is_owned = false;
16853 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16854 LDKStr ret_str = Record_get_args(&this_ptr_conv);
16855 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
16860 void __attribute__((visibility("default"))) TS_Record_set_args(uint32_t this_ptr, jstring val) {
16861 LDKRecord this_ptr_conv;
16862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16863 this_ptr_conv.is_owned = false;
16864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16865 LDKStr val_conv = str_ref_to_owned_c(val);
16866 Record_set_args(&this_ptr_conv, val_conv);
16869 jstring __attribute__((visibility("default"))) TS_Record_get_module_path(uint32_t this_ptr) {
16870 LDKRecord this_ptr_conv;
16871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16872 this_ptr_conv.is_owned = false;
16873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16874 LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
16875 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
16880 void __attribute__((visibility("default"))) TS_Record_set_module_path(uint32_t this_ptr, jstring val) {
16881 LDKRecord this_ptr_conv;
16882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16883 this_ptr_conv.is_owned = false;
16884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16885 LDKStr val_conv = str_ref_to_owned_c(val);
16886 Record_set_module_path(&this_ptr_conv, val_conv);
16889 jstring __attribute__((visibility("default"))) TS_Record_get_file(uint32_t this_ptr) {
16890 LDKRecord this_ptr_conv;
16891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16892 this_ptr_conv.is_owned = false;
16893 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16894 LDKStr ret_str = Record_get_file(&this_ptr_conv);
16895 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
16900 void __attribute__((visibility("default"))) TS_Record_set_file(uint32_t this_ptr, jstring val) {
16901 LDKRecord this_ptr_conv;
16902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16903 this_ptr_conv.is_owned = false;
16904 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16905 LDKStr val_conv = str_ref_to_owned_c(val);
16906 Record_set_file(&this_ptr_conv, val_conv);
16909 int32_t __attribute__((visibility("default"))) TS_Record_get_line(uint32_t this_ptr) {
16910 LDKRecord this_ptr_conv;
16911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16912 this_ptr_conv.is_owned = false;
16913 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16914 int32_t ret_val = Record_get_line(&this_ptr_conv);
16918 void __attribute__((visibility("default"))) TS_Record_set_line(uint32_t this_ptr, int32_t val) {
16919 LDKRecord this_ptr_conv;
16920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16921 this_ptr_conv.is_owned = false;
16922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16923 Record_set_line(&this_ptr_conv, val);
16926 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
16927 LDKRecord ret_var = Record_clone(arg);
16928 uint64_t ret_ref = 0;
16929 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16930 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16931 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16932 ret_ref = (uint64_t)ret_var.inner;
16933 if (ret_var.is_owned) {
16938 int64_t __attribute__((visibility("default"))) TS_Record_clone_ptr(uint32_t arg) {
16939 LDKRecord arg_conv;
16940 arg_conv.inner = (void*)(arg & (~1));
16941 arg_conv.is_owned = false;
16942 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
16943 int64_t ret_val = Record_clone_ptr(&arg_conv);
16947 uint32_t __attribute__((visibility("default"))) TS_Record_clone(uint32_t orig) {
16948 LDKRecord orig_conv;
16949 orig_conv.inner = (void*)(orig & (~1));
16950 orig_conv.is_owned = false;
16951 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
16952 LDKRecord ret_var = Record_clone(&orig_conv);
16953 uint64_t ret_ref = 0;
16954 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16955 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16956 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16957 ret_ref = (uint64_t)ret_var.inner;
16958 if (ret_var.is_owned) {
16964 void __attribute__((visibility("default"))) TS_Logger_free(uint32_t this_ptr) {
16965 if ((this_ptr & 1) != 0) return;
16966 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16967 CHECK_ACCESS(this_ptr_ptr);
16968 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
16969 FREE((void*)this_ptr);
16970 Logger_free(this_ptr_conv);
16973 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_free(uint32_t this_obj) {
16974 LDKChannelHandshakeConfig this_obj_conv;
16975 this_obj_conv.inner = (void*)(this_obj & (~1));
16976 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
16978 ChannelHandshakeConfig_free(this_obj_conv);
16981 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
16982 LDKChannelHandshakeConfig this_ptr_conv;
16983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16984 this_ptr_conv.is_owned = false;
16985 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16986 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
16990 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
16991 LDKChannelHandshakeConfig this_ptr_conv;
16992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16993 this_ptr_conv.is_owned = false;
16994 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16995 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
16998 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
16999 LDKChannelHandshakeConfig this_ptr_conv;
17000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17001 this_ptr_conv.is_owned = false;
17002 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17003 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
17007 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_to_self_delay(uint32_t this_ptr, int16_t val) {
17008 LDKChannelHandshakeConfig this_ptr_conv;
17009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17010 this_ptr_conv.is_owned = false;
17011 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17012 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
17015 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
17016 LDKChannelHandshakeConfig this_ptr_conv;
17017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17018 this_ptr_conv.is_owned = false;
17019 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17020 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
17024 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
17025 LDKChannelHandshakeConfig this_ptr_conv;
17026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17027 this_ptr_conv.is_owned = false;
17028 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17029 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
17032 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) {
17033 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
17034 uint64_t ret_ref = 0;
17035 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17036 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17037 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17038 ret_ref = (uint64_t)ret_var.inner;
17039 if (ret_var.is_owned) {
17045 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
17046 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
17047 uint64_t ret_ref = 0;
17048 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17049 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17050 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17051 ret_ref = (uint64_t)ret_var.inner;
17052 if (ret_var.is_owned) {
17057 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_clone_ptr(uint32_t arg) {
17058 LDKChannelHandshakeConfig arg_conv;
17059 arg_conv.inner = (void*)(arg & (~1));
17060 arg_conv.is_owned = false;
17061 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17062 int64_t ret_val = ChannelHandshakeConfig_clone_ptr(&arg_conv);
17066 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
17067 LDKChannelHandshakeConfig orig_conv;
17068 orig_conv.inner = (void*)(orig & (~1));
17069 orig_conv.is_owned = false;
17070 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17071 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
17072 uint64_t ret_ref = 0;
17073 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17074 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17075 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17076 ret_ref = (uint64_t)ret_var.inner;
17077 if (ret_var.is_owned) {
17083 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_default() {
17084 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
17085 uint64_t ret_ref = 0;
17086 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17087 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17088 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17089 ret_ref = (uint64_t)ret_var.inner;
17090 if (ret_var.is_owned) {
17096 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_free(uint32_t this_obj) {
17097 LDKChannelHandshakeLimits this_obj_conv;
17098 this_obj_conv.inner = (void*)(this_obj & (~1));
17099 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17100 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17101 ChannelHandshakeLimits_free(this_obj_conv);
17104 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
17105 LDKChannelHandshakeLimits this_ptr_conv;
17106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17107 this_ptr_conv.is_owned = false;
17108 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17109 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
17113 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
17114 LDKChannelHandshakeLimits this_ptr_conv;
17115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17116 this_ptr_conv.is_owned = false;
17117 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17118 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
17121 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
17122 LDKChannelHandshakeLimits this_ptr_conv;
17123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17124 this_ptr_conv.is_owned = false;
17125 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17126 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
17130 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
17131 LDKChannelHandshakeLimits this_ptr_conv;
17132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17133 this_ptr_conv.is_owned = false;
17134 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17135 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
17138 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
17139 LDKChannelHandshakeLimits this_ptr_conv;
17140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17141 this_ptr_conv.is_owned = false;
17142 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17143 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
17147 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
17148 LDKChannelHandshakeLimits this_ptr_conv;
17149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17150 this_ptr_conv.is_owned = false;
17151 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17152 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
17155 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
17156 LDKChannelHandshakeLimits this_ptr_conv;
17157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17158 this_ptr_conv.is_owned = false;
17159 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17160 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
17164 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
17165 LDKChannelHandshakeLimits this_ptr_conv;
17166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17167 this_ptr_conv.is_owned = false;
17168 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17169 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
17172 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
17173 LDKChannelHandshakeLimits this_ptr_conv;
17174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17175 this_ptr_conv.is_owned = false;
17176 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17177 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
17181 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
17182 LDKChannelHandshakeLimits this_ptr_conv;
17183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17184 this_ptr_conv.is_owned = false;
17185 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17186 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
17189 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
17190 LDKChannelHandshakeLimits this_ptr_conv;
17191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17192 this_ptr_conv.is_owned = false;
17193 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17194 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
17198 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
17199 LDKChannelHandshakeLimits this_ptr_conv;
17200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17201 this_ptr_conv.is_owned = false;
17202 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17203 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
17206 jboolean __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
17207 LDKChannelHandshakeLimits this_ptr_conv;
17208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17209 this_ptr_conv.is_owned = false;
17210 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17211 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
17215 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
17216 LDKChannelHandshakeLimits this_ptr_conv;
17217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17218 this_ptr_conv.is_owned = false;
17219 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17220 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
17223 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
17224 LDKChannelHandshakeLimits this_ptr_conv;
17225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17226 this_ptr_conv.is_owned = false;
17227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17228 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
17232 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_their_to_self_delay(uint32_t this_ptr, int16_t val) {
17233 LDKChannelHandshakeLimits this_ptr_conv;
17234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17235 this_ptr_conv.is_owned = false;
17236 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17237 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
17240 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) {
17241 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);
17242 uint64_t ret_ref = 0;
17243 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17244 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17245 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17246 ret_ref = (uint64_t)ret_var.inner;
17247 if (ret_var.is_owned) {
17253 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
17254 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
17255 uint64_t ret_ref = 0;
17256 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17257 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17258 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17259 ret_ref = (uint64_t)ret_var.inner;
17260 if (ret_var.is_owned) {
17265 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_clone_ptr(uint32_t arg) {
17266 LDKChannelHandshakeLimits arg_conv;
17267 arg_conv.inner = (void*)(arg & (~1));
17268 arg_conv.is_owned = false;
17269 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17270 int64_t ret_val = ChannelHandshakeLimits_clone_ptr(&arg_conv);
17274 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
17275 LDKChannelHandshakeLimits orig_conv;
17276 orig_conv.inner = (void*)(orig & (~1));
17277 orig_conv.is_owned = false;
17278 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17279 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
17280 uint64_t ret_ref = 0;
17281 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17282 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17283 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17284 ret_ref = (uint64_t)ret_var.inner;
17285 if (ret_var.is_owned) {
17291 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_default() {
17292 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
17293 uint64_t ret_ref = 0;
17294 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17295 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17296 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17297 ret_ref = (uint64_t)ret_var.inner;
17298 if (ret_var.is_owned) {
17304 void __attribute__((visibility("default"))) TS_ChannelConfig_free(uint32_t this_obj) {
17305 LDKChannelConfig this_obj_conv;
17306 this_obj_conv.inner = (void*)(this_obj & (~1));
17307 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17308 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17309 ChannelConfig_free(this_obj_conv);
17312 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint32_t this_ptr) {
17313 LDKChannelConfig this_ptr_conv;
17314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17315 this_ptr_conv.is_owned = false;
17316 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17317 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
17321 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
17322 LDKChannelConfig this_ptr_conv;
17323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17324 this_ptr_conv.is_owned = false;
17325 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17326 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
17329 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint32_t this_ptr) {
17330 LDKChannelConfig this_ptr_conv;
17331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17332 this_ptr_conv.is_owned = false;
17333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17334 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
17338 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_base_msat(uint32_t this_ptr, int32_t val) {
17339 LDKChannelConfig this_ptr_conv;
17340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17341 this_ptr_conv.is_owned = false;
17342 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17343 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
17346 int16_t __attribute__((visibility("default"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) {
17347 LDKChannelConfig this_ptr_conv;
17348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17349 this_ptr_conv.is_owned = false;
17350 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17351 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
17355 void __attribute__((visibility("default"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
17356 LDKChannelConfig this_ptr_conv;
17357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17358 this_ptr_conv.is_owned = false;
17359 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17360 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
17363 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
17364 LDKChannelConfig this_ptr_conv;
17365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17366 this_ptr_conv.is_owned = false;
17367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17368 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
17372 void __attribute__((visibility("default"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
17373 LDKChannelConfig this_ptr_conv;
17374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17375 this_ptr_conv.is_owned = false;
17376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17377 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
17380 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
17381 LDKChannelConfig this_ptr_conv;
17382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17383 this_ptr_conv.is_owned = false;
17384 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17385 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
17389 void __attribute__((visibility("default"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
17390 LDKChannelConfig this_ptr_conv;
17391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17392 this_ptr_conv.is_owned = false;
17393 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17394 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
17397 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_get_max_dust_htlc_exposure_msat(uint32_t this_ptr) {
17398 LDKChannelConfig this_ptr_conv;
17399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17400 this_ptr_conv.is_owned = false;
17401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17402 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
17406 void __attribute__((visibility("default"))) TS_ChannelConfig_set_max_dust_htlc_exposure_msat(uint32_t this_ptr, int64_t val) {
17407 LDKChannelConfig this_ptr_conv;
17408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17409 this_ptr_conv.is_owned = false;
17410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17411 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
17414 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_get_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr) {
17415 LDKChannelConfig this_ptr_conv;
17416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17417 this_ptr_conv.is_owned = false;
17418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17419 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
17423 void __attribute__((visibility("default"))) TS_ChannelConfig_set_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
17424 LDKChannelConfig this_ptr_conv;
17425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17426 this_ptr_conv.is_owned = false;
17427 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17428 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
17431 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) {
17432 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);
17433 uint64_t ret_ref = 0;
17434 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17435 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17436 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17437 ret_ref = (uint64_t)ret_var.inner;
17438 if (ret_var.is_owned) {
17444 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
17445 LDKChannelConfig ret_var = ChannelConfig_clone(arg);
17446 uint64_t ret_ref = 0;
17447 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17448 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17449 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17450 ret_ref = (uint64_t)ret_var.inner;
17451 if (ret_var.is_owned) {
17456 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_clone_ptr(uint32_t arg) {
17457 LDKChannelConfig arg_conv;
17458 arg_conv.inner = (void*)(arg & (~1));
17459 arg_conv.is_owned = false;
17460 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17461 int64_t ret_val = ChannelConfig_clone_ptr(&arg_conv);
17465 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_clone(uint32_t orig) {
17466 LDKChannelConfig orig_conv;
17467 orig_conv.inner = (void*)(orig & (~1));
17468 orig_conv.is_owned = false;
17469 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17470 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
17471 uint64_t ret_ref = 0;
17472 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17473 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17474 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17475 ret_ref = (uint64_t)ret_var.inner;
17476 if (ret_var.is_owned) {
17482 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_default() {
17483 LDKChannelConfig ret_var = ChannelConfig_default();
17484 uint64_t ret_ref = 0;
17485 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17486 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17487 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17488 ret_ref = (uint64_t)ret_var.inner;
17489 if (ret_var.is_owned) {
17495 int8_tArray __attribute__((visibility("default"))) TS_ChannelConfig_write(uint32_t obj) {
17496 LDKChannelConfig obj_conv;
17497 obj_conv.inner = (void*)(obj & (~1));
17498 obj_conv.is_owned = false;
17499 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
17500 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
17501 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17502 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17503 CVec_u8Z_free(ret_var);
17507 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_read(int8_tArray ser) {
17508 LDKu8slice ser_ref;
17509 ser_ref.datalen = *((uint32_t*)ser);
17510 ser_ref.data = (int8_t*)(ser + 4);
17511 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
17512 *ret_conv = ChannelConfig_read(ser_ref);
17513 return (uint64_t)ret_conv;
17516 void __attribute__((visibility("default"))) TS_UserConfig_free(uint32_t this_obj) {
17517 LDKUserConfig this_obj_conv;
17518 this_obj_conv.inner = (void*)(this_obj & (~1));
17519 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17521 UserConfig_free(this_obj_conv);
17524 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
17525 LDKUserConfig this_ptr_conv;
17526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17527 this_ptr_conv.is_owned = false;
17528 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17529 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
17530 uint64_t ret_ref = 0;
17531 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17532 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17533 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17534 ret_ref = (uint64_t)ret_var.inner;
17535 if (ret_var.is_owned) {
17541 void __attribute__((visibility("default"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
17542 LDKUserConfig this_ptr_conv;
17543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17544 this_ptr_conv.is_owned = false;
17545 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17546 LDKChannelHandshakeConfig val_conv;
17547 val_conv.inner = (void*)(val & (~1));
17548 val_conv.is_owned = (val & 1) || (val == 0);
17549 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
17550 val_conv = ChannelHandshakeConfig_clone(&val_conv);
17551 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
17554 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
17555 LDKUserConfig this_ptr_conv;
17556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17557 this_ptr_conv.is_owned = false;
17558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17559 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
17560 uint64_t ret_ref = 0;
17561 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17562 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17563 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17564 ret_ref = (uint64_t)ret_var.inner;
17565 if (ret_var.is_owned) {
17571 void __attribute__((visibility("default"))) TS_UserConfig_set_peer_channel_config_limits(uint32_t this_ptr, uint32_t val) {
17572 LDKUserConfig this_ptr_conv;
17573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17574 this_ptr_conv.is_owned = false;
17575 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17576 LDKChannelHandshakeLimits val_conv;
17577 val_conv.inner = (void*)(val & (~1));
17578 val_conv.is_owned = (val & 1) || (val == 0);
17579 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
17580 val_conv = ChannelHandshakeLimits_clone(&val_conv);
17581 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
17584 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
17585 LDKUserConfig this_ptr_conv;
17586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17587 this_ptr_conv.is_owned = false;
17588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17589 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
17590 uint64_t ret_ref = 0;
17591 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17592 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17593 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17594 ret_ref = (uint64_t)ret_var.inner;
17595 if (ret_var.is_owned) {
17601 void __attribute__((visibility("default"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
17602 LDKUserConfig this_ptr_conv;
17603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17604 this_ptr_conv.is_owned = false;
17605 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17606 LDKChannelConfig val_conv;
17607 val_conv.inner = (void*)(val & (~1));
17608 val_conv.is_owned = (val & 1) || (val == 0);
17609 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
17610 val_conv = ChannelConfig_clone(&val_conv);
17611 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
17614 jboolean __attribute__((visibility("default"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint32_t this_ptr) {
17615 LDKUserConfig this_ptr_conv;
17616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17617 this_ptr_conv.is_owned = false;
17618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17619 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
17623 void __attribute__((visibility("default"))) TS_UserConfig_set_accept_forwards_to_priv_channels(uint32_t this_ptr, jboolean val) {
17624 LDKUserConfig this_ptr_conv;
17625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17626 this_ptr_conv.is_owned = false;
17627 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17628 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
17631 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) {
17632 LDKChannelHandshakeConfig own_channel_config_arg_conv;
17633 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
17634 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
17635 CHECK_INNER_FIELD_ACCESS_OR_NULL(own_channel_config_arg_conv);
17636 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
17637 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
17638 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
17639 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
17640 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_channel_config_limits_arg_conv);
17641 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
17642 LDKChannelConfig channel_options_arg_conv;
17643 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
17644 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
17645 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_options_arg_conv);
17646 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
17647 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);
17648 uint64_t ret_ref = 0;
17649 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17650 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17651 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17652 ret_ref = (uint64_t)ret_var.inner;
17653 if (ret_var.is_owned) {
17659 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
17660 LDKUserConfig ret_var = UserConfig_clone(arg);
17661 uint64_t ret_ref = 0;
17662 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17663 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17664 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17665 ret_ref = (uint64_t)ret_var.inner;
17666 if (ret_var.is_owned) {
17671 int64_t __attribute__((visibility("default"))) TS_UserConfig_clone_ptr(uint32_t arg) {
17672 LDKUserConfig arg_conv;
17673 arg_conv.inner = (void*)(arg & (~1));
17674 arg_conv.is_owned = false;
17675 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17676 int64_t ret_val = UserConfig_clone_ptr(&arg_conv);
17680 uint32_t __attribute__((visibility("default"))) TS_UserConfig_clone(uint32_t orig) {
17681 LDKUserConfig orig_conv;
17682 orig_conv.inner = (void*)(orig & (~1));
17683 orig_conv.is_owned = false;
17684 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17685 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
17686 uint64_t ret_ref = 0;
17687 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17688 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17689 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17690 ret_ref = (uint64_t)ret_var.inner;
17691 if (ret_var.is_owned) {
17697 uint32_t __attribute__((visibility("default"))) TS_UserConfig_default() {
17698 LDKUserConfig ret_var = UserConfig_default();
17699 uint64_t ret_ref = 0;
17700 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17701 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17702 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17703 ret_ref = (uint64_t)ret_var.inner;
17704 if (ret_var.is_owned) {
17710 void __attribute__((visibility("default"))) TS_BestBlock_free(uint32_t this_obj) {
17711 LDKBestBlock this_obj_conv;
17712 this_obj_conv.inner = (void*)(this_obj & (~1));
17713 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17714 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17715 BestBlock_free(this_obj_conv);
17718 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
17719 LDKBestBlock ret_var = BestBlock_clone(arg);
17720 uint64_t ret_ref = 0;
17721 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17722 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17723 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17724 ret_ref = (uint64_t)ret_var.inner;
17725 if (ret_var.is_owned) {
17730 int64_t __attribute__((visibility("default"))) TS_BestBlock_clone_ptr(uint32_t arg) {
17731 LDKBestBlock arg_conv;
17732 arg_conv.inner = (void*)(arg & (~1));
17733 arg_conv.is_owned = false;
17734 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17735 int64_t ret_val = BestBlock_clone_ptr(&arg_conv);
17739 uint32_t __attribute__((visibility("default"))) TS_BestBlock_clone(uint32_t orig) {
17740 LDKBestBlock orig_conv;
17741 orig_conv.inner = (void*)(orig & (~1));
17742 orig_conv.is_owned = false;
17743 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17744 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
17745 uint64_t ret_ref = 0;
17746 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17747 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17748 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17749 ret_ref = (uint64_t)ret_var.inner;
17750 if (ret_var.is_owned) {
17756 uint32_t __attribute__((visibility("default"))) TS_BestBlock_from_genesis(uint32_t network) {
17757 LDKNetwork network_conv = LDKNetwork_from_js(network);
17758 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
17759 uint64_t ret_ref = 0;
17760 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17761 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17762 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17763 ret_ref = (uint64_t)ret_var.inner;
17764 if (ret_var.is_owned) {
17770 uint32_t __attribute__((visibility("default"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
17771 LDKThirtyTwoBytes block_hash_ref;
17772 CHECK(*((uint32_t*)block_hash) == 32);
17773 memcpy(block_hash_ref.data, (uint8_t*)(block_hash + 4), 32);
17774 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
17775 uint64_t ret_ref = 0;
17776 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17777 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17778 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17779 ret_ref = (uint64_t)ret_var.inner;
17780 if (ret_var.is_owned) {
17786 int8_tArray __attribute__((visibility("default"))) TS_BestBlock_block_hash(uint32_t this_arg) {
17787 LDKBestBlock this_arg_conv;
17788 this_arg_conv.inner = (void*)(this_arg & (~1));
17789 this_arg_conv.is_owned = false;
17790 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
17791 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17792 memcpy((uint8_t*)(ret_arr + 4), BestBlock_block_hash(&this_arg_conv).data, 32);
17796 int32_t __attribute__((visibility("default"))) TS_BestBlock_height(uint32_t this_arg) {
17797 LDKBestBlock this_arg_conv;
17798 this_arg_conv.inner = (void*)(this_arg & (~1));
17799 this_arg_conv.is_owned = false;
17800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
17801 int32_t ret_val = BestBlock_height(&this_arg_conv);
17805 uint32_t __attribute__((visibility("default"))) TS_AccessError_clone(uint32_t orig) {
17806 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
17807 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
17811 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_chain() {
17812 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
17816 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_tx() {
17817 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
17821 void __attribute__((visibility("default"))) TS_Access_free(uint32_t this_ptr) {
17822 if ((this_ptr & 1) != 0) return;
17823 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17824 CHECK_ACCESS(this_ptr_ptr);
17825 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
17826 FREE((void*)this_ptr);
17827 Access_free(this_ptr_conv);
17830 void __attribute__((visibility("default"))) TS_Listen_free(uint32_t this_ptr) {
17831 if ((this_ptr & 1) != 0) return;
17832 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17833 CHECK_ACCESS(this_ptr_ptr);
17834 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
17835 FREE((void*)this_ptr);
17836 Listen_free(this_ptr_conv);
17839 void __attribute__((visibility("default"))) TS_Confirm_free(uint32_t this_ptr) {
17840 if ((this_ptr & 1) != 0) return;
17841 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17842 CHECK_ACCESS(this_ptr_ptr);
17843 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
17844 FREE((void*)this_ptr);
17845 Confirm_free(this_ptr_conv);
17848 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
17849 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
17850 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
17854 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_temporary_failure() {
17855 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure());
17859 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_permanent_failure() {
17860 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure());
17864 void __attribute__((visibility("default"))) TS_Watch_free(uint32_t this_ptr) {
17865 if ((this_ptr & 1) != 0) return;
17866 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17867 CHECK_ACCESS(this_ptr_ptr);
17868 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
17869 FREE((void*)this_ptr);
17870 Watch_free(this_ptr_conv);
17873 void __attribute__((visibility("default"))) TS_Filter_free(uint32_t this_ptr) {
17874 if ((this_ptr & 1) != 0) return;
17875 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17876 CHECK_ACCESS(this_ptr_ptr);
17877 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
17878 FREE((void*)this_ptr);
17879 Filter_free(this_ptr_conv);
17882 void __attribute__((visibility("default"))) TS_WatchedOutput_free(uint32_t this_obj) {
17883 LDKWatchedOutput this_obj_conv;
17884 this_obj_conv.inner = (void*)(this_obj & (~1));
17885 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17886 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17887 WatchedOutput_free(this_obj_conv);
17890 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_block_hash(uint32_t this_ptr) {
17891 LDKWatchedOutput this_ptr_conv;
17892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17893 this_ptr_conv.is_owned = false;
17894 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17895 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17896 memcpy((uint8_t*)(ret_arr + 4), WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
17900 void __attribute__((visibility("default"))) TS_WatchedOutput_set_block_hash(uint32_t this_ptr, int8_tArray val) {
17901 LDKWatchedOutput this_ptr_conv;
17902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17903 this_ptr_conv.is_owned = false;
17904 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17905 LDKThirtyTwoBytes val_ref;
17906 CHECK(*((uint32_t*)val) == 32);
17907 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17908 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
17911 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_get_outpoint(uint32_t this_ptr) {
17912 LDKWatchedOutput this_ptr_conv;
17913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17914 this_ptr_conv.is_owned = false;
17915 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17916 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
17917 uint64_t ret_ref = 0;
17918 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17919 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17920 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17921 ret_ref = (uint64_t)ret_var.inner;
17922 if (ret_var.is_owned) {
17928 void __attribute__((visibility("default"))) TS_WatchedOutput_set_outpoint(uint32_t this_ptr, uint32_t val) {
17929 LDKWatchedOutput this_ptr_conv;
17930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17931 this_ptr_conv.is_owned = false;
17932 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17933 LDKOutPoint val_conv;
17934 val_conv.inner = (void*)(val & (~1));
17935 val_conv.is_owned = (val & 1) || (val == 0);
17936 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
17937 val_conv = OutPoint_clone(&val_conv);
17938 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
17941 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_script_pubkey(uint32_t this_ptr) {
17942 LDKWatchedOutput this_ptr_conv;
17943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17944 this_ptr_conv.is_owned = false;
17945 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17946 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
17947 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17948 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17952 void __attribute__((visibility("default"))) TS_WatchedOutput_set_script_pubkey(uint32_t this_ptr, int8_tArray val) {
17953 LDKWatchedOutput this_ptr_conv;
17954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17955 this_ptr_conv.is_owned = false;
17956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17957 LDKCVec_u8Z val_ref;
17958 val_ref.datalen = *((uint32_t*)val);
17959 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
17960 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
17961 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
17964 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_new(int8_tArray block_hash_arg, uint32_t outpoint_arg, int8_tArray script_pubkey_arg) {
17965 LDKThirtyTwoBytes block_hash_arg_ref;
17966 CHECK(*((uint32_t*)block_hash_arg) == 32);
17967 memcpy(block_hash_arg_ref.data, (uint8_t*)(block_hash_arg + 4), 32);
17968 LDKOutPoint outpoint_arg_conv;
17969 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
17970 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
17971 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
17972 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
17973 LDKCVec_u8Z script_pubkey_arg_ref;
17974 script_pubkey_arg_ref.datalen = *((uint32_t*)script_pubkey_arg);
17975 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
17976 memcpy(script_pubkey_arg_ref.data, (uint8_t*)(script_pubkey_arg + 4), script_pubkey_arg_ref.datalen);
17977 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
17978 uint64_t ret_ref = 0;
17979 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17980 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17981 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17982 ret_ref = (uint64_t)ret_var.inner;
17983 if (ret_var.is_owned) {
17989 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
17990 LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
17991 uint64_t ret_ref = 0;
17992 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17993 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17994 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17995 ret_ref = (uint64_t)ret_var.inner;
17996 if (ret_var.is_owned) {
18001 int64_t __attribute__((visibility("default"))) TS_WatchedOutput_clone_ptr(uint32_t arg) {
18002 LDKWatchedOutput arg_conv;
18003 arg_conv.inner = (void*)(arg & (~1));
18004 arg_conv.is_owned = false;
18005 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18006 int64_t ret_val = WatchedOutput_clone_ptr(&arg_conv);
18010 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_clone(uint32_t orig) {
18011 LDKWatchedOutput orig_conv;
18012 orig_conv.inner = (void*)(orig & (~1));
18013 orig_conv.is_owned = false;
18014 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18015 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
18016 uint64_t ret_ref = 0;
18017 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18018 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18019 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18020 ret_ref = (uint64_t)ret_var.inner;
18021 if (ret_var.is_owned) {
18027 int64_t __attribute__((visibility("default"))) TS_WatchedOutput_hash(uint32_t o) {
18028 LDKWatchedOutput o_conv;
18029 o_conv.inner = (void*)(o & (~1));
18030 o_conv.is_owned = false;
18031 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18032 int64_t ret_val = WatchedOutput_hash(&o_conv);
18036 void __attribute__((visibility("default"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
18037 if ((this_ptr & 1) != 0) return;
18038 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18039 CHECK_ACCESS(this_ptr_ptr);
18040 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
18041 FREE((void*)this_ptr);
18042 BroadcasterInterface_free(this_ptr_conv);
18045 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_clone(uint32_t orig) {
18046 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
18047 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
18051 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_background() {
18052 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
18056 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_normal() {
18057 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
18061 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_high_priority() {
18062 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
18066 jboolean __attribute__((visibility("default"))) TS_ConfirmationTarget_eq(uint32_t a, uint32_t b) {
18067 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
18068 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
18069 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
18073 void __attribute__((visibility("default"))) TS_FeeEstimator_free(uint32_t this_ptr) {
18074 if ((this_ptr & 1) != 0) return;
18075 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18076 CHECK_ACCESS(this_ptr_ptr);
18077 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
18078 FREE((void*)this_ptr);
18079 FeeEstimator_free(this_ptr_conv);
18082 void __attribute__((visibility("default"))) TS_MonitorUpdateId_free(uint32_t this_obj) {
18083 LDKMonitorUpdateId this_obj_conv;
18084 this_obj_conv.inner = (void*)(this_obj & (~1));
18085 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18086 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18087 MonitorUpdateId_free(this_obj_conv);
18090 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
18091 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
18092 uint64_t ret_ref = 0;
18093 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18094 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18095 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18096 ret_ref = (uint64_t)ret_var.inner;
18097 if (ret_var.is_owned) {
18102 int64_t __attribute__((visibility("default"))) TS_MonitorUpdateId_clone_ptr(uint32_t arg) {
18103 LDKMonitorUpdateId arg_conv;
18104 arg_conv.inner = (void*)(arg & (~1));
18105 arg_conv.is_owned = false;
18106 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18107 int64_t ret_val = MonitorUpdateId_clone_ptr(&arg_conv);
18111 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateId_clone(uint32_t orig) {
18112 LDKMonitorUpdateId orig_conv;
18113 orig_conv.inner = (void*)(orig & (~1));
18114 orig_conv.is_owned = false;
18115 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18116 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
18117 uint64_t ret_ref = 0;
18118 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18119 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18120 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18121 ret_ref = (uint64_t)ret_var.inner;
18122 if (ret_var.is_owned) {
18128 int64_t __attribute__((visibility("default"))) TS_MonitorUpdateId_hash(uint32_t o) {
18129 LDKMonitorUpdateId o_conv;
18130 o_conv.inner = (void*)(o & (~1));
18131 o_conv.is_owned = false;
18132 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18133 int64_t ret_val = MonitorUpdateId_hash(&o_conv);
18137 jboolean __attribute__((visibility("default"))) TS_MonitorUpdateId_eq(uint32_t a, uint32_t b) {
18138 LDKMonitorUpdateId a_conv;
18139 a_conv.inner = (void*)(a & (~1));
18140 a_conv.is_owned = false;
18141 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18142 LDKMonitorUpdateId b_conv;
18143 b_conv.inner = (void*)(b & (~1));
18144 b_conv.is_owned = false;
18145 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18146 jboolean ret_val = MonitorUpdateId_eq(&a_conv, &b_conv);
18150 void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) {
18151 if ((this_ptr & 1) != 0) return;
18152 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18153 CHECK_ACCESS(this_ptr_ptr);
18154 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
18155 FREE((void*)this_ptr);
18156 Persist_free(this_ptr_conv);
18159 void __attribute__((visibility("default"))) TS_LockedChannelMonitor_free(uint32_t this_obj) {
18160 LDKLockedChannelMonitor this_obj_conv;
18161 this_obj_conv.inner = (void*)(this_obj & (~1));
18162 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18163 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18164 LockedChannelMonitor_free(this_obj_conv);
18167 void __attribute__((visibility("default"))) TS_ChainMonitor_free(uint32_t this_obj) {
18168 LDKChainMonitor this_obj_conv;
18169 this_obj_conv.inner = (void*)(this_obj & (~1));
18170 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18171 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18172 ChainMonitor_free(this_obj_conv);
18175 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_new(uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
18176 void* chain_source_ptr = (void*)(((uint64_t)chain_source) & ~1);
18177 CHECK_ACCESS(chain_source_ptr);
18178 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
18179 // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ
18180 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
18181 // Manually implement clone for Java trait instances
18183 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
18184 CHECK_ACCESS(broadcaster_ptr);
18185 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
18186 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
18187 CHECK_ACCESS(logger_ptr);
18188 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
18189 void* feeest_ptr = (void*)(((uint64_t)feeest) & ~1);
18190 CHECK_ACCESS(feeest_ptr);
18191 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
18192 void* persister_ptr = (void*)(((uint64_t)persister) & ~1);
18193 CHECK_ACCESS(persister_ptr);
18194 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
18195 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
18196 uint64_t ret_ref = 0;
18197 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18198 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18199 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18200 ret_ref = (uint64_t)ret_var.inner;
18201 if (ret_var.is_owned) {
18207 uint32_tArray __attribute__((visibility("default"))) TS_ChainMonitor_get_claimable_balances(uint32_t this_arg, uint32_tArray ignored_channels) {
18208 LDKChainMonitor this_arg_conv;
18209 this_arg_conv.inner = (void*)(this_arg & (~1));
18210 this_arg_conv.is_owned = false;
18211 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18212 LDKCVec_ChannelDetailsZ ignored_channels_constr;
18213 ignored_channels_constr.datalen = *((uint32_t*)ignored_channels);
18214 if (ignored_channels_constr.datalen > 0)
18215 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
18217 ignored_channels_constr.data = NULL;
18218 uint32_t* ignored_channels_vals = (uint32_t*)(ignored_channels + 4);
18219 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
18220 uint32_t ignored_channels_conv_16 = ignored_channels_vals[q];
18221 LDKChannelDetails ignored_channels_conv_16_conv;
18222 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
18223 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
18224 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
18225 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
18226 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
18228 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
18229 uint32_tArray ret_arr = NULL;
18230 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
18231 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
18232 for (size_t j = 0; j < ret_var.datalen; j++) {
18233 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18234 *ret_conv_9_copy = ret_var.data[j];
18235 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
18236 ret_arr_ptr[j] = ret_conv_9_ref;
18239 FREE(ret_var.data);
18243 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_get_monitor(uint32_t this_arg, uint32_t funding_txo) {
18244 LDKChainMonitor this_arg_conv;
18245 this_arg_conv.inner = (void*)(this_arg & (~1));
18246 this_arg_conv.is_owned = false;
18247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18248 LDKOutPoint funding_txo_conv;
18249 funding_txo_conv.inner = (void*)(funding_txo & (~1));
18250 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
18251 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
18252 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
18253 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
18254 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
18255 return (uint64_t)ret_conv;
18258 uint32_tArray __attribute__((visibility("default"))) TS_ChainMonitor_list_monitors(uint32_t this_arg) {
18259 LDKChainMonitor this_arg_conv;
18260 this_arg_conv.inner = (void*)(this_arg & (~1));
18261 this_arg_conv.is_owned = false;
18262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18263 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
18264 uint32_tArray ret_arr = NULL;
18265 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
18266 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
18267 for (size_t k = 0; k < ret_var.datalen; k++) {
18268 LDKOutPoint ret_conv_10_var = ret_var.data[k];
18269 uint64_t ret_conv_10_ref = 0;
18270 CHECK((((uint64_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18271 CHECK((((uint64_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18272 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
18273 ret_conv_10_ref = (uint64_t)ret_conv_10_var.inner;
18274 if (ret_conv_10_var.is_owned) {
18275 ret_conv_10_ref |= 1;
18277 ret_arr_ptr[k] = ret_conv_10_ref;
18280 FREE(ret_var.data);
18284 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_channel_monitor_updated(uint32_t this_arg, uint32_t funding_txo, uint32_t completed_update_id) {
18285 LDKChainMonitor this_arg_conv;
18286 this_arg_conv.inner = (void*)(this_arg & (~1));
18287 this_arg_conv.is_owned = false;
18288 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18289 LDKOutPoint funding_txo_conv;
18290 funding_txo_conv.inner = (void*)(funding_txo & (~1));
18291 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
18292 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
18293 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
18294 LDKMonitorUpdateId completed_update_id_conv;
18295 completed_update_id_conv.inner = (void*)(completed_update_id & (~1));
18296 completed_update_id_conv.is_owned = (completed_update_id & 1) || (completed_update_id == 0);
18297 CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
18298 completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
18299 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18300 *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
18301 return (uint64_t)ret_conv;
18304 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Listen(uint32_t this_arg) {
18305 LDKChainMonitor this_arg_conv;
18306 this_arg_conv.inner = (void*)(this_arg & (~1));
18307 this_arg_conv.is_owned = false;
18308 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18309 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
18310 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
18311 return (uint64_t)ret_ret;
18314 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Confirm(uint32_t this_arg) {
18315 LDKChainMonitor this_arg_conv;
18316 this_arg_conv.inner = (void*)(this_arg & (~1));
18317 this_arg_conv.is_owned = false;
18318 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18319 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
18320 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
18321 return (uint64_t)ret_ret;
18324 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
18325 LDKChainMonitor this_arg_conv;
18326 this_arg_conv.inner = (void*)(this_arg & (~1));
18327 this_arg_conv.is_owned = false;
18328 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18329 LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
18330 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
18331 return (uint64_t)ret_ret;
18334 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
18335 LDKChainMonitor this_arg_conv;
18336 this_arg_conv.inner = (void*)(this_arg & (~1));
18337 this_arg_conv.is_owned = false;
18338 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18339 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
18340 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
18341 return (uint64_t)ret_ret;
18344 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
18345 LDKChannelMonitorUpdate this_obj_conv;
18346 this_obj_conv.inner = (void*)(this_obj & (~1));
18347 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18348 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18349 ChannelMonitorUpdate_free(this_obj_conv);
18352 int64_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
18353 LDKChannelMonitorUpdate this_ptr_conv;
18354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18355 this_ptr_conv.is_owned = false;
18356 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18357 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
18361 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
18362 LDKChannelMonitorUpdate this_ptr_conv;
18363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18364 this_ptr_conv.is_owned = false;
18365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18366 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
18369 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
18370 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
18371 uint64_t ret_ref = 0;
18372 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18373 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18374 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18375 ret_ref = (uint64_t)ret_var.inner;
18376 if (ret_var.is_owned) {
18381 int64_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_clone_ptr(uint32_t arg) {
18382 LDKChannelMonitorUpdate arg_conv;
18383 arg_conv.inner = (void*)(arg & (~1));
18384 arg_conv.is_owned = false;
18385 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18386 int64_t ret_val = ChannelMonitorUpdate_clone_ptr(&arg_conv);
18390 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
18391 LDKChannelMonitorUpdate orig_conv;
18392 orig_conv.inner = (void*)(orig & (~1));
18393 orig_conv.is_owned = false;
18394 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18395 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
18396 uint64_t ret_ref = 0;
18397 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18398 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18399 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18400 ret_ref = (uint64_t)ret_var.inner;
18401 if (ret_var.is_owned) {
18407 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
18408 LDKChannelMonitorUpdate obj_conv;
18409 obj_conv.inner = (void*)(obj & (~1));
18410 obj_conv.is_owned = false;
18411 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
18412 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
18413 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18414 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18415 CVec_u8Z_free(ret_var);
18419 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
18420 LDKu8slice ser_ref;
18421 ser_ref.datalen = *((uint32_t*)ser);
18422 ser_ref.data = (int8_t*)(ser + 4);
18423 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18424 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
18425 return (uint64_t)ret_conv;
18428 void __attribute__((visibility("default"))) TS_MonitorUpdateError_free(uint32_t this_obj) {
18429 LDKMonitorUpdateError this_obj_conv;
18430 this_obj_conv.inner = (void*)(this_obj & (~1));
18431 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18432 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18433 MonitorUpdateError_free(this_obj_conv);
18436 jstring __attribute__((visibility("default"))) TS_MonitorUpdateError_get_a(uint32_t this_ptr) {
18437 LDKMonitorUpdateError this_ptr_conv;
18438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18439 this_ptr_conv.is_owned = false;
18440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18441 LDKStr ret_str = MonitorUpdateError_get_a(&this_ptr_conv);
18442 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
18447 void __attribute__((visibility("default"))) TS_MonitorUpdateError_set_a(uint32_t this_ptr, jstring val) {
18448 LDKMonitorUpdateError this_ptr_conv;
18449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18450 this_ptr_conv.is_owned = false;
18451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18452 LDKStr val_conv = str_ref_to_owned_c(val);
18453 MonitorUpdateError_set_a(&this_ptr_conv, val_conv);
18456 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateError_new(jstring a_arg) {
18457 LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
18458 LDKMonitorUpdateError ret_var = MonitorUpdateError_new(a_arg_conv);
18459 uint64_t ret_ref = 0;
18460 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18461 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18462 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18463 ret_ref = (uint64_t)ret_var.inner;
18464 if (ret_var.is_owned) {
18470 static inline uint64_t MonitorUpdateError_clone_ptr(LDKMonitorUpdateError *NONNULL_PTR arg) {
18471 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(arg);
18472 uint64_t ret_ref = 0;
18473 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18474 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18475 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18476 ret_ref = (uint64_t)ret_var.inner;
18477 if (ret_var.is_owned) {
18482 int64_t __attribute__((visibility("default"))) TS_MonitorUpdateError_clone_ptr(uint32_t arg) {
18483 LDKMonitorUpdateError arg_conv;
18484 arg_conv.inner = (void*)(arg & (~1));
18485 arg_conv.is_owned = false;
18486 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18487 int64_t ret_val = MonitorUpdateError_clone_ptr(&arg_conv);
18491 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateError_clone(uint32_t orig) {
18492 LDKMonitorUpdateError orig_conv;
18493 orig_conv.inner = (void*)(orig & (~1));
18494 orig_conv.is_owned = false;
18495 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18496 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
18497 uint64_t ret_ref = 0;
18498 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18499 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18500 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18501 ret_ref = (uint64_t)ret_var.inner;
18502 if (ret_var.is_owned) {
18508 void __attribute__((visibility("default"))) TS_MonitorEvent_free(uint32_t this_ptr) {
18509 if ((this_ptr & 1) != 0) return;
18510 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18511 CHECK_ACCESS(this_ptr_ptr);
18512 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
18513 FREE((void*)this_ptr);
18514 MonitorEvent_free(this_ptr_conv);
18517 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
18518 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18519 *ret_copy = MonitorEvent_clone(arg);
18520 uint64_t ret_ref = (uint64_t)ret_copy;
18523 int64_t __attribute__((visibility("default"))) TS_MonitorEvent_clone_ptr(uint32_t arg) {
18524 LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)arg;
18525 int64_t ret_val = MonitorEvent_clone_ptr(arg_conv);
18529 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_clone(uint32_t orig) {
18530 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
18531 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18532 *ret_copy = MonitorEvent_clone(orig_conv);
18533 uint64_t ret_ref = (uint64_t)ret_copy;
18537 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_htlcevent(uint32_t a) {
18538 LDKHTLCUpdate a_conv;
18539 a_conv.inner = (void*)(a & (~1));
18540 a_conv.is_owned = (a & 1) || (a == 0);
18541 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18542 a_conv = HTLCUpdate_clone(&a_conv);
18543 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18544 *ret_copy = MonitorEvent_htlcevent(a_conv);
18545 uint64_t ret_ref = (uint64_t)ret_copy;
18549 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_commitment_tx_confirmed(uint32_t a) {
18550 LDKOutPoint a_conv;
18551 a_conv.inner = (void*)(a & (~1));
18552 a_conv.is_owned = (a & 1) || (a == 0);
18553 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18554 a_conv = OutPoint_clone(&a_conv);
18555 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18556 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
18557 uint64_t ret_ref = (uint64_t)ret_copy;
18561 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_update_completed(uint32_t funding_txo, int64_t monitor_update_id) {
18562 LDKOutPoint funding_txo_conv;
18563 funding_txo_conv.inner = (void*)(funding_txo & (~1));
18564 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
18565 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
18566 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
18567 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18568 *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
18569 uint64_t ret_ref = (uint64_t)ret_copy;
18573 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_update_failed(uint32_t a) {
18574 LDKOutPoint a_conv;
18575 a_conv.inner = (void*)(a & (~1));
18576 a_conv.is_owned = (a & 1) || (a == 0);
18577 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18578 a_conv = OutPoint_clone(&a_conv);
18579 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18580 *ret_copy = MonitorEvent_update_failed(a_conv);
18581 uint64_t ret_ref = (uint64_t)ret_copy;
18585 int8_tArray __attribute__((visibility("default"))) TS_MonitorEvent_write(uint32_t obj) {
18586 LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)obj;
18587 LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
18588 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18589 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18590 CVec_u8Z_free(ret_var);
18594 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_read(int8_tArray ser) {
18595 LDKu8slice ser_ref;
18596 ser_ref.datalen = *((uint32_t*)ser);
18597 ser_ref.data = (int8_t*)(ser + 4);
18598 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18599 *ret_conv = MonitorEvent_read(ser_ref);
18600 return (uint64_t)ret_conv;
18603 void __attribute__((visibility("default"))) TS_HTLCUpdate_free(uint32_t this_obj) {
18604 LDKHTLCUpdate this_obj_conv;
18605 this_obj_conv.inner = (void*)(this_obj & (~1));
18606 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18607 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18608 HTLCUpdate_free(this_obj_conv);
18611 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
18612 LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
18613 uint64_t ret_ref = 0;
18614 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18615 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18616 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18617 ret_ref = (uint64_t)ret_var.inner;
18618 if (ret_var.is_owned) {
18623 int64_t __attribute__((visibility("default"))) TS_HTLCUpdate_clone_ptr(uint32_t arg) {
18624 LDKHTLCUpdate arg_conv;
18625 arg_conv.inner = (void*)(arg & (~1));
18626 arg_conv.is_owned = false;
18627 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18628 int64_t ret_val = HTLCUpdate_clone_ptr(&arg_conv);
18632 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_clone(uint32_t orig) {
18633 LDKHTLCUpdate orig_conv;
18634 orig_conv.inner = (void*)(orig & (~1));
18635 orig_conv.is_owned = false;
18636 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18637 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
18638 uint64_t ret_ref = 0;
18639 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18640 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18641 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18642 ret_ref = (uint64_t)ret_var.inner;
18643 if (ret_var.is_owned) {
18649 int8_tArray __attribute__((visibility("default"))) TS_HTLCUpdate_write(uint32_t obj) {
18650 LDKHTLCUpdate obj_conv;
18651 obj_conv.inner = (void*)(obj & (~1));
18652 obj_conv.is_owned = false;
18653 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
18654 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
18655 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18656 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18657 CVec_u8Z_free(ret_var);
18661 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_read(int8_tArray ser) {
18662 LDKu8slice ser_ref;
18663 ser_ref.datalen = *((uint32_t*)ser);
18664 ser_ref.data = (int8_t*)(ser + 4);
18665 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18666 *ret_conv = HTLCUpdate_read(ser_ref);
18667 return (uint64_t)ret_conv;
18670 void __attribute__((visibility("default"))) TS_Balance_free(uint32_t this_ptr) {
18671 if ((this_ptr & 1) != 0) return;
18672 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18673 CHECK_ACCESS(this_ptr_ptr);
18674 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
18675 FREE((void*)this_ptr);
18676 Balance_free(this_ptr_conv);
18679 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
18680 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18681 *ret_copy = Balance_clone(arg);
18682 uint64_t ret_ref = (uint64_t)ret_copy;
18685 int64_t __attribute__((visibility("default"))) TS_Balance_clone_ptr(uint32_t arg) {
18686 LDKBalance* arg_conv = (LDKBalance*)arg;
18687 int64_t ret_val = Balance_clone_ptr(arg_conv);
18691 uint32_t __attribute__((visibility("default"))) TS_Balance_clone(uint32_t orig) {
18692 LDKBalance* orig_conv = (LDKBalance*)orig;
18693 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18694 *ret_copy = Balance_clone(orig_conv);
18695 uint64_t ret_ref = (uint64_t)ret_copy;
18699 uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
18700 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18701 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
18702 uint64_t ret_ref = (uint64_t)ret_copy;
18706 uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
18707 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18708 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
18709 uint64_t ret_ref = (uint64_t)ret_copy;
18713 uint32_t __attribute__((visibility("default"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
18714 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18715 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
18716 uint64_t ret_ref = (uint64_t)ret_copy;
18720 uint32_t __attribute__((visibility("default"))) TS_Balance_maybe_claimable_htlcawaiting_timeout(int64_t claimable_amount_satoshis, int32_t claimable_height) {
18721 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18722 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
18723 uint64_t ret_ref = (uint64_t)ret_copy;
18727 jboolean __attribute__((visibility("default"))) TS_Balance_eq(uint32_t a, uint32_t b) {
18728 LDKBalance* a_conv = (LDKBalance*)a;
18729 LDKBalance* b_conv = (LDKBalance*)b;
18730 jboolean ret_val = Balance_eq(a_conv, b_conv);
18734 void __attribute__((visibility("default"))) TS_ChannelMonitor_free(uint32_t this_obj) {
18735 LDKChannelMonitor this_obj_conv;
18736 this_obj_conv.inner = (void*)(this_obj & (~1));
18737 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18738 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18739 ChannelMonitor_free(this_obj_conv);
18742 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
18743 LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
18744 uint64_t ret_ref = 0;
18745 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18746 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18747 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18748 ret_ref = (uint64_t)ret_var.inner;
18749 if (ret_var.is_owned) {
18754 int64_t __attribute__((visibility("default"))) TS_ChannelMonitor_clone_ptr(uint32_t arg) {
18755 LDKChannelMonitor arg_conv;
18756 arg_conv.inner = (void*)(arg & (~1));
18757 arg_conv.is_owned = false;
18758 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18759 int64_t ret_val = ChannelMonitor_clone_ptr(&arg_conv);
18763 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_clone(uint32_t orig) {
18764 LDKChannelMonitor orig_conv;
18765 orig_conv.inner = (void*)(orig & (~1));
18766 orig_conv.is_owned = false;
18767 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18768 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
18769 uint64_t ret_ref = 0;
18770 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18771 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18772 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18773 ret_ref = (uint64_t)ret_var.inner;
18774 if (ret_var.is_owned) {
18780 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_write(uint32_t obj) {
18781 LDKChannelMonitor obj_conv;
18782 obj_conv.inner = (void*)(obj & (~1));
18783 obj_conv.is_owned = false;
18784 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
18785 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
18786 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18787 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18788 CVec_u8Z_free(ret_var);
18792 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) {
18793 LDKChannelMonitor this_arg_conv;
18794 this_arg_conv.inner = (void*)(this_arg & (~1));
18795 this_arg_conv.is_owned = false;
18796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18797 LDKChannelMonitorUpdate updates_conv;
18798 updates_conv.inner = (void*)(updates & (~1));
18799 updates_conv.is_owned = false;
18800 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
18801 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
18802 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
18803 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
18804 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
18805 if (!(fee_estimator & 1)) { CHECK_ACCESS(fee_estimator_ptr); }
18806 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
18807 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
18808 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
18809 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
18810 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
18811 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
18812 return (uint64_t)ret_conv;
18815 int64_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
18816 LDKChannelMonitor this_arg_conv;
18817 this_arg_conv.inner = (void*)(this_arg & (~1));
18818 this_arg_conv.is_owned = false;
18819 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18820 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
18824 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
18825 LDKChannelMonitor this_arg_conv;
18826 this_arg_conv.inner = (void*)(this_arg & (~1));
18827 this_arg_conv.is_owned = false;
18828 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18829 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
18830 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
18831 return ((uint64_t)ret_conv);
18834 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_outputs_to_watch(uint32_t this_arg) {
18835 LDKChannelMonitor this_arg_conv;
18836 this_arg_conv.inner = (void*)(this_arg & (~1));
18837 this_arg_conv.is_owned = false;
18838 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18839 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
18840 uint32_tArray ret_arr = NULL;
18841 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
18842 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
18843 for (size_t o = 0; o < ret_var.datalen; o++) {
18844 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18845 *ret_conv_40_conv = ret_var.data[o];
18846 ret_arr_ptr[o] = ((uint64_t)ret_conv_40_conv);
18849 FREE(ret_var.data);
18853 void __attribute__((visibility("default"))) TS_ChannelMonitor_load_outputs_to_watch(uint32_t this_arg, uint32_t filter) {
18854 LDKChannelMonitor this_arg_conv;
18855 this_arg_conv.inner = (void*)(this_arg & (~1));
18856 this_arg_conv.is_owned = false;
18857 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18858 void* filter_ptr = (void*)(((uint64_t)filter) & ~1);
18859 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
18860 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
18861 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
18864 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_monitor_events(uint32_t this_arg) {
18865 LDKChannelMonitor this_arg_conv;
18866 this_arg_conv.inner = (void*)(this_arg & (~1));
18867 this_arg_conv.is_owned = false;
18868 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18869 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
18870 uint32_tArray ret_arr = NULL;
18871 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
18872 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
18873 for (size_t o = 0; o < ret_var.datalen; o++) {
18874 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18875 *ret_conv_14_copy = ret_var.data[o];
18876 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
18877 ret_arr_ptr[o] = ret_conv_14_ref;
18880 FREE(ret_var.data);
18884 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
18885 LDKChannelMonitor this_arg_conv;
18886 this_arg_conv.inner = (void*)(this_arg & (~1));
18887 this_arg_conv.is_owned = false;
18888 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18889 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
18890 uint32_tArray ret_arr = NULL;
18891 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
18892 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
18893 for (size_t h = 0; h < ret_var.datalen; h++) {
18894 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
18895 *ret_conv_7_copy = ret_var.data[h];
18896 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
18897 ret_arr_ptr[h] = ret_conv_7_ref;
18900 FREE(ret_var.data);
18904 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_holder_commitment_txn(uint32_t this_arg, uint32_t logger) {
18905 LDKChannelMonitor this_arg_conv;
18906 this_arg_conv.inner = (void*)(this_arg & (~1));
18907 this_arg_conv.is_owned = false;
18908 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18909 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
18910 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
18911 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
18912 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
18913 ptrArray ret_arr = NULL;
18914 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
18915 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
18916 for (size_t m = 0; m < ret_var.datalen; m++) {
18917 LDKTransaction ret_conv_12_var = ret_var.data[m];
18918 int8_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18919 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_conv_12_var.data, ret_conv_12_var.datalen);
18920 Transaction_free(ret_conv_12_var);
18921 ret_arr_ptr[m] = ret_conv_12_arr;
18924 FREE(ret_var.data);
18928 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) {
18929 LDKChannelMonitor this_arg_conv;
18930 this_arg_conv.inner = (void*)(this_arg & (~1));
18931 this_arg_conv.is_owned = false;
18932 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18933 unsigned char header_arr[80];
18934 CHECK(*((uint32_t*)header) == 80);
18935 memcpy(header_arr, (uint8_t*)(header + 4), 80);
18936 unsigned char (*header_ref)[80] = &header_arr;
18937 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
18938 txdata_constr.datalen = *((uint32_t*)txdata);
18939 if (txdata_constr.datalen > 0)
18940 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
18942 txdata_constr.data = NULL;
18943 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
18944 for (size_t c = 0; c < txdata_constr.datalen; c++) {
18945 uint32_t txdata_conv_28 = txdata_vals[c];
18946 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
18947 CHECK_ACCESS(txdata_conv_28_ptr);
18948 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
18949 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
18950 txdata_constr.data[c] = txdata_conv_28_conv;
18952 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
18953 CHECK_ACCESS(broadcaster_ptr);
18954 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
18955 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
18956 CHECK_ACCESS(fee_estimator_ptr);
18957 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
18958 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
18959 CHECK_ACCESS(logger_ptr);
18960 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
18961 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);
18962 uint32_tArray ret_arr = NULL;
18963 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
18964 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
18965 for (size_t n = 0; n < ret_var.datalen; n++) {
18966 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18967 *ret_conv_39_conv = ret_var.data[n];
18968 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
18971 FREE(ret_var.data);
18975 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) {
18976 LDKChannelMonitor this_arg_conv;
18977 this_arg_conv.inner = (void*)(this_arg & (~1));
18978 this_arg_conv.is_owned = false;
18979 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18980 unsigned char header_arr[80];
18981 CHECK(*((uint32_t*)header) == 80);
18982 memcpy(header_arr, (uint8_t*)(header + 4), 80);
18983 unsigned char (*header_ref)[80] = &header_arr;
18984 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
18985 CHECK_ACCESS(broadcaster_ptr);
18986 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
18987 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
18988 CHECK_ACCESS(fee_estimator_ptr);
18989 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
18990 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
18991 CHECK_ACCESS(logger_ptr);
18992 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
18993 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
18996 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) {
18997 LDKChannelMonitor this_arg_conv;
18998 this_arg_conv.inner = (void*)(this_arg & (~1));
18999 this_arg_conv.is_owned = false;
19000 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19001 unsigned char header_arr[80];
19002 CHECK(*((uint32_t*)header) == 80);
19003 memcpy(header_arr, (uint8_t*)(header + 4), 80);
19004 unsigned char (*header_ref)[80] = &header_arr;
19005 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
19006 txdata_constr.datalen = *((uint32_t*)txdata);
19007 if (txdata_constr.datalen > 0)
19008 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
19010 txdata_constr.data = NULL;
19011 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
19012 for (size_t c = 0; c < txdata_constr.datalen; c++) {
19013 uint32_t txdata_conv_28 = txdata_vals[c];
19014 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
19015 CHECK_ACCESS(txdata_conv_28_ptr);
19016 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
19017 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
19018 txdata_constr.data[c] = txdata_conv_28_conv;
19020 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19021 CHECK_ACCESS(broadcaster_ptr);
19022 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19023 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19024 CHECK_ACCESS(fee_estimator_ptr);
19025 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19026 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19027 CHECK_ACCESS(logger_ptr);
19028 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19029 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);
19030 uint32_tArray ret_arr = NULL;
19031 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
19032 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19033 for (size_t n = 0; n < ret_var.datalen; n++) {
19034 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19035 *ret_conv_39_conv = ret_var.data[n];
19036 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
19039 FREE(ret_var.data);
19043 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) {
19044 LDKChannelMonitor this_arg_conv;
19045 this_arg_conv.inner = (void*)(this_arg & (~1));
19046 this_arg_conv.is_owned = false;
19047 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19048 unsigned char txid_arr[32];
19049 CHECK(*((uint32_t*)txid) == 32);
19050 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
19051 unsigned char (*txid_ref)[32] = &txid_arr;
19052 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19053 CHECK_ACCESS(broadcaster_ptr);
19054 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19055 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19056 CHECK_ACCESS(fee_estimator_ptr);
19057 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19058 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19059 CHECK_ACCESS(logger_ptr);
19060 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19061 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
19064 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) {
19065 LDKChannelMonitor this_arg_conv;
19066 this_arg_conv.inner = (void*)(this_arg & (~1));
19067 this_arg_conv.is_owned = false;
19068 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19069 unsigned char header_arr[80];
19070 CHECK(*((uint32_t*)header) == 80);
19071 memcpy(header_arr, (uint8_t*)(header + 4), 80);
19072 unsigned char (*header_ref)[80] = &header_arr;
19073 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19074 CHECK_ACCESS(broadcaster_ptr);
19075 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19076 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19077 CHECK_ACCESS(fee_estimator_ptr);
19078 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19079 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19080 CHECK_ACCESS(logger_ptr);
19081 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19082 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
19083 uint32_tArray ret_arr = NULL;
19084 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
19085 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19086 for (size_t n = 0; n < ret_var.datalen; n++) {
19087 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19088 *ret_conv_39_conv = ret_var.data[n];
19089 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
19092 FREE(ret_var.data);
19096 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_relevant_txids(uint32_t this_arg) {
19097 LDKChannelMonitor this_arg_conv;
19098 this_arg_conv.inner = (void*)(this_arg & (~1));
19099 this_arg_conv.is_owned = false;
19100 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19101 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
19102 ptrArray ret_arr = NULL;
19103 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
19104 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
19105 for (size_t m = 0; m < ret_var.datalen; m++) {
19106 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19107 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
19108 ret_arr_ptr[m] = ret_conv_12_arr;
19111 FREE(ret_var.data);
19115 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_current_best_block(uint32_t this_arg) {
19116 LDKChannelMonitor this_arg_conv;
19117 this_arg_conv.inner = (void*)(this_arg & (~1));
19118 this_arg_conv.is_owned = false;
19119 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19120 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
19121 uint64_t ret_ref = 0;
19122 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19123 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19124 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19125 ret_ref = (uint64_t)ret_var.inner;
19126 if (ret_var.is_owned) {
19132 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_claimable_balances(uint32_t this_arg) {
19133 LDKChannelMonitor this_arg_conv;
19134 this_arg_conv.inner = (void*)(this_arg & (~1));
19135 this_arg_conv.is_owned = false;
19136 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19137 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
19138 uint32_tArray ret_arr = NULL;
19139 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
19140 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19141 for (size_t j = 0; j < ret_var.datalen; j++) {
19142 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19143 *ret_conv_9_copy = ret_var.data[j];
19144 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
19145 ret_arr_ptr[j] = ret_conv_9_ref;
19148 FREE(ret_var.data);
19152 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
19153 LDKu8slice ser_ref;
19154 ser_ref.datalen = *((uint32_t*)ser);
19155 ser_ref.data = (int8_t*)(ser + 4);
19156 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
19157 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
19158 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
19159 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19160 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
19161 return (uint64_t)ret_conv;
19164 void __attribute__((visibility("default"))) TS_OutPoint_free(uint32_t this_obj) {
19165 LDKOutPoint this_obj_conv;
19166 this_obj_conv.inner = (void*)(this_obj & (~1));
19167 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19168 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19169 OutPoint_free(this_obj_conv);
19172 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
19173 LDKOutPoint this_ptr_conv;
19174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19175 this_ptr_conv.is_owned = false;
19176 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19177 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19178 memcpy((uint8_t*)(ret_arr + 4), *OutPoint_get_txid(&this_ptr_conv), 32);
19182 void __attribute__((visibility("default"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
19183 LDKOutPoint this_ptr_conv;
19184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19185 this_ptr_conv.is_owned = false;
19186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19187 LDKThirtyTwoBytes val_ref;
19188 CHECK(*((uint32_t*)val) == 32);
19189 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19190 OutPoint_set_txid(&this_ptr_conv, val_ref);
19193 int16_t __attribute__((visibility("default"))) TS_OutPoint_get_index(uint32_t this_ptr) {
19194 LDKOutPoint this_ptr_conv;
19195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19196 this_ptr_conv.is_owned = false;
19197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19198 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
19202 void __attribute__((visibility("default"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
19203 LDKOutPoint this_ptr_conv;
19204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19205 this_ptr_conv.is_owned = false;
19206 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19207 OutPoint_set_index(&this_ptr_conv, val);
19210 uint32_t __attribute__((visibility("default"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
19211 LDKThirtyTwoBytes txid_arg_ref;
19212 CHECK(*((uint32_t*)txid_arg) == 32);
19213 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
19214 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
19215 uint64_t ret_ref = 0;
19216 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19217 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19218 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19219 ret_ref = (uint64_t)ret_var.inner;
19220 if (ret_var.is_owned) {
19226 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
19227 LDKOutPoint ret_var = OutPoint_clone(arg);
19228 uint64_t ret_ref = 0;
19229 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19230 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19231 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19232 ret_ref = (uint64_t)ret_var.inner;
19233 if (ret_var.is_owned) {
19238 int64_t __attribute__((visibility("default"))) TS_OutPoint_clone_ptr(uint32_t arg) {
19239 LDKOutPoint arg_conv;
19240 arg_conv.inner = (void*)(arg & (~1));
19241 arg_conv.is_owned = false;
19242 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
19243 int64_t ret_val = OutPoint_clone_ptr(&arg_conv);
19247 uint32_t __attribute__((visibility("default"))) TS_OutPoint_clone(uint32_t orig) {
19248 LDKOutPoint orig_conv;
19249 orig_conv.inner = (void*)(orig & (~1));
19250 orig_conv.is_owned = false;
19251 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
19252 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
19253 uint64_t ret_ref = 0;
19254 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19255 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19256 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19257 ret_ref = (uint64_t)ret_var.inner;
19258 if (ret_var.is_owned) {
19264 jboolean __attribute__((visibility("default"))) TS_OutPoint_eq(uint32_t a, uint32_t b) {
19265 LDKOutPoint a_conv;
19266 a_conv.inner = (void*)(a & (~1));
19267 a_conv.is_owned = false;
19268 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19269 LDKOutPoint b_conv;
19270 b_conv.inner = (void*)(b & (~1));
19271 b_conv.is_owned = false;
19272 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19273 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
19277 int64_t __attribute__((visibility("default"))) TS_OutPoint_hash(uint32_t o) {
19278 LDKOutPoint o_conv;
19279 o_conv.inner = (void*)(o & (~1));
19280 o_conv.is_owned = false;
19281 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19282 int64_t ret_val = OutPoint_hash(&o_conv);
19286 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
19287 LDKOutPoint this_arg_conv;
19288 this_arg_conv.inner = (void*)(this_arg & (~1));
19289 this_arg_conv.is_owned = false;
19290 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19291 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19292 memcpy((uint8_t*)(ret_arr + 4), OutPoint_to_channel_id(&this_arg_conv).data, 32);
19296 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_write(uint32_t obj) {
19297 LDKOutPoint obj_conv;
19298 obj_conv.inner = (void*)(obj & (~1));
19299 obj_conv.is_owned = false;
19300 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
19301 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
19302 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19303 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19304 CVec_u8Z_free(ret_var);
19308 uint32_t __attribute__((visibility("default"))) TS_OutPoint_read(int8_tArray ser) {
19309 LDKu8slice ser_ref;
19310 ser_ref.datalen = *((uint32_t*)ser);
19311 ser_ref.data = (int8_t*)(ser + 4);
19312 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
19313 *ret_conv = OutPoint_read(ser_ref);
19314 return (uint64_t)ret_conv;
19317 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_obj) {
19318 LDKDelayedPaymentOutputDescriptor this_obj_conv;
19319 this_obj_conv.inner = (void*)(this_obj & (~1));
19320 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19321 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19322 DelayedPaymentOutputDescriptor_free(this_obj_conv);
19325 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
19326 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19328 this_ptr_conv.is_owned = false;
19329 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19330 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
19331 uint64_t ret_ref = 0;
19332 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19333 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19334 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19335 ret_ref = (uint64_t)ret_var.inner;
19336 if (ret_var.is_owned) {
19342 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
19343 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19345 this_ptr_conv.is_owned = false;
19346 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19347 LDKOutPoint val_conv;
19348 val_conv.inner = (void*)(val & (~1));
19349 val_conv.is_owned = (val & 1) || (val == 0);
19350 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
19351 val_conv = OutPoint_clone(&val_conv);
19352 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
19355 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
19356 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19358 this_ptr_conv.is_owned = false;
19359 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19360 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19361 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
19365 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
19366 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19368 this_ptr_conv.is_owned = false;
19369 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19370 LDKPublicKey val_ref;
19371 CHECK(*((uint32_t*)val) == 33);
19372 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19373 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
19376 int16_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
19377 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19379 this_ptr_conv.is_owned = false;
19380 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19381 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
19385 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
19386 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19388 this_ptr_conv.is_owned = false;
19389 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19390 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
19393 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
19394 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19396 this_ptr_conv.is_owned = false;
19397 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19398 void* val_ptr = (void*)(((uint64_t)val) & ~1);
19399 CHECK_ACCESS(val_ptr);
19400 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
19401 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
19402 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
19405 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
19406 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19408 this_ptr_conv.is_owned = false;
19409 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19410 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19411 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
19415 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
19416 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19418 this_ptr_conv.is_owned = false;
19419 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19420 LDKPublicKey val_ref;
19421 CHECK(*((uint32_t*)val) == 33);
19422 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19423 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
19426 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
19427 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19429 this_ptr_conv.is_owned = false;
19430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19431 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19432 memcpy((uint8_t*)(ret_arr + 4), *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
19436 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
19437 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19439 this_ptr_conv.is_owned = false;
19440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19441 LDKThirtyTwoBytes val_ref;
19442 CHECK(*((uint32_t*)val) == 32);
19443 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19444 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
19447 int64_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
19448 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19450 this_ptr_conv.is_owned = false;
19451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19452 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
19456 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
19457 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19459 this_ptr_conv.is_owned = false;
19460 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19461 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
19464 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) {
19465 LDKOutPoint outpoint_arg_conv;
19466 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
19467 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
19468 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
19469 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
19470 LDKPublicKey per_commitment_point_arg_ref;
19471 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
19472 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
19473 void* output_arg_ptr = (void*)(((uint64_t)output_arg) & ~1);
19474 CHECK_ACCESS(output_arg_ptr);
19475 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
19476 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
19477 LDKPublicKey revocation_pubkey_arg_ref;
19478 CHECK(*((uint32_t*)revocation_pubkey_arg) == 33);
19479 memcpy(revocation_pubkey_arg_ref.compressed_form, (uint8_t*)(revocation_pubkey_arg + 4), 33);
19480 LDKThirtyTwoBytes channel_keys_id_arg_ref;
19481 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
19482 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
19483 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);
19484 uint64_t ret_ref = 0;
19485 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19486 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19487 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19488 ret_ref = (uint64_t)ret_var.inner;
19489 if (ret_var.is_owned) {
19495 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
19496 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
19497 uint64_t ret_ref = 0;
19498 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19499 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19500 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19501 ret_ref = (uint64_t)ret_var.inner;
19502 if (ret_var.is_owned) {
19507 int64_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint32_t arg) {
19508 LDKDelayedPaymentOutputDescriptor arg_conv;
19509 arg_conv.inner = (void*)(arg & (~1));
19510 arg_conv.is_owned = false;
19511 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
19512 int64_t ret_val = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
19516 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
19517 LDKDelayedPaymentOutputDescriptor orig_conv;
19518 orig_conv.inner = (void*)(orig & (~1));
19519 orig_conv.is_owned = false;
19520 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
19521 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
19522 uint64_t ret_ref = 0;
19523 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19524 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19525 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19526 ret_ref = (uint64_t)ret_var.inner;
19527 if (ret_var.is_owned) {
19533 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_write(uint32_t obj) {
19534 LDKDelayedPaymentOutputDescriptor obj_conv;
19535 obj_conv.inner = (void*)(obj & (~1));
19536 obj_conv.is_owned = false;
19537 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
19538 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
19539 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19540 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19541 CVec_u8Z_free(ret_var);
19545 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
19546 LDKu8slice ser_ref;
19547 ser_ref.datalen = *((uint32_t*)ser);
19548 ser_ref.data = (int8_t*)(ser + 4);
19549 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19550 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
19551 return (uint64_t)ret_conv;
19554 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_obj) {
19555 LDKStaticPaymentOutputDescriptor this_obj_conv;
19556 this_obj_conv.inner = (void*)(this_obj & (~1));
19557 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19559 StaticPaymentOutputDescriptor_free(this_obj_conv);
19562 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
19563 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19565 this_ptr_conv.is_owned = false;
19566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19567 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
19568 uint64_t ret_ref = 0;
19569 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19570 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19571 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19572 ret_ref = (uint64_t)ret_var.inner;
19573 if (ret_var.is_owned) {
19579 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
19580 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19582 this_ptr_conv.is_owned = false;
19583 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19584 LDKOutPoint val_conv;
19585 val_conv.inner = (void*)(val & (~1));
19586 val_conv.is_owned = (val & 1) || (val == 0);
19587 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
19588 val_conv = OutPoint_clone(&val_conv);
19589 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
19592 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
19593 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19595 this_ptr_conv.is_owned = false;
19596 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19597 void* val_ptr = (void*)(((uint64_t)val) & ~1);
19598 CHECK_ACCESS(val_ptr);
19599 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
19600 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
19601 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
19604 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
19605 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19607 this_ptr_conv.is_owned = false;
19608 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19609 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19610 memcpy((uint8_t*)(ret_arr + 4), *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
19614 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
19615 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19617 this_ptr_conv.is_owned = false;
19618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19619 LDKThirtyTwoBytes val_ref;
19620 CHECK(*((uint32_t*)val) == 32);
19621 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19622 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
19625 int64_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
19626 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19628 this_ptr_conv.is_owned = false;
19629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19630 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
19634 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
19635 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19637 this_ptr_conv.is_owned = false;
19638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19639 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
19642 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) {
19643 LDKOutPoint outpoint_arg_conv;
19644 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
19645 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
19646 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
19647 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
19648 void* output_arg_ptr = (void*)(((uint64_t)output_arg) & ~1);
19649 CHECK_ACCESS(output_arg_ptr);
19650 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
19651 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
19652 LDKThirtyTwoBytes channel_keys_id_arg_ref;
19653 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
19654 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
19655 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
19656 uint64_t ret_ref = 0;
19657 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19658 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19659 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19660 ret_ref = (uint64_t)ret_var.inner;
19661 if (ret_var.is_owned) {
19667 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
19668 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
19669 uint64_t ret_ref = 0;
19670 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19671 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19672 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19673 ret_ref = (uint64_t)ret_var.inner;
19674 if (ret_var.is_owned) {
19679 int64_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint32_t arg) {
19680 LDKStaticPaymentOutputDescriptor arg_conv;
19681 arg_conv.inner = (void*)(arg & (~1));
19682 arg_conv.is_owned = false;
19683 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
19684 int64_t ret_val = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
19688 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
19689 LDKStaticPaymentOutputDescriptor orig_conv;
19690 orig_conv.inner = (void*)(orig & (~1));
19691 orig_conv.is_owned = false;
19692 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
19693 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
19694 uint64_t ret_ref = 0;
19695 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19696 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19697 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19698 ret_ref = (uint64_t)ret_var.inner;
19699 if (ret_var.is_owned) {
19705 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_write(uint32_t obj) {
19706 LDKStaticPaymentOutputDescriptor obj_conv;
19707 obj_conv.inner = (void*)(obj & (~1));
19708 obj_conv.is_owned = false;
19709 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
19710 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
19711 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19712 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19713 CVec_u8Z_free(ret_var);
19717 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
19718 LDKu8slice ser_ref;
19719 ser_ref.datalen = *((uint32_t*)ser);
19720 ser_ref.data = (int8_t*)(ser + 4);
19721 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19722 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
19723 return (uint64_t)ret_conv;
19726 void __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
19727 if ((this_ptr & 1) != 0) return;
19728 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
19729 CHECK_ACCESS(this_ptr_ptr);
19730 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
19731 FREE((void*)this_ptr);
19732 SpendableOutputDescriptor_free(this_ptr_conv);
19735 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
19736 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
19737 *ret_copy = SpendableOutputDescriptor_clone(arg);
19738 uint64_t ret_ref = (uint64_t)ret_copy;
19741 int64_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_clone_ptr(uint32_t arg) {
19742 LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)arg;
19743 int64_t ret_val = SpendableOutputDescriptor_clone_ptr(arg_conv);
19747 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
19748 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
19749 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
19750 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
19751 uint64_t ret_ref = (uint64_t)ret_copy;
19755 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_output(uint32_t outpoint, uint32_t output) {
19756 LDKOutPoint outpoint_conv;
19757 outpoint_conv.inner = (void*)(outpoint & (~1));
19758 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
19759 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
19760 outpoint_conv = OutPoint_clone(&outpoint_conv);
19761 void* output_ptr = (void*)(((uint64_t)output) & ~1);
19762 CHECK_ACCESS(output_ptr);
19763 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
19764 output_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output) & ~1));
19765 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
19766 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
19767 uint64_t ret_ref = (uint64_t)ret_copy;
19771 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint32_t a) {
19772 LDKDelayedPaymentOutputDescriptor a_conv;
19773 a_conv.inner = (void*)(a & (~1));
19774 a_conv.is_owned = (a & 1) || (a == 0);
19775 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19776 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
19777 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
19778 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
19779 uint64_t ret_ref = (uint64_t)ret_copy;
19783 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_payment_output(uint32_t a) {
19784 LDKStaticPaymentOutputDescriptor a_conv;
19785 a_conv.inner = (void*)(a & (~1));
19786 a_conv.is_owned = (a & 1) || (a == 0);
19787 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19788 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
19789 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
19790 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
19791 uint64_t ret_ref = (uint64_t)ret_copy;
19795 int8_tArray __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
19796 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
19797 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
19798 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19799 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19800 CVec_u8Z_free(ret_var);
19804 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
19805 LDKu8slice ser_ref;
19806 ser_ref.datalen = *((uint32_t*)ser);
19807 ser_ref.data = (int8_t*)(ser + 4);
19808 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19809 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
19810 return (uint64_t)ret_conv;
19813 void __attribute__((visibility("default"))) TS_BaseSign_free(uint32_t this_ptr) {
19814 if ((this_ptr & 1) != 0) return;
19815 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
19816 CHECK_ACCESS(this_ptr_ptr);
19817 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
19818 FREE((void*)this_ptr);
19819 BaseSign_free(this_ptr_conv);
19822 static inline uint64_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
19823 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
19824 *ret_ret = Sign_clone(arg);
19825 return (uint64_t)ret_ret;
19827 int64_t __attribute__((visibility("default"))) TS_Sign_clone_ptr(uint32_t arg) {
19828 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
19829 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
19830 LDKSign* arg_conv = (LDKSign*)arg_ptr;
19831 int64_t ret_val = Sign_clone_ptr(arg_conv);
19835 uint32_t __attribute__((visibility("default"))) TS_Sign_clone(uint32_t orig) {
19836 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
19837 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
19838 LDKSign* orig_conv = (LDKSign*)orig_ptr;
19839 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
19840 *ret_ret = Sign_clone(orig_conv);
19841 return (uint64_t)ret_ret;
19844 void __attribute__((visibility("default"))) TS_Sign_free(uint32_t this_ptr) {
19845 if ((this_ptr & 1) != 0) return;
19846 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
19847 CHECK_ACCESS(this_ptr_ptr);
19848 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
19849 FREE((void*)this_ptr);
19850 Sign_free(this_ptr_conv);
19853 void __attribute__((visibility("default"))) TS_KeysInterface_free(uint32_t this_ptr) {
19854 if ((this_ptr & 1) != 0) return;
19855 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
19856 CHECK_ACCESS(this_ptr_ptr);
19857 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
19858 FREE((void*)this_ptr);
19859 KeysInterface_free(this_ptr_conv);
19862 void __attribute__((visibility("default"))) TS_InMemorySigner_free(uint32_t this_obj) {
19863 LDKInMemorySigner this_obj_conv;
19864 this_obj_conv.inner = (void*)(this_obj & (~1));
19865 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19866 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19867 InMemorySigner_free(this_obj_conv);
19870 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
19871 LDKInMemorySigner this_ptr_conv;
19872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19873 this_ptr_conv.is_owned = false;
19874 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19875 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19876 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
19880 void __attribute__((visibility("default"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
19881 LDKInMemorySigner this_ptr_conv;
19882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19883 this_ptr_conv.is_owned = false;
19884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19885 LDKSecretKey val_ref;
19886 CHECK(*((uint32_t*)val) == 32);
19887 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
19888 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
19891 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
19892 LDKInMemorySigner this_ptr_conv;
19893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19894 this_ptr_conv.is_owned = false;
19895 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19896 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19897 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
19901 void __attribute__((visibility("default"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
19902 LDKInMemorySigner this_ptr_conv;
19903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19904 this_ptr_conv.is_owned = false;
19905 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19906 LDKSecretKey val_ref;
19907 CHECK(*((uint32_t*)val) == 32);
19908 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
19909 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
19912 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
19913 LDKInMemorySigner this_ptr_conv;
19914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19915 this_ptr_conv.is_owned = false;
19916 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19917 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19918 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
19922 void __attribute__((visibility("default"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
19923 LDKInMemorySigner this_ptr_conv;
19924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19925 this_ptr_conv.is_owned = false;
19926 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19927 LDKSecretKey val_ref;
19928 CHECK(*((uint32_t*)val) == 32);
19929 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
19930 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
19933 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
19934 LDKInMemorySigner this_ptr_conv;
19935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19936 this_ptr_conv.is_owned = false;
19937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19938 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19939 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
19943 void __attribute__((visibility("default"))) TS_InMemorySigner_set_delayed_payment_base_key(uint32_t this_ptr, int8_tArray val) {
19944 LDKInMemorySigner this_ptr_conv;
19945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19946 this_ptr_conv.is_owned = false;
19947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19948 LDKSecretKey val_ref;
19949 CHECK(*((uint32_t*)val) == 32);
19950 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
19951 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
19954 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
19955 LDKInMemorySigner this_ptr_conv;
19956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19957 this_ptr_conv.is_owned = false;
19958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19959 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19960 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
19964 void __attribute__((visibility("default"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
19965 LDKInMemorySigner this_ptr_conv;
19966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19967 this_ptr_conv.is_owned = false;
19968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19969 LDKSecretKey val_ref;
19970 CHECK(*((uint32_t*)val) == 32);
19971 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
19972 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
19975 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
19976 LDKInMemorySigner this_ptr_conv;
19977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19978 this_ptr_conv.is_owned = false;
19979 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19980 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19981 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
19985 void __attribute__((visibility("default"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
19986 LDKInMemorySigner this_ptr_conv;
19987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19988 this_ptr_conv.is_owned = false;
19989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19990 LDKThirtyTwoBytes val_ref;
19991 CHECK(*((uint32_t*)val) == 32);
19992 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19993 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
19996 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
19997 LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
19998 uint64_t ret_ref = 0;
19999 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20000 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20001 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20002 ret_ref = (uint64_t)ret_var.inner;
20003 if (ret_var.is_owned) {
20008 int64_t __attribute__((visibility("default"))) TS_InMemorySigner_clone_ptr(uint32_t arg) {
20009 LDKInMemorySigner arg_conv;
20010 arg_conv.inner = (void*)(arg & (~1));
20011 arg_conv.is_owned = false;
20012 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20013 int64_t ret_val = InMemorySigner_clone_ptr(&arg_conv);
20017 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_clone(uint32_t orig) {
20018 LDKInMemorySigner orig_conv;
20019 orig_conv.inner = (void*)(orig & (~1));
20020 orig_conv.is_owned = false;
20021 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20022 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
20023 uint64_t ret_ref = 0;
20024 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20025 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20026 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20027 ret_ref = (uint64_t)ret_var.inner;
20028 if (ret_var.is_owned) {
20034 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) {
20035 LDKSecretKey funding_key_ref;
20036 CHECK(*((uint32_t*)funding_key) == 32);
20037 memcpy(funding_key_ref.bytes, (uint8_t*)(funding_key + 4), 32);
20038 LDKSecretKey revocation_base_key_ref;
20039 CHECK(*((uint32_t*)revocation_base_key) == 32);
20040 memcpy(revocation_base_key_ref.bytes, (uint8_t*)(revocation_base_key + 4), 32);
20041 LDKSecretKey payment_key_ref;
20042 CHECK(*((uint32_t*)payment_key) == 32);
20043 memcpy(payment_key_ref.bytes, (uint8_t*)(payment_key + 4), 32);
20044 LDKSecretKey delayed_payment_base_key_ref;
20045 CHECK(*((uint32_t*)delayed_payment_base_key) == 32);
20046 memcpy(delayed_payment_base_key_ref.bytes, (uint8_t*)(delayed_payment_base_key + 4), 32);
20047 LDKSecretKey htlc_base_key_ref;
20048 CHECK(*((uint32_t*)htlc_base_key) == 32);
20049 memcpy(htlc_base_key_ref.bytes, (uint8_t*)(htlc_base_key + 4), 32);
20050 LDKThirtyTwoBytes commitment_seed_ref;
20051 CHECK(*((uint32_t*)commitment_seed) == 32);
20052 memcpy(commitment_seed_ref.data, (uint8_t*)(commitment_seed + 4), 32);
20053 LDKThirtyTwoBytes channel_keys_id_ref;
20054 CHECK(*((uint32_t*)channel_keys_id) == 32);
20055 memcpy(channel_keys_id_ref.data, (uint8_t*)(channel_keys_id + 4), 32);
20056 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);
20057 uint64_t ret_ref = 0;
20058 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20059 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20060 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20061 ret_ref = (uint64_t)ret_var.inner;
20062 if (ret_var.is_owned) {
20068 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
20069 LDKInMemorySigner this_arg_conv;
20070 this_arg_conv.inner = (void*)(this_arg & (~1));
20071 this_arg_conv.is_owned = false;
20072 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20073 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
20074 uint64_t ret_ref = 0;
20075 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20076 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20077 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20078 ret_ref = (uint64_t)ret_var.inner;
20079 if (ret_var.is_owned) {
20085 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
20086 LDKInMemorySigner this_arg_conv;
20087 this_arg_conv.inner = (void*)(this_arg & (~1));
20088 this_arg_conv.is_owned = false;
20089 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20090 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
20094 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
20095 LDKInMemorySigner this_arg_conv;
20096 this_arg_conv.inner = (void*)(this_arg & (~1));
20097 this_arg_conv.is_owned = false;
20098 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20099 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
20103 jboolean __attribute__((visibility("default"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
20104 LDKInMemorySigner this_arg_conv;
20105 this_arg_conv.inner = (void*)(this_arg & (~1));
20106 this_arg_conv.is_owned = false;
20107 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20108 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
20112 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
20113 LDKInMemorySigner this_arg_conv;
20114 this_arg_conv.inner = (void*)(this_arg & (~1));
20115 this_arg_conv.is_owned = false;
20116 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20117 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
20118 uint64_t ret_ref = 0;
20119 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20120 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20121 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20122 ret_ref = (uint64_t)ret_var.inner;
20123 if (ret_var.is_owned) {
20129 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
20130 LDKInMemorySigner this_arg_conv;
20131 this_arg_conv.inner = (void*)(this_arg & (~1));
20132 this_arg_conv.is_owned = false;
20133 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20134 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
20135 uint64_t ret_ref = 0;
20136 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20137 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20138 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20139 ret_ref = (uint64_t)ret_var.inner;
20140 if (ret_var.is_owned) {
20146 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) {
20147 LDKInMemorySigner this_arg_conv;
20148 this_arg_conv.inner = (void*)(this_arg & (~1));
20149 this_arg_conv.is_owned = false;
20150 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20151 LDKTransaction spend_tx_ref;
20152 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
20153 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
20154 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
20155 spend_tx_ref.data_is_owned = true;
20156 LDKStaticPaymentOutputDescriptor descriptor_conv;
20157 descriptor_conv.inner = (void*)(descriptor & (~1));
20158 descriptor_conv.is_owned = false;
20159 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
20160 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20161 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
20162 return (uint64_t)ret_conv;
20165 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) {
20166 LDKInMemorySigner this_arg_conv;
20167 this_arg_conv.inner = (void*)(this_arg & (~1));
20168 this_arg_conv.is_owned = false;
20169 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20170 LDKTransaction spend_tx_ref;
20171 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
20172 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
20173 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
20174 spend_tx_ref.data_is_owned = true;
20175 LDKDelayedPaymentOutputDescriptor descriptor_conv;
20176 descriptor_conv.inner = (void*)(descriptor & (~1));
20177 descriptor_conv.is_owned = false;
20178 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
20179 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20180 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
20181 return (uint64_t)ret_conv;
20184 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_BaseSign(uint32_t this_arg) {
20185 LDKInMemorySigner this_arg_conv;
20186 this_arg_conv.inner = (void*)(this_arg & (~1));
20187 this_arg_conv.is_owned = false;
20188 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20189 LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
20190 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
20191 return (uint64_t)ret_ret;
20194 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
20195 LDKInMemorySigner this_arg_conv;
20196 this_arg_conv.inner = (void*)(this_arg & (~1));
20197 this_arg_conv.is_owned = false;
20198 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20199 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
20200 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
20201 return (uint64_t)ret_ret;
20204 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_write(uint32_t obj) {
20205 LDKInMemorySigner obj_conv;
20206 obj_conv.inner = (void*)(obj & (~1));
20207 obj_conv.is_owned = false;
20208 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
20209 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
20210 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20211 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20212 CVec_u8Z_free(ret_var);
20216 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_read(int8_tArray ser) {
20217 LDKu8slice ser_ref;
20218 ser_ref.datalen = *((uint32_t*)ser);
20219 ser_ref.data = (int8_t*)(ser + 4);
20220 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20221 *ret_conv = InMemorySigner_read(ser_ref);
20222 return (uint64_t)ret_conv;
20225 void __attribute__((visibility("default"))) TS_KeysManager_free(uint32_t this_obj) {
20226 LDKKeysManager this_obj_conv;
20227 this_obj_conv.inner = (void*)(this_obj & (~1));
20228 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20229 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20230 KeysManager_free(this_obj_conv);
20233 uint32_t __attribute__((visibility("default"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
20234 unsigned char seed_arr[32];
20235 CHECK(*((uint32_t*)seed) == 32);
20236 memcpy(seed_arr, (uint8_t*)(seed + 4), 32);
20237 unsigned char (*seed_ref)[32] = &seed_arr;
20238 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
20239 uint64_t ret_ref = 0;
20240 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20241 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20242 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20243 ret_ref = (uint64_t)ret_var.inner;
20244 if (ret_var.is_owned) {
20250 uint32_t __attribute__((visibility("default"))) TS_KeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
20251 LDKKeysManager this_arg_conv;
20252 this_arg_conv.inner = (void*)(this_arg & (~1));
20253 this_arg_conv.is_owned = false;
20254 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20255 unsigned char params_arr[32];
20256 CHECK(*((uint32_t*)params) == 32);
20257 memcpy(params_arr, (uint8_t*)(params + 4), 32);
20258 unsigned char (*params_ref)[32] = ¶ms_arr;
20259 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
20260 uint64_t ret_ref = 0;
20261 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20262 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20263 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20264 ret_ref = (uint64_t)ret_var.inner;
20265 if (ret_var.is_owned) {
20271 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) {
20272 LDKKeysManager this_arg_conv;
20273 this_arg_conv.inner = (void*)(this_arg & (~1));
20274 this_arg_conv.is_owned = false;
20275 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20276 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
20277 descriptors_constr.datalen = *((uint32_t*)descriptors);
20278 if (descriptors_constr.datalen > 0)
20279 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
20281 descriptors_constr.data = NULL;
20282 uint32_t* descriptors_vals = (uint32_t*)(descriptors + 4);
20283 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
20284 uint32_t descriptors_conv_27 = descriptors_vals[b];
20285 void* descriptors_conv_27_ptr = (void*)(((uint64_t)descriptors_conv_27) & ~1);
20286 CHECK_ACCESS(descriptors_conv_27_ptr);
20287 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
20288 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
20289 descriptors_constr.data[b] = descriptors_conv_27_conv;
20291 LDKCVec_TxOutZ outputs_constr;
20292 outputs_constr.datalen = *((uint32_t*)outputs);
20293 if (outputs_constr.datalen > 0)
20294 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
20296 outputs_constr.data = NULL;
20297 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
20298 for (size_t h = 0; h < outputs_constr.datalen; h++) {
20299 uint32_t outputs_conv_7 = outputs_vals[h];
20300 void* outputs_conv_7_ptr = (void*)(((uint64_t)outputs_conv_7) & ~1);
20301 CHECK_ACCESS(outputs_conv_7_ptr);
20302 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
20303 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
20304 outputs_constr.data[h] = outputs_conv_7_conv;
20306 LDKCVec_u8Z change_destination_script_ref;
20307 change_destination_script_ref.datalen = *((uint32_t*)change_destination_script);
20308 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
20309 memcpy(change_destination_script_ref.data, (uint8_t*)(change_destination_script + 4), change_destination_script_ref.datalen);
20310 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20311 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
20312 return (uint64_t)ret_conv;
20315 uint32_t __attribute__((visibility("default"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
20316 LDKKeysManager this_arg_conv;
20317 this_arg_conv.inner = (void*)(this_arg & (~1));
20318 this_arg_conv.is_owned = false;
20319 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20320 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
20321 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
20322 return (uint64_t)ret_ret;
20325 void __attribute__((visibility("default"))) TS_ChannelManager_free(uint32_t this_obj) {
20326 LDKChannelManager this_obj_conv;
20327 this_obj_conv.inner = (void*)(this_obj & (~1));
20328 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20329 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20330 ChannelManager_free(this_obj_conv);
20333 void __attribute__((visibility("default"))) TS_ChainParameters_free(uint32_t this_obj) {
20334 LDKChainParameters this_obj_conv;
20335 this_obj_conv.inner = (void*)(this_obj & (~1));
20336 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20337 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20338 ChainParameters_free(this_obj_conv);
20341 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
20342 LDKChainParameters this_ptr_conv;
20343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20344 this_ptr_conv.is_owned = false;
20345 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20346 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
20350 void __attribute__((visibility("default"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
20351 LDKChainParameters this_ptr_conv;
20352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20353 this_ptr_conv.is_owned = false;
20354 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20355 LDKNetwork val_conv = LDKNetwork_from_js(val);
20356 ChainParameters_set_network(&this_ptr_conv, val_conv);
20359 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_best_block(uint32_t this_ptr) {
20360 LDKChainParameters this_ptr_conv;
20361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20362 this_ptr_conv.is_owned = false;
20363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20364 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
20365 uint64_t ret_ref = 0;
20366 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20367 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20368 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20369 ret_ref = (uint64_t)ret_var.inner;
20370 if (ret_var.is_owned) {
20376 void __attribute__((visibility("default"))) TS_ChainParameters_set_best_block(uint32_t this_ptr, uint32_t val) {
20377 LDKChainParameters this_ptr_conv;
20378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20379 this_ptr_conv.is_owned = false;
20380 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20381 LDKBestBlock val_conv;
20382 val_conv.inner = (void*)(val & (~1));
20383 val_conv.is_owned = (val & 1) || (val == 0);
20384 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20385 val_conv = BestBlock_clone(&val_conv);
20386 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
20389 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_new(uint32_t network_arg, uint32_t best_block_arg) {
20390 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
20391 LDKBestBlock best_block_arg_conv;
20392 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
20393 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
20394 CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
20395 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
20396 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
20397 uint64_t ret_ref = 0;
20398 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20399 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20400 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20401 ret_ref = (uint64_t)ret_var.inner;
20402 if (ret_var.is_owned) {
20408 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
20409 LDKChainParameters ret_var = ChainParameters_clone(arg);
20410 uint64_t ret_ref = 0;
20411 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20412 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20413 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20414 ret_ref = (uint64_t)ret_var.inner;
20415 if (ret_var.is_owned) {
20420 int64_t __attribute__((visibility("default"))) TS_ChainParameters_clone_ptr(uint32_t arg) {
20421 LDKChainParameters arg_conv;
20422 arg_conv.inner = (void*)(arg & (~1));
20423 arg_conv.is_owned = false;
20424 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20425 int64_t ret_val = ChainParameters_clone_ptr(&arg_conv);
20429 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_clone(uint32_t orig) {
20430 LDKChainParameters orig_conv;
20431 orig_conv.inner = (void*)(orig & (~1));
20432 orig_conv.is_owned = false;
20433 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20434 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
20435 uint64_t ret_ref = 0;
20436 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20437 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20438 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20439 ret_ref = (uint64_t)ret_var.inner;
20440 if (ret_var.is_owned) {
20446 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_free(uint32_t this_obj) {
20447 LDKCounterpartyForwardingInfo this_obj_conv;
20448 this_obj_conv.inner = (void*)(this_obj & (~1));
20449 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20450 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20451 CounterpartyForwardingInfo_free(this_obj_conv);
20454 int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint32_t this_ptr) {
20455 LDKCounterpartyForwardingInfo this_ptr_conv;
20456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20457 this_ptr_conv.is_owned = false;
20458 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20459 int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
20463 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
20464 LDKCounterpartyForwardingInfo this_ptr_conv;
20465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20466 this_ptr_conv.is_owned = false;
20467 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20468 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
20471 int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint32_t this_ptr) {
20472 LDKCounterpartyForwardingInfo this_ptr_conv;
20473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20474 this_ptr_conv.is_owned = false;
20475 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20476 int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
20480 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
20481 LDKCounterpartyForwardingInfo this_ptr_conv;
20482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20483 this_ptr_conv.is_owned = false;
20484 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20485 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
20488 int16_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
20489 LDKCounterpartyForwardingInfo this_ptr_conv;
20490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20491 this_ptr_conv.is_owned = false;
20492 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20493 int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
20497 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
20498 LDKCounterpartyForwardingInfo this_ptr_conv;
20499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20500 this_ptr_conv.is_owned = false;
20501 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20502 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
20505 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) {
20506 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
20507 uint64_t ret_ref = 0;
20508 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20509 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20510 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20511 ret_ref = (uint64_t)ret_var.inner;
20512 if (ret_var.is_owned) {
20518 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
20519 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
20520 uint64_t ret_ref = 0;
20521 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20522 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20523 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20524 ret_ref = (uint64_t)ret_var.inner;
20525 if (ret_var.is_owned) {
20530 int64_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_clone_ptr(uint32_t arg) {
20531 LDKCounterpartyForwardingInfo arg_conv;
20532 arg_conv.inner = (void*)(arg & (~1));
20533 arg_conv.is_owned = false;
20534 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20535 int64_t ret_val = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
20539 uint32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_clone(uint32_t orig) {
20540 LDKCounterpartyForwardingInfo orig_conv;
20541 orig_conv.inner = (void*)(orig & (~1));
20542 orig_conv.is_owned = false;
20543 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20544 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
20545 uint64_t ret_ref = 0;
20546 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20547 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20548 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20549 ret_ref = (uint64_t)ret_var.inner;
20550 if (ret_var.is_owned) {
20556 void __attribute__((visibility("default"))) TS_ChannelCounterparty_free(uint32_t this_obj) {
20557 LDKChannelCounterparty this_obj_conv;
20558 this_obj_conv.inner = (void*)(this_obj & (~1));
20559 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20560 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20561 ChannelCounterparty_free(this_obj_conv);
20564 int8_tArray __attribute__((visibility("default"))) TS_ChannelCounterparty_get_node_id(uint32_t this_ptr) {
20565 LDKChannelCounterparty this_ptr_conv;
20566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20567 this_ptr_conv.is_owned = false;
20568 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20569 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
20570 memcpy((uint8_t*)(ret_arr + 4), ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
20574 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_node_id(uint32_t this_ptr, int8_tArray val) {
20575 LDKChannelCounterparty this_ptr_conv;
20576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20577 this_ptr_conv.is_owned = false;
20578 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20579 LDKPublicKey val_ref;
20580 CHECK(*((uint32_t*)val) == 33);
20581 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
20582 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
20585 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_features(uint32_t this_ptr) {
20586 LDKChannelCounterparty this_ptr_conv;
20587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20588 this_ptr_conv.is_owned = false;
20589 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20590 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
20591 uint64_t ret_ref = 0;
20592 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20593 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20594 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20595 ret_ref = (uint64_t)ret_var.inner;
20596 if (ret_var.is_owned) {
20602 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_features(uint32_t this_ptr, uint32_t val) {
20603 LDKChannelCounterparty this_ptr_conv;
20604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20605 this_ptr_conv.is_owned = false;
20606 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20607 LDKInitFeatures val_conv;
20608 val_conv.inner = (void*)(val & (~1));
20609 val_conv.is_owned = (val & 1) || (val == 0);
20610 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20611 val_conv = InitFeatures_clone(&val_conv);
20612 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
20615 int64_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint32_t this_ptr) {
20616 LDKChannelCounterparty this_ptr_conv;
20617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20618 this_ptr_conv.is_owned = false;
20619 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20620 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
20624 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint32_t this_ptr, int64_t val) {
20625 LDKChannelCounterparty this_ptr_conv;
20626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20627 this_ptr_conv.is_owned = false;
20628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20629 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
20632 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_forwarding_info(uint32_t this_ptr) {
20633 LDKChannelCounterparty this_ptr_conv;
20634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20635 this_ptr_conv.is_owned = false;
20636 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20637 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
20638 uint64_t ret_ref = 0;
20639 if ((uint64_t)ret_var.inner > 4096) {
20640 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20641 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20642 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20643 ret_ref = (uint64_t)ret_var.inner;
20644 if (ret_var.is_owned) {
20651 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_forwarding_info(uint32_t this_ptr, uint32_t val) {
20652 LDKChannelCounterparty this_ptr_conv;
20653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20654 this_ptr_conv.is_owned = false;
20655 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20656 LDKCounterpartyForwardingInfo val_conv;
20657 val_conv.inner = (void*)(val & (~1));
20658 val_conv.is_owned = (val & 1) || (val == 0);
20659 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20660 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
20661 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
20664 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) {
20665 LDKPublicKey node_id_arg_ref;
20666 CHECK(*((uint32_t*)node_id_arg) == 33);
20667 memcpy(node_id_arg_ref.compressed_form, (uint8_t*)(node_id_arg + 4), 33);
20668 LDKInitFeatures features_arg_conv;
20669 features_arg_conv.inner = (void*)(features_arg & (~1));
20670 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
20671 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
20672 features_arg_conv = InitFeatures_clone(&features_arg_conv);
20673 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
20674 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
20675 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
20676 CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
20677 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
20678 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
20679 uint64_t ret_ref = 0;
20680 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20681 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20682 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20683 ret_ref = (uint64_t)ret_var.inner;
20684 if (ret_var.is_owned) {
20690 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
20691 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
20692 uint64_t ret_ref = 0;
20693 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20694 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20695 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20696 ret_ref = (uint64_t)ret_var.inner;
20697 if (ret_var.is_owned) {
20702 int64_t __attribute__((visibility("default"))) TS_ChannelCounterparty_clone_ptr(uint32_t arg) {
20703 LDKChannelCounterparty arg_conv;
20704 arg_conv.inner = (void*)(arg & (~1));
20705 arg_conv.is_owned = false;
20706 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20707 int64_t ret_val = ChannelCounterparty_clone_ptr(&arg_conv);
20711 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_clone(uint32_t orig) {
20712 LDKChannelCounterparty orig_conv;
20713 orig_conv.inner = (void*)(orig & (~1));
20714 orig_conv.is_owned = false;
20715 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20716 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
20717 uint64_t ret_ref = 0;
20718 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20719 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20720 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20721 ret_ref = (uint64_t)ret_var.inner;
20722 if (ret_var.is_owned) {
20728 void __attribute__((visibility("default"))) TS_ChannelDetails_free(uint32_t this_obj) {
20729 LDKChannelDetails this_obj_conv;
20730 this_obj_conv.inner = (void*)(this_obj & (~1));
20731 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20732 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20733 ChannelDetails_free(this_obj_conv);
20736 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
20737 LDKChannelDetails this_ptr_conv;
20738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20739 this_ptr_conv.is_owned = false;
20740 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20741 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20742 memcpy((uint8_t*)(ret_arr + 4), *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
20746 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
20747 LDKChannelDetails this_ptr_conv;
20748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20749 this_ptr_conv.is_owned = false;
20750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20751 LDKThirtyTwoBytes val_ref;
20752 CHECK(*((uint32_t*)val) == 32);
20753 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20754 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
20757 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_counterparty(uint32_t this_ptr) {
20758 LDKChannelDetails this_ptr_conv;
20759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20760 this_ptr_conv.is_owned = false;
20761 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20762 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
20763 uint64_t ret_ref = 0;
20764 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20765 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20766 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20767 ret_ref = (uint64_t)ret_var.inner;
20768 if (ret_var.is_owned) {
20774 void __attribute__((visibility("default"))) TS_ChannelDetails_set_counterparty(uint32_t this_ptr, uint32_t val) {
20775 LDKChannelDetails this_ptr_conv;
20776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20777 this_ptr_conv.is_owned = false;
20778 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20779 LDKChannelCounterparty val_conv;
20780 val_conv.inner = (void*)(val & (~1));
20781 val_conv.is_owned = (val & 1) || (val == 0);
20782 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20783 val_conv = ChannelCounterparty_clone(&val_conv);
20784 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
20787 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_funding_txo(uint32_t this_ptr) {
20788 LDKChannelDetails this_ptr_conv;
20789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20790 this_ptr_conv.is_owned = false;
20791 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20792 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
20793 uint64_t ret_ref = 0;
20794 if ((uint64_t)ret_var.inner > 4096) {
20795 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20796 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20797 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20798 ret_ref = (uint64_t)ret_var.inner;
20799 if (ret_var.is_owned) {
20806 void __attribute__((visibility("default"))) TS_ChannelDetails_set_funding_txo(uint32_t this_ptr, uint32_t val) {
20807 LDKChannelDetails this_ptr_conv;
20808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20809 this_ptr_conv.is_owned = false;
20810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20811 LDKOutPoint val_conv;
20812 val_conv.inner = (void*)(val & (~1));
20813 val_conv.is_owned = (val & 1) || (val == 0);
20814 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20815 val_conv = OutPoint_clone(&val_conv);
20816 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
20819 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_short_channel_id(uint32_t this_ptr) {
20820 LDKChannelDetails this_ptr_conv;
20821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20822 this_ptr_conv.is_owned = false;
20823 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20824 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
20825 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
20826 uint64_t ret_ref = (uint64_t)ret_copy;
20830 void __attribute__((visibility("default"))) TS_ChannelDetails_set_short_channel_id(uint32_t this_ptr, uint32_t val) {
20831 LDKChannelDetails this_ptr_conv;
20832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20833 this_ptr_conv.is_owned = false;
20834 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20835 void* val_ptr = (void*)(((uint64_t)val) & ~1);
20836 CHECK_ACCESS(val_ptr);
20837 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
20838 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
20839 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
20842 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
20843 LDKChannelDetails this_ptr_conv;
20844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20845 this_ptr_conv.is_owned = false;
20846 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20847 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
20851 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
20852 LDKChannelDetails this_ptr_conv;
20853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20854 this_ptr_conv.is_owned = false;
20855 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20856 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
20859 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint32_t this_ptr) {
20860 LDKChannelDetails this_ptr_conv;
20861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20862 this_ptr_conv.is_owned = false;
20863 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20864 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
20865 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
20866 uint64_t ret_ref = (uint64_t)ret_copy;
20870 void __attribute__((visibility("default"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint32_t this_ptr, uint32_t val) {
20871 LDKChannelDetails this_ptr_conv;
20872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20873 this_ptr_conv.is_owned = false;
20874 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20875 void* val_ptr = (void*)(((uint64_t)val) & ~1);
20876 CHECK_ACCESS(val_ptr);
20877 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
20878 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
20879 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
20882 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_user_channel_id(uint32_t this_ptr) {
20883 LDKChannelDetails this_ptr_conv;
20884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20885 this_ptr_conv.is_owned = false;
20886 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20887 int64_t ret_val = ChannelDetails_get_user_channel_id(&this_ptr_conv);
20891 void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_channel_id(uint32_t this_ptr, int64_t val) {
20892 LDKChannelDetails this_ptr_conv;
20893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20894 this_ptr_conv.is_owned = false;
20895 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20896 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
20899 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
20900 LDKChannelDetails this_ptr_conv;
20901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20902 this_ptr_conv.is_owned = false;
20903 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20904 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
20908 void __attribute__((visibility("default"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
20909 LDKChannelDetails this_ptr_conv;
20910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20911 this_ptr_conv.is_owned = false;
20912 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20913 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
20916 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
20917 LDKChannelDetails this_ptr_conv;
20918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20919 this_ptr_conv.is_owned = false;
20920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20921 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
20925 void __attribute__((visibility("default"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
20926 LDKChannelDetails this_ptr_conv;
20927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20928 this_ptr_conv.is_owned = false;
20929 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20930 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
20933 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_confirmations_required(uint32_t this_ptr) {
20934 LDKChannelDetails this_ptr_conv;
20935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20936 this_ptr_conv.is_owned = false;
20937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20938 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
20939 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
20940 uint64_t ret_ref = (uint64_t)ret_copy;
20944 void __attribute__((visibility("default"))) TS_ChannelDetails_set_confirmations_required(uint32_t this_ptr, uint32_t val) {
20945 LDKChannelDetails this_ptr_conv;
20946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20947 this_ptr_conv.is_owned = false;
20948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20949 void* val_ptr = (void*)(((uint64_t)val) & ~1);
20950 CHECK_ACCESS(val_ptr);
20951 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
20952 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
20953 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
20956 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_force_close_spend_delay(uint32_t this_ptr) {
20957 LDKChannelDetails this_ptr_conv;
20958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20959 this_ptr_conv.is_owned = false;
20960 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20961 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20962 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
20963 uint64_t ret_ref = (uint64_t)ret_copy;
20967 void __attribute__((visibility("default"))) TS_ChannelDetails_set_force_close_spend_delay(uint32_t this_ptr, uint32_t val) {
20968 LDKChannelDetails this_ptr_conv;
20969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20970 this_ptr_conv.is_owned = false;
20971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20972 void* val_ptr = (void*)(((uint64_t)val) & ~1);
20973 CHECK_ACCESS(val_ptr);
20974 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
20975 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)val) & ~1));
20976 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
20979 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_outbound(uint32_t this_ptr) {
20980 LDKChannelDetails this_ptr_conv;
20981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20982 this_ptr_conv.is_owned = false;
20983 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20984 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
20988 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_outbound(uint32_t this_ptr, jboolean val) {
20989 LDKChannelDetails this_ptr_conv;
20990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20991 this_ptr_conv.is_owned = false;
20992 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20993 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
20996 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_funding_locked(uint32_t this_ptr) {
20997 LDKChannelDetails this_ptr_conv;
20998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20999 this_ptr_conv.is_owned = false;
21000 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21001 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
21005 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_funding_locked(uint32_t this_ptr, jboolean val) {
21006 LDKChannelDetails this_ptr_conv;
21007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21008 this_ptr_conv.is_owned = false;
21009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21010 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
21013 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_usable(uint32_t this_ptr) {
21014 LDKChannelDetails this_ptr_conv;
21015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21016 this_ptr_conv.is_owned = false;
21017 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21018 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
21022 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_usable(uint32_t this_ptr, jboolean val) {
21023 LDKChannelDetails this_ptr_conv;
21024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21025 this_ptr_conv.is_owned = false;
21026 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21027 ChannelDetails_set_is_usable(&this_ptr_conv, val);
21030 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_public(uint32_t this_ptr) {
21031 LDKChannelDetails this_ptr_conv;
21032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21033 this_ptr_conv.is_owned = false;
21034 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21035 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
21039 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_public(uint32_t this_ptr, jboolean val) {
21040 LDKChannelDetails this_ptr_conv;
21041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21042 this_ptr_conv.is_owned = false;
21043 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21044 ChannelDetails_set_is_public(&this_ptr_conv, val);
21047 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) {
21048 LDKThirtyTwoBytes channel_id_arg_ref;
21049 CHECK(*((uint32_t*)channel_id_arg) == 32);
21050 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
21051 LDKChannelCounterparty counterparty_arg_conv;
21052 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
21053 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
21054 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
21055 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
21056 LDKOutPoint funding_txo_arg_conv;
21057 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
21058 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
21059 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
21060 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
21061 void* short_channel_id_arg_ptr = (void*)(((uint64_t)short_channel_id_arg) & ~1);
21062 CHECK_ACCESS(short_channel_id_arg_ptr);
21063 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
21064 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1));
21065 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
21066 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
21067 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
21068 void* confirmations_required_arg_ptr = (void*)(((uint64_t)confirmations_required_arg) & ~1);
21069 CHECK_ACCESS(confirmations_required_arg_ptr);
21070 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
21071 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1));
21072 void* force_close_spend_delay_arg_ptr = (void*)(((uint64_t)force_close_spend_delay_arg) & ~1);
21073 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
21074 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
21075 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1));
21076 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);
21077 uint64_t ret_ref = 0;
21078 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21079 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21080 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21081 ret_ref = (uint64_t)ret_var.inner;
21082 if (ret_var.is_owned) {
21088 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
21089 LDKChannelDetails ret_var = ChannelDetails_clone(arg);
21090 uint64_t ret_ref = 0;
21091 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21092 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21093 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21094 ret_ref = (uint64_t)ret_var.inner;
21095 if (ret_var.is_owned) {
21100 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_clone_ptr(uint32_t arg) {
21101 LDKChannelDetails arg_conv;
21102 arg_conv.inner = (void*)(arg & (~1));
21103 arg_conv.is_owned = false;
21104 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21105 int64_t ret_val = ChannelDetails_clone_ptr(&arg_conv);
21109 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_clone(uint32_t orig) {
21110 LDKChannelDetails orig_conv;
21111 orig_conv.inner = (void*)(orig & (~1));
21112 orig_conv.is_owned = false;
21113 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21114 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
21115 uint64_t ret_ref = 0;
21116 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21117 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21118 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21119 ret_ref = (uint64_t)ret_var.inner;
21120 if (ret_var.is_owned) {
21126 void __attribute__((visibility("default"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
21127 if ((this_ptr & 1) != 0) return;
21128 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
21129 CHECK_ACCESS(this_ptr_ptr);
21130 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
21131 FREE((void*)this_ptr);
21132 PaymentSendFailure_free(this_ptr_conv);
21135 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
21136 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21137 *ret_copy = PaymentSendFailure_clone(arg);
21138 uint64_t ret_ref = (uint64_t)ret_copy;
21141 int64_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone_ptr(uint32_t arg) {
21142 LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)arg;
21143 int64_t ret_val = PaymentSendFailure_clone_ptr(arg_conv);
21147 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone(uint32_t orig) {
21148 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
21149 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21150 *ret_copy = PaymentSendFailure_clone(orig_conv);
21151 uint64_t ret_ref = (uint64_t)ret_copy;
21155 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_parameter_error(uint32_t a) {
21156 void* a_ptr = (void*)(((uint64_t)a) & ~1);
21157 CHECK_ACCESS(a_ptr);
21158 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
21159 a_conv = APIError_clone((LDKAPIError*)(((uint64_t)a) & ~1));
21160 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21161 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
21162 uint64_t ret_ref = (uint64_t)ret_copy;
21166 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_path_parameter_error(uint32_tArray a) {
21167 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
21168 a_constr.datalen = *((uint32_t*)a);
21169 if (a_constr.datalen > 0)
21170 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
21172 a_constr.data = NULL;
21173 uint32_t* a_vals = (uint32_t*)(a + 4);
21174 for (size_t w = 0; w < a_constr.datalen; w++) {
21175 uint32_t a_conv_22 = a_vals[w];
21176 void* a_conv_22_ptr = (void*)(((uint64_t)a_conv_22) & ~1);
21177 CHECK_ACCESS(a_conv_22_ptr);
21178 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
21179 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
21180 a_constr.data[w] = a_conv_22_conv;
21182 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21183 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
21184 uint64_t ret_ref = (uint64_t)ret_copy;
21188 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_all_failed_retry_safe(uint32_tArray a) {
21189 LDKCVec_APIErrorZ a_constr;
21190 a_constr.datalen = *((uint32_t*)a);
21191 if (a_constr.datalen > 0)
21192 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
21194 a_constr.data = NULL;
21195 uint32_t* a_vals = (uint32_t*)(a + 4);
21196 for (size_t k = 0; k < a_constr.datalen; k++) {
21197 uint32_t a_conv_10 = a_vals[k];
21198 void* a_conv_10_ptr = (void*)(((uint64_t)a_conv_10) & ~1);
21199 CHECK_ACCESS(a_conv_10_ptr);
21200 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
21201 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uint64_t)a_conv_10) & ~1));
21202 a_constr.data[k] = a_conv_10_conv;
21204 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21205 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
21206 uint64_t ret_ref = (uint64_t)ret_copy;
21210 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_partial_failure(uint32_tArray results, uint32_t failed_paths_retry, int8_tArray payment_id) {
21211 LDKCVec_CResult_NoneAPIErrorZZ results_constr;
21212 results_constr.datalen = *((uint32_t*)results);
21213 if (results_constr.datalen > 0)
21214 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
21216 results_constr.data = NULL;
21217 uint32_t* results_vals = (uint32_t*)(results + 4);
21218 for (size_t w = 0; w < results_constr.datalen; w++) {
21219 uint32_t results_conv_22 = results_vals[w];
21220 void* results_conv_22_ptr = (void*)(((uint64_t)results_conv_22) & ~1);
21221 CHECK_ACCESS(results_conv_22_ptr);
21222 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
21223 results_constr.data[w] = results_conv_22_conv;
21225 LDKRouteParameters failed_paths_retry_conv;
21226 failed_paths_retry_conv.inner = (void*)(failed_paths_retry & (~1));
21227 failed_paths_retry_conv.is_owned = (failed_paths_retry & 1) || (failed_paths_retry == 0);
21228 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
21229 failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
21230 LDKThirtyTwoBytes payment_id_ref;
21231 CHECK(*((uint32_t*)payment_id) == 32);
21232 memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32);
21233 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21234 *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
21235 uint64_t ret_ref = (uint64_t)ret_copy;
21239 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) {
21240 void* fee_est_ptr = (void*)(((uint64_t)fee_est) & ~1);
21241 CHECK_ACCESS(fee_est_ptr);
21242 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
21243 void* chain_monitor_ptr = (void*)(((uint64_t)chain_monitor) & ~1);
21244 CHECK_ACCESS(chain_monitor_ptr);
21245 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
21246 void* tx_broadcaster_ptr = (void*)(((uint64_t)tx_broadcaster) & ~1);
21247 CHECK_ACCESS(tx_broadcaster_ptr);
21248 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
21249 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
21250 CHECK_ACCESS(logger_ptr);
21251 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
21252 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
21253 CHECK_ACCESS(keys_manager_ptr);
21254 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
21255 LDKUserConfig config_conv;
21256 config_conv.inner = (void*)(config & (~1));
21257 config_conv.is_owned = (config & 1) || (config == 0);
21258 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
21259 config_conv = UserConfig_clone(&config_conv);
21260 LDKChainParameters params_conv;
21261 params_conv.inner = (void*)(params & (~1));
21262 params_conv.is_owned = (params & 1) || (params == 0);
21263 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
21264 params_conv = ChainParameters_clone(¶ms_conv);
21265 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
21266 uint64_t ret_ref = 0;
21267 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21268 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21269 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21270 ret_ref = (uint64_t)ret_var.inner;
21271 if (ret_var.is_owned) {
21277 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_get_current_default_configuration(uint32_t this_arg) {
21278 LDKChannelManager this_arg_conv;
21279 this_arg_conv.inner = (void*)(this_arg & (~1));
21280 this_arg_conv.is_owned = false;
21281 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21282 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
21283 uint64_t ret_ref = 0;
21284 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21285 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21286 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21287 ret_ref = (uint64_t)ret_var.inner;
21288 if (ret_var.is_owned) {
21294 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) {
21295 LDKChannelManager this_arg_conv;
21296 this_arg_conv.inner = (void*)(this_arg & (~1));
21297 this_arg_conv.is_owned = false;
21298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21299 LDKPublicKey their_network_key_ref;
21300 CHECK(*((uint32_t*)their_network_key) == 33);
21301 memcpy(their_network_key_ref.compressed_form, (uint8_t*)(their_network_key + 4), 33);
21302 LDKUserConfig override_config_conv;
21303 override_config_conv.inner = (void*)(override_config & (~1));
21304 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
21305 CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
21306 override_config_conv = UserConfig_clone(&override_config_conv);
21307 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
21308 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
21309 return (uint64_t)ret_conv;
21312 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
21313 LDKChannelManager this_arg_conv;
21314 this_arg_conv.inner = (void*)(this_arg & (~1));
21315 this_arg_conv.is_owned = false;
21316 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21317 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
21318 uint32_tArray ret_arr = NULL;
21319 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
21320 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
21321 for (size_t q = 0; q < ret_var.datalen; q++) {
21322 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
21323 uint64_t ret_conv_16_ref = 0;
21324 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21325 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21326 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
21327 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
21328 if (ret_conv_16_var.is_owned) {
21329 ret_conv_16_ref |= 1;
21331 ret_arr_ptr[q] = ret_conv_16_ref;
21334 FREE(ret_var.data);
21338 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
21339 LDKChannelManager this_arg_conv;
21340 this_arg_conv.inner = (void*)(this_arg & (~1));
21341 this_arg_conv.is_owned = false;
21342 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21343 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
21344 uint32_tArray ret_arr = NULL;
21345 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
21346 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
21347 for (size_t q = 0; q < ret_var.datalen; q++) {
21348 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
21349 uint64_t ret_conv_16_ref = 0;
21350 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21351 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21352 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
21353 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
21354 if (ret_conv_16_var.is_owned) {
21355 ret_conv_16_ref |= 1;
21357 ret_arr_ptr[q] = ret_conv_16_ref;
21360 FREE(ret_var.data);
21364 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id) {
21365 LDKChannelManager this_arg_conv;
21366 this_arg_conv.inner = (void*)(this_arg & (~1));
21367 this_arg_conv.is_owned = false;
21368 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21369 unsigned char channel_id_arr[32];
21370 CHECK(*((uint32_t*)channel_id) == 32);
21371 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
21372 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
21373 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21374 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
21375 return (uint64_t)ret_conv;
21378 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) {
21379 LDKChannelManager this_arg_conv;
21380 this_arg_conv.inner = (void*)(this_arg & (~1));
21381 this_arg_conv.is_owned = false;
21382 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21383 unsigned char channel_id_arr[32];
21384 CHECK(*((uint32_t*)channel_id) == 32);
21385 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
21386 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
21387 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21388 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
21389 return (uint64_t)ret_conv;
21392 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
21393 LDKChannelManager this_arg_conv;
21394 this_arg_conv.inner = (void*)(this_arg & (~1));
21395 this_arg_conv.is_owned = false;
21396 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21397 unsigned char channel_id_arr[32];
21398 CHECK(*((uint32_t*)channel_id) == 32);
21399 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
21400 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
21401 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21402 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
21403 return (uint64_t)ret_conv;
21406 void __attribute__((visibility("default"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
21407 LDKChannelManager this_arg_conv;
21408 this_arg_conv.inner = (void*)(this_arg & (~1));
21409 this_arg_conv.is_owned = false;
21410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21411 ChannelManager_force_close_all_channels(&this_arg_conv);
21414 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
21415 LDKChannelManager this_arg_conv;
21416 this_arg_conv.inner = (void*)(this_arg & (~1));
21417 this_arg_conv.is_owned = false;
21418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21419 LDKRoute route_conv;
21420 route_conv.inner = (void*)(route & (~1));
21421 route_conv.is_owned = false;
21422 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
21423 LDKThirtyTwoBytes payment_hash_ref;
21424 CHECK(*((uint32_t*)payment_hash) == 32);
21425 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
21426 LDKThirtyTwoBytes payment_secret_ref;
21427 CHECK(*((uint32_t*)payment_secret) == 32);
21428 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
21429 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
21430 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
21431 return (uint64_t)ret_conv;
21434 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_retry_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_id) {
21435 LDKChannelManager this_arg_conv;
21436 this_arg_conv.inner = (void*)(this_arg & (~1));
21437 this_arg_conv.is_owned = false;
21438 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21439 LDKRoute route_conv;
21440 route_conv.inner = (void*)(route & (~1));
21441 route_conv.is_owned = false;
21442 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
21443 LDKThirtyTwoBytes payment_id_ref;
21444 CHECK(*((uint32_t*)payment_id) == 32);
21445 memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32);
21446 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
21447 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
21448 return (uint64_t)ret_conv;
21451 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_spontaneous_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_preimage) {
21452 LDKChannelManager this_arg_conv;
21453 this_arg_conv.inner = (void*)(this_arg & (~1));
21454 this_arg_conv.is_owned = false;
21455 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21456 LDKRoute route_conv;
21457 route_conv.inner = (void*)(route & (~1));
21458 route_conv.is_owned = false;
21459 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
21460 LDKThirtyTwoBytes payment_preimage_ref;
21461 CHECK(*((uint32_t*)payment_preimage) == 32);
21462 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
21463 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
21464 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
21465 return (uint64_t)ret_conv;
21468 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_funding_transaction_generated(uint32_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
21469 LDKChannelManager this_arg_conv;
21470 this_arg_conv.inner = (void*)(this_arg & (~1));
21471 this_arg_conv.is_owned = false;
21472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21473 unsigned char temporary_channel_id_arr[32];
21474 CHECK(*((uint32_t*)temporary_channel_id) == 32);
21475 memcpy(temporary_channel_id_arr, (uint8_t*)(temporary_channel_id + 4), 32);
21476 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
21477 LDKTransaction funding_transaction_ref;
21478 funding_transaction_ref.datalen = *((uint32_t*)funding_transaction);
21479 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
21480 memcpy(funding_transaction_ref.data, (uint8_t*)(funding_transaction + 4), funding_transaction_ref.datalen);
21481 funding_transaction_ref.data_is_owned = true;
21482 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21483 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
21484 return (uint64_t)ret_conv;
21487 void __attribute__((visibility("default"))) TS_ChannelManager_broadcast_node_announcement(uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
21488 LDKChannelManager this_arg_conv;
21489 this_arg_conv.inner = (void*)(this_arg & (~1));
21490 this_arg_conv.is_owned = false;
21491 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21492 LDKThreeBytes rgb_ref;
21493 CHECK(*((uint32_t*)rgb) == 3);
21494 memcpy(rgb_ref.data, (uint8_t*)(rgb + 4), 3);
21495 LDKThirtyTwoBytes alias_ref;
21496 CHECK(*((uint32_t*)alias) == 32);
21497 memcpy(alias_ref.data, (uint8_t*)(alias + 4), 32);
21498 LDKCVec_NetAddressZ addresses_constr;
21499 addresses_constr.datalen = *((uint32_t*)addresses);
21500 if (addresses_constr.datalen > 0)
21501 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
21503 addresses_constr.data = NULL;
21504 uint32_t* addresses_vals = (uint32_t*)(addresses + 4);
21505 for (size_t m = 0; m < addresses_constr.datalen; m++) {
21506 uint32_t addresses_conv_12 = addresses_vals[m];
21507 void* addresses_conv_12_ptr = (void*)(((uint64_t)addresses_conv_12) & ~1);
21508 CHECK_ACCESS(addresses_conv_12_ptr);
21509 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
21510 addresses_constr.data[m] = addresses_conv_12_conv;
21512 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
21515 void __attribute__((visibility("default"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
21516 LDKChannelManager this_arg_conv;
21517 this_arg_conv.inner = (void*)(this_arg & (~1));
21518 this_arg_conv.is_owned = false;
21519 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21520 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
21523 void __attribute__((visibility("default"))) TS_ChannelManager_timer_tick_occurred(uint32_t this_arg) {
21524 LDKChannelManager this_arg_conv;
21525 this_arg_conv.inner = (void*)(this_arg & (~1));
21526 this_arg_conv.is_owned = false;
21527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21528 ChannelManager_timer_tick_occurred(&this_arg_conv);
21531 jboolean __attribute__((visibility("default"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash) {
21532 LDKChannelManager this_arg_conv;
21533 this_arg_conv.inner = (void*)(this_arg & (~1));
21534 this_arg_conv.is_owned = false;
21535 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21536 unsigned char payment_hash_arr[32];
21537 CHECK(*((uint32_t*)payment_hash) == 32);
21538 memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32);
21539 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
21540 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
21544 jboolean __attribute__((visibility("default"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage) {
21545 LDKChannelManager this_arg_conv;
21546 this_arg_conv.inner = (void*)(this_arg & (~1));
21547 this_arg_conv.is_owned = false;
21548 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21549 LDKThirtyTwoBytes payment_preimage_ref;
21550 CHECK(*((uint32_t*)payment_preimage) == 32);
21551 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
21552 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
21556 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
21557 LDKChannelManager this_arg_conv;
21558 this_arg_conv.inner = (void*)(this_arg & (~1));
21559 this_arg_conv.is_owned = false;
21560 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21561 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21562 memcpy((uint8_t*)(ret_arr + 4), ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
21566 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) {
21567 LDKChannelManager this_arg_conv;
21568 this_arg_conv.inner = (void*)(this_arg & (~1));
21569 this_arg_conv.is_owned = false;
21570 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21571 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
21572 CHECK_ACCESS(min_value_msat_ptr);
21573 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
21574 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
21575 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
21576 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
21577 return ((uint64_t)ret_conv);
21580 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) {
21581 LDKChannelManager this_arg_conv;
21582 this_arg_conv.inner = (void*)(this_arg & (~1));
21583 this_arg_conv.is_owned = false;
21584 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21585 LDKThirtyTwoBytes payment_hash_ref;
21586 CHECK(*((uint32_t*)payment_hash) == 32);
21587 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
21588 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
21589 CHECK_ACCESS(min_value_msat_ptr);
21590 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
21591 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
21592 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
21593 *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);
21594 return (uint64_t)ret_conv;
21597 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
21598 LDKChannelManager this_arg_conv;
21599 this_arg_conv.inner = (void*)(this_arg & (~1));
21600 this_arg_conv.is_owned = false;
21601 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21602 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
21603 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
21604 return (uint64_t)ret_ret;
21607 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
21608 LDKChannelManager this_arg_conv;
21609 this_arg_conv.inner = (void*)(this_arg & (~1));
21610 this_arg_conv.is_owned = false;
21611 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21612 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
21613 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
21614 return (uint64_t)ret_ret;
21617 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
21618 LDKChannelManager this_arg_conv;
21619 this_arg_conv.inner = (void*)(this_arg & (~1));
21620 this_arg_conv.is_owned = false;
21621 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21622 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
21623 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
21624 return (uint64_t)ret_ret;
21627 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Confirm(uint32_t this_arg) {
21628 LDKChannelManager this_arg_conv;
21629 this_arg_conv.inner = (void*)(this_arg & (~1));
21630 this_arg_conv.is_owned = false;
21631 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21632 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
21633 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
21634 return (uint64_t)ret_ret;
21637 jboolean __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update_timeout(uint32_t this_arg, int64_t max_wait) {
21638 LDKChannelManager this_arg_conv;
21639 this_arg_conv.inner = (void*)(this_arg & (~1));
21640 this_arg_conv.is_owned = false;
21641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21642 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
21646 void __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
21647 LDKChannelManager this_arg_conv;
21648 this_arg_conv.inner = (void*)(this_arg & (~1));
21649 this_arg_conv.is_owned = false;
21650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21651 ChannelManager_await_persistable_update(&this_arg_conv);
21654 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_current_best_block(uint32_t this_arg) {
21655 LDKChannelManager this_arg_conv;
21656 this_arg_conv.inner = (void*)(this_arg & (~1));
21657 this_arg_conv.is_owned = false;
21658 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21659 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
21660 uint64_t ret_ref = 0;
21661 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21662 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21663 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21664 ret_ref = (uint64_t)ret_var.inner;
21665 if (ret_var.is_owned) {
21671 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
21672 LDKChannelManager this_arg_conv;
21673 this_arg_conv.inner = (void*)(this_arg & (~1));
21674 this_arg_conv.is_owned = false;
21675 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21676 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
21677 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
21678 return (uint64_t)ret_ret;
21681 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_write(uint32_t obj) {
21682 LDKChannelManager obj_conv;
21683 obj_conv.inner = (void*)(obj & (~1));
21684 obj_conv.is_owned = false;
21685 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
21686 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
21687 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21688 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21689 CVec_u8Z_free(ret_var);
21693 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
21694 LDKChannelManagerReadArgs this_obj_conv;
21695 this_obj_conv.inner = (void*)(this_obj & (~1));
21696 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21697 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21698 ChannelManagerReadArgs_free(this_obj_conv);
21701 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
21702 LDKChannelManagerReadArgs this_ptr_conv;
21703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21704 this_ptr_conv.is_owned = false;
21705 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21706 // WARNING: This object doesn't live past this scope, needs clone!
21707 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv)) | 1;
21711 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
21712 LDKChannelManagerReadArgs this_ptr_conv;
21713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21714 this_ptr_conv.is_owned = false;
21715 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21716 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21717 CHECK_ACCESS(val_ptr);
21718 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
21719 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
21722 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
21723 LDKChannelManagerReadArgs this_ptr_conv;
21724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21725 this_ptr_conv.is_owned = false;
21726 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21727 // WARNING: This object doesn't live past this scope, needs clone!
21728 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv)) | 1;
21732 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
21733 LDKChannelManagerReadArgs this_ptr_conv;
21734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21735 this_ptr_conv.is_owned = false;
21736 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21737 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21738 CHECK_ACCESS(val_ptr);
21739 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
21740 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
21743 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
21744 LDKChannelManagerReadArgs this_ptr_conv;
21745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21746 this_ptr_conv.is_owned = false;
21747 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21748 // WARNING: This object doesn't live past this scope, needs clone!
21749 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv)) | 1;
21753 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
21754 LDKChannelManagerReadArgs this_ptr_conv;
21755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21756 this_ptr_conv.is_owned = false;
21757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21758 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21759 CHECK_ACCESS(val_ptr);
21760 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
21761 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
21764 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
21765 LDKChannelManagerReadArgs this_ptr_conv;
21766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21767 this_ptr_conv.is_owned = false;
21768 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21769 // WARNING: This object doesn't live past this scope, needs clone!
21770 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv)) | 1;
21774 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
21775 LDKChannelManagerReadArgs this_ptr_conv;
21776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21777 this_ptr_conv.is_owned = false;
21778 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21779 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21780 CHECK_ACCESS(val_ptr);
21781 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
21782 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
21785 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
21786 LDKChannelManagerReadArgs this_ptr_conv;
21787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21788 this_ptr_conv.is_owned = false;
21789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21790 // WARNING: This object doesn't live past this scope, needs clone!
21791 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv)) | 1;
21795 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
21796 LDKChannelManagerReadArgs this_ptr_conv;
21797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21798 this_ptr_conv.is_owned = false;
21799 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21800 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21801 CHECK_ACCESS(val_ptr);
21802 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
21803 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
21806 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
21807 LDKChannelManagerReadArgs this_ptr_conv;
21808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21809 this_ptr_conv.is_owned = false;
21810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21811 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
21812 uint64_t ret_ref = 0;
21813 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21814 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21815 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21816 ret_ref = (uint64_t)ret_var.inner;
21817 if (ret_var.is_owned) {
21823 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
21824 LDKChannelManagerReadArgs this_ptr_conv;
21825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21826 this_ptr_conv.is_owned = false;
21827 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21828 LDKUserConfig val_conv;
21829 val_conv.inner = (void*)(val & (~1));
21830 val_conv.is_owned = (val & 1) || (val == 0);
21831 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21832 val_conv = UserConfig_clone(&val_conv);
21833 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
21836 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) {
21837 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
21838 CHECK_ACCESS(keys_manager_ptr);
21839 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
21840 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
21841 CHECK_ACCESS(fee_estimator_ptr);
21842 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
21843 void* chain_monitor_ptr = (void*)(((uint64_t)chain_monitor) & ~1);
21844 CHECK_ACCESS(chain_monitor_ptr);
21845 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
21846 void* tx_broadcaster_ptr = (void*)(((uint64_t)tx_broadcaster) & ~1);
21847 CHECK_ACCESS(tx_broadcaster_ptr);
21848 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
21849 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
21850 CHECK_ACCESS(logger_ptr);
21851 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
21852 LDKUserConfig default_config_conv;
21853 default_config_conv.inner = (void*)(default_config & (~1));
21854 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
21855 CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
21856 default_config_conv = UserConfig_clone(&default_config_conv);
21857 LDKCVec_ChannelMonitorZ channel_monitors_constr;
21858 channel_monitors_constr.datalen = *((uint32_t*)channel_monitors);
21859 if (channel_monitors_constr.datalen > 0)
21860 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
21862 channel_monitors_constr.data = NULL;
21863 uint32_t* channel_monitors_vals = (uint32_t*)(channel_monitors + 4);
21864 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
21865 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
21866 LDKChannelMonitor channel_monitors_conv_16_conv;
21867 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
21868 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
21869 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
21870 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
21872 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);
21873 uint64_t ret_ref = 0;
21874 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21875 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21876 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21877 ret_ref = (uint64_t)ret_var.inner;
21878 if (ret_var.is_owned) {
21884 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
21885 LDKu8slice ser_ref;
21886 ser_ref.datalen = *((uint32_t*)ser);
21887 ser_ref.data = (int8_t*)(ser + 4);
21888 LDKChannelManagerReadArgs arg_conv;
21889 arg_conv.inner = (void*)(arg & (~1));
21890 arg_conv.is_owned = (arg & 1) || (arg == 0);
21891 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21892 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
21893 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
21894 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
21895 return (uint64_t)ret_conv;
21898 void __attribute__((visibility("default"))) TS_DecodeError_free(uint32_t this_obj) {
21899 LDKDecodeError this_obj_conv;
21900 this_obj_conv.inner = (void*)(this_obj & (~1));
21901 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21903 DecodeError_free(this_obj_conv);
21906 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
21907 LDKDecodeError ret_var = DecodeError_clone(arg);
21908 uint64_t ret_ref = 0;
21909 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21910 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21911 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21912 ret_ref = (uint64_t)ret_var.inner;
21913 if (ret_var.is_owned) {
21918 int64_t __attribute__((visibility("default"))) TS_DecodeError_clone_ptr(uint32_t arg) {
21919 LDKDecodeError arg_conv;
21920 arg_conv.inner = (void*)(arg & (~1));
21921 arg_conv.is_owned = false;
21922 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21923 int64_t ret_val = DecodeError_clone_ptr(&arg_conv);
21927 uint32_t __attribute__((visibility("default"))) TS_DecodeError_clone(uint32_t orig) {
21928 LDKDecodeError orig_conv;
21929 orig_conv.inner = (void*)(orig & (~1));
21930 orig_conv.is_owned = false;
21931 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21932 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
21933 uint64_t ret_ref = 0;
21934 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21935 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21936 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21937 ret_ref = (uint64_t)ret_var.inner;
21938 if (ret_var.is_owned) {
21944 void __attribute__((visibility("default"))) TS_Init_free(uint32_t this_obj) {
21945 LDKInit this_obj_conv;
21946 this_obj_conv.inner = (void*)(this_obj & (~1));
21947 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21949 Init_free(this_obj_conv);
21952 uint32_t __attribute__((visibility("default"))) TS_Init_get_features(uint32_t this_ptr) {
21953 LDKInit this_ptr_conv;
21954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21955 this_ptr_conv.is_owned = false;
21956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21957 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
21958 uint64_t ret_ref = 0;
21959 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21960 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21961 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21962 ret_ref = (uint64_t)ret_var.inner;
21963 if (ret_var.is_owned) {
21969 void __attribute__((visibility("default"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
21970 LDKInit this_ptr_conv;
21971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21972 this_ptr_conv.is_owned = false;
21973 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21974 LDKInitFeatures val_conv;
21975 val_conv.inner = (void*)(val & (~1));
21976 val_conv.is_owned = (val & 1) || (val == 0);
21977 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21978 val_conv = InitFeatures_clone(&val_conv);
21979 Init_set_features(&this_ptr_conv, val_conv);
21982 uint32_t __attribute__((visibility("default"))) TS_Init_new(uint32_t features_arg) {
21983 LDKInitFeatures features_arg_conv;
21984 features_arg_conv.inner = (void*)(features_arg & (~1));
21985 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
21986 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
21987 features_arg_conv = InitFeatures_clone(&features_arg_conv);
21988 LDKInit ret_var = Init_new(features_arg_conv);
21989 uint64_t ret_ref = 0;
21990 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21991 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21992 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21993 ret_ref = (uint64_t)ret_var.inner;
21994 if (ret_var.is_owned) {
22000 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
22001 LDKInit ret_var = Init_clone(arg);
22002 uint64_t ret_ref = 0;
22003 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22004 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22005 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22006 ret_ref = (uint64_t)ret_var.inner;
22007 if (ret_var.is_owned) {
22012 int64_t __attribute__((visibility("default"))) TS_Init_clone_ptr(uint32_t arg) {
22014 arg_conv.inner = (void*)(arg & (~1));
22015 arg_conv.is_owned = false;
22016 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22017 int64_t ret_val = Init_clone_ptr(&arg_conv);
22021 uint32_t __attribute__((visibility("default"))) TS_Init_clone(uint32_t orig) {
22023 orig_conv.inner = (void*)(orig & (~1));
22024 orig_conv.is_owned = false;
22025 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22026 LDKInit ret_var = Init_clone(&orig_conv);
22027 uint64_t ret_ref = 0;
22028 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22029 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22030 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22031 ret_ref = (uint64_t)ret_var.inner;
22032 if (ret_var.is_owned) {
22038 void __attribute__((visibility("default"))) TS_ErrorMessage_free(uint32_t this_obj) {
22039 LDKErrorMessage this_obj_conv;
22040 this_obj_conv.inner = (void*)(this_obj & (~1));
22041 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22042 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22043 ErrorMessage_free(this_obj_conv);
22046 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
22047 LDKErrorMessage this_ptr_conv;
22048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22049 this_ptr_conv.is_owned = false;
22050 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22051 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22052 memcpy((uint8_t*)(ret_arr + 4), *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
22056 void __attribute__((visibility("default"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
22057 LDKErrorMessage this_ptr_conv;
22058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22059 this_ptr_conv.is_owned = false;
22060 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22061 LDKThirtyTwoBytes val_ref;
22062 CHECK(*((uint32_t*)val) == 32);
22063 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
22064 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
22067 jstring __attribute__((visibility("default"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
22068 LDKErrorMessage this_ptr_conv;
22069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22070 this_ptr_conv.is_owned = false;
22071 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22072 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
22073 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
22078 void __attribute__((visibility("default"))) TS_ErrorMessage_set_data(uint32_t this_ptr, jstring val) {
22079 LDKErrorMessage this_ptr_conv;
22080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22081 this_ptr_conv.is_owned = false;
22082 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22083 LDKStr val_conv = str_ref_to_owned_c(val);
22084 ErrorMessage_set_data(&this_ptr_conv, val_conv);
22087 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
22088 LDKThirtyTwoBytes channel_id_arg_ref;
22089 CHECK(*((uint32_t*)channel_id_arg) == 32);
22090 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
22091 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
22092 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
22093 uint64_t ret_ref = 0;
22094 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22095 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22096 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22097 ret_ref = (uint64_t)ret_var.inner;
22098 if (ret_var.is_owned) {
22104 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
22105 LDKErrorMessage ret_var = ErrorMessage_clone(arg);
22106 uint64_t ret_ref = 0;
22107 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22108 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22109 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22110 ret_ref = (uint64_t)ret_var.inner;
22111 if (ret_var.is_owned) {
22116 int64_t __attribute__((visibility("default"))) TS_ErrorMessage_clone_ptr(uint32_t arg) {
22117 LDKErrorMessage arg_conv;
22118 arg_conv.inner = (void*)(arg & (~1));
22119 arg_conv.is_owned = false;
22120 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22121 int64_t ret_val = ErrorMessage_clone_ptr(&arg_conv);
22125 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_clone(uint32_t orig) {
22126 LDKErrorMessage orig_conv;
22127 orig_conv.inner = (void*)(orig & (~1));
22128 orig_conv.is_owned = false;
22129 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22130 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
22131 uint64_t ret_ref = 0;
22132 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22133 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22134 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22135 ret_ref = (uint64_t)ret_var.inner;
22136 if (ret_var.is_owned) {
22142 void __attribute__((visibility("default"))) TS_Ping_free(uint32_t this_obj) {
22143 LDKPing this_obj_conv;
22144 this_obj_conv.inner = (void*)(this_obj & (~1));
22145 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22146 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22147 Ping_free(this_obj_conv);
22150 int16_t __attribute__((visibility("default"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
22151 LDKPing this_ptr_conv;
22152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22153 this_ptr_conv.is_owned = false;
22154 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22155 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
22159 void __attribute__((visibility("default"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
22160 LDKPing this_ptr_conv;
22161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22162 this_ptr_conv.is_owned = false;
22163 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22164 Ping_set_ponglen(&this_ptr_conv, val);
22167 int16_t __attribute__((visibility("default"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
22168 LDKPing this_ptr_conv;
22169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22170 this_ptr_conv.is_owned = false;
22171 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22172 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
22176 void __attribute__((visibility("default"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
22177 LDKPing this_ptr_conv;
22178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22179 this_ptr_conv.is_owned = false;
22180 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22181 Ping_set_byteslen(&this_ptr_conv, val);
22184 uint32_t __attribute__((visibility("default"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
22185 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
22186 uint64_t ret_ref = 0;
22187 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22188 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22189 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22190 ret_ref = (uint64_t)ret_var.inner;
22191 if (ret_var.is_owned) {
22197 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
22198 LDKPing ret_var = Ping_clone(arg);
22199 uint64_t ret_ref = 0;
22200 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22201 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22202 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22203 ret_ref = (uint64_t)ret_var.inner;
22204 if (ret_var.is_owned) {
22209 int64_t __attribute__((visibility("default"))) TS_Ping_clone_ptr(uint32_t arg) {
22211 arg_conv.inner = (void*)(arg & (~1));
22212 arg_conv.is_owned = false;
22213 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22214 int64_t ret_val = Ping_clone_ptr(&arg_conv);
22218 uint32_t __attribute__((visibility("default"))) TS_Ping_clone(uint32_t orig) {
22220 orig_conv.inner = (void*)(orig & (~1));
22221 orig_conv.is_owned = false;
22222 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22223 LDKPing ret_var = Ping_clone(&orig_conv);
22224 uint64_t ret_ref = 0;
22225 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22226 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22227 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22228 ret_ref = (uint64_t)ret_var.inner;
22229 if (ret_var.is_owned) {
22235 void __attribute__((visibility("default"))) TS_Pong_free(uint32_t this_obj) {
22236 LDKPong this_obj_conv;
22237 this_obj_conv.inner = (void*)(this_obj & (~1));
22238 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22239 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22240 Pong_free(this_obj_conv);
22243 int16_t __attribute__((visibility("default"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
22244 LDKPong this_ptr_conv;
22245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22246 this_ptr_conv.is_owned = false;
22247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22248 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
22252 void __attribute__((visibility("default"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
22253 LDKPong this_ptr_conv;
22254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22255 this_ptr_conv.is_owned = false;
22256 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22257 Pong_set_byteslen(&this_ptr_conv, val);
22260 uint32_t __attribute__((visibility("default"))) TS_Pong_new(int16_t byteslen_arg) {
22261 LDKPong ret_var = Pong_new(byteslen_arg);
22262 uint64_t ret_ref = 0;
22263 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22264 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22265 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22266 ret_ref = (uint64_t)ret_var.inner;
22267 if (ret_var.is_owned) {
22273 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
22274 LDKPong ret_var = Pong_clone(arg);
22275 uint64_t ret_ref = 0;
22276 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22277 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22278 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22279 ret_ref = (uint64_t)ret_var.inner;
22280 if (ret_var.is_owned) {
22285 int64_t __attribute__((visibility("default"))) TS_Pong_clone_ptr(uint32_t arg) {
22287 arg_conv.inner = (void*)(arg & (~1));
22288 arg_conv.is_owned = false;
22289 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22290 int64_t ret_val = Pong_clone_ptr(&arg_conv);
22294 uint32_t __attribute__((visibility("default"))) TS_Pong_clone(uint32_t orig) {
22296 orig_conv.inner = (void*)(orig & (~1));
22297 orig_conv.is_owned = false;
22298 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22299 LDKPong ret_var = Pong_clone(&orig_conv);
22300 uint64_t ret_ref = 0;
22301 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22302 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22303 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22304 ret_ref = (uint64_t)ret_var.inner;
22305 if (ret_var.is_owned) {
22311 void __attribute__((visibility("default"))) TS_OpenChannel_free(uint32_t this_obj) {
22312 LDKOpenChannel this_obj_conv;
22313 this_obj_conv.inner = (void*)(this_obj & (~1));
22314 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22315 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22316 OpenChannel_free(this_obj_conv);
22319 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
22320 LDKOpenChannel this_ptr_conv;
22321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22322 this_ptr_conv.is_owned = false;
22323 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22324 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22325 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
22329 void __attribute__((visibility("default"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
22330 LDKOpenChannel this_ptr_conv;
22331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22332 this_ptr_conv.is_owned = false;
22333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22334 LDKThirtyTwoBytes val_ref;
22335 CHECK(*((uint32_t*)val) == 32);
22336 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
22337 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
22340 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
22341 LDKOpenChannel this_ptr_conv;
22342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22343 this_ptr_conv.is_owned = false;
22344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22345 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22346 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
22350 void __attribute__((visibility("default"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
22351 LDKOpenChannel this_ptr_conv;
22352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22353 this_ptr_conv.is_owned = false;
22354 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22355 LDKThirtyTwoBytes val_ref;
22356 CHECK(*((uint32_t*)val) == 32);
22357 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
22358 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
22361 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
22362 LDKOpenChannel this_ptr_conv;
22363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22364 this_ptr_conv.is_owned = false;
22365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22366 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
22370 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
22371 LDKOpenChannel this_ptr_conv;
22372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22373 this_ptr_conv.is_owned = false;
22374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22375 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
22378 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
22379 LDKOpenChannel this_ptr_conv;
22380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22381 this_ptr_conv.is_owned = false;
22382 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22383 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
22387 void __attribute__((visibility("default"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
22388 LDKOpenChannel this_ptr_conv;
22389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22390 this_ptr_conv.is_owned = false;
22391 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22392 OpenChannel_set_push_msat(&this_ptr_conv, val);
22395 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
22396 LDKOpenChannel this_ptr_conv;
22397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22398 this_ptr_conv.is_owned = false;
22399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22400 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
22404 void __attribute__((visibility("default"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
22405 LDKOpenChannel this_ptr_conv;
22406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22407 this_ptr_conv.is_owned = false;
22408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22409 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
22412 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
22413 LDKOpenChannel this_ptr_conv;
22414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22415 this_ptr_conv.is_owned = false;
22416 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22417 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
22421 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
22422 LDKOpenChannel this_ptr_conv;
22423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22424 this_ptr_conv.is_owned = false;
22425 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22426 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
22429 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
22430 LDKOpenChannel this_ptr_conv;
22431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22432 this_ptr_conv.is_owned = false;
22433 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22434 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
22438 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
22439 LDKOpenChannel this_ptr_conv;
22440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22441 this_ptr_conv.is_owned = false;
22442 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22443 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
22446 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
22447 LDKOpenChannel this_ptr_conv;
22448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22449 this_ptr_conv.is_owned = false;
22450 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22451 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
22455 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
22456 LDKOpenChannel this_ptr_conv;
22457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22458 this_ptr_conv.is_owned = false;
22459 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22460 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
22463 int32_t __attribute__((visibility("default"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
22464 LDKOpenChannel this_ptr_conv;
22465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22466 this_ptr_conv.is_owned = false;
22467 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22468 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
22472 void __attribute__((visibility("default"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
22473 LDKOpenChannel this_ptr_conv;
22474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22475 this_ptr_conv.is_owned = false;
22476 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22477 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
22480 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
22481 LDKOpenChannel this_ptr_conv;
22482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22483 this_ptr_conv.is_owned = false;
22484 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22485 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
22489 void __attribute__((visibility("default"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
22490 LDKOpenChannel this_ptr_conv;
22491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22492 this_ptr_conv.is_owned = false;
22493 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22494 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
22497 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
22498 LDKOpenChannel this_ptr_conv;
22499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22500 this_ptr_conv.is_owned = false;
22501 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22502 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
22506 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
22507 LDKOpenChannel this_ptr_conv;
22508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22509 this_ptr_conv.is_owned = false;
22510 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22511 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
22514 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
22515 LDKOpenChannel this_ptr_conv;
22516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22517 this_ptr_conv.is_owned = false;
22518 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22519 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22520 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
22524 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
22525 LDKOpenChannel this_ptr_conv;
22526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22527 this_ptr_conv.is_owned = false;
22528 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22529 LDKPublicKey val_ref;
22530 CHECK(*((uint32_t*)val) == 33);
22531 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22532 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
22535 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
22536 LDKOpenChannel this_ptr_conv;
22537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22538 this_ptr_conv.is_owned = false;
22539 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22540 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22541 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
22545 void __attribute__((visibility("default"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
22546 LDKOpenChannel this_ptr_conv;
22547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22548 this_ptr_conv.is_owned = false;
22549 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22550 LDKPublicKey val_ref;
22551 CHECK(*((uint32_t*)val) == 33);
22552 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22553 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
22556 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
22557 LDKOpenChannel this_ptr_conv;
22558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22559 this_ptr_conv.is_owned = false;
22560 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22561 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22562 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
22566 void __attribute__((visibility("default"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
22567 LDKOpenChannel this_ptr_conv;
22568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22569 this_ptr_conv.is_owned = false;
22570 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22571 LDKPublicKey val_ref;
22572 CHECK(*((uint32_t*)val) == 33);
22573 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22574 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
22577 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
22578 LDKOpenChannel this_ptr_conv;
22579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22580 this_ptr_conv.is_owned = false;
22581 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22582 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22583 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
22587 void __attribute__((visibility("default"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
22588 LDKOpenChannel this_ptr_conv;
22589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22590 this_ptr_conv.is_owned = false;
22591 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22592 LDKPublicKey val_ref;
22593 CHECK(*((uint32_t*)val) == 33);
22594 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22595 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
22598 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
22599 LDKOpenChannel this_ptr_conv;
22600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22601 this_ptr_conv.is_owned = false;
22602 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22603 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22604 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
22608 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
22609 LDKOpenChannel this_ptr_conv;
22610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22611 this_ptr_conv.is_owned = false;
22612 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22613 LDKPublicKey val_ref;
22614 CHECK(*((uint32_t*)val) == 33);
22615 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22616 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
22619 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
22620 LDKOpenChannel this_ptr_conv;
22621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22622 this_ptr_conv.is_owned = false;
22623 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22624 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22625 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
22629 void __attribute__((visibility("default"))) TS_OpenChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
22630 LDKOpenChannel this_ptr_conv;
22631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22632 this_ptr_conv.is_owned = false;
22633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22634 LDKPublicKey val_ref;
22635 CHECK(*((uint32_t*)val) == 33);
22636 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22637 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
22640 int8_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
22641 LDKOpenChannel this_ptr_conv;
22642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22643 this_ptr_conv.is_owned = false;
22644 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22645 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
22649 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
22650 LDKOpenChannel this_ptr_conv;
22651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22652 this_ptr_conv.is_owned = false;
22653 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22654 OpenChannel_set_channel_flags(&this_ptr_conv, val);
22657 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
22658 LDKOpenChannel ret_var = OpenChannel_clone(arg);
22659 uint64_t ret_ref = 0;
22660 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22661 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22662 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22663 ret_ref = (uint64_t)ret_var.inner;
22664 if (ret_var.is_owned) {
22669 int64_t __attribute__((visibility("default"))) TS_OpenChannel_clone_ptr(uint32_t arg) {
22670 LDKOpenChannel arg_conv;
22671 arg_conv.inner = (void*)(arg & (~1));
22672 arg_conv.is_owned = false;
22673 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22674 int64_t ret_val = OpenChannel_clone_ptr(&arg_conv);
22678 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_clone(uint32_t orig) {
22679 LDKOpenChannel orig_conv;
22680 orig_conv.inner = (void*)(orig & (~1));
22681 orig_conv.is_owned = false;
22682 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22683 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
22684 uint64_t ret_ref = 0;
22685 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22686 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22687 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22688 ret_ref = (uint64_t)ret_var.inner;
22689 if (ret_var.is_owned) {
22695 void __attribute__((visibility("default"))) TS_AcceptChannel_free(uint32_t this_obj) {
22696 LDKAcceptChannel this_obj_conv;
22697 this_obj_conv.inner = (void*)(this_obj & (~1));
22698 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22699 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22700 AcceptChannel_free(this_obj_conv);
22703 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
22704 LDKAcceptChannel this_ptr_conv;
22705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22706 this_ptr_conv.is_owned = false;
22707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22708 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22709 memcpy((uint8_t*)(ret_arr + 4), *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
22713 void __attribute__((visibility("default"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
22714 LDKAcceptChannel this_ptr_conv;
22715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22716 this_ptr_conv.is_owned = false;
22717 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22718 LDKThirtyTwoBytes val_ref;
22719 CHECK(*((uint32_t*)val) == 32);
22720 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
22721 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
22724 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
22725 LDKAcceptChannel this_ptr_conv;
22726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22727 this_ptr_conv.is_owned = false;
22728 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22729 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
22733 void __attribute__((visibility("default"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
22734 LDKAcceptChannel this_ptr_conv;
22735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22736 this_ptr_conv.is_owned = false;
22737 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22738 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
22741 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
22742 LDKAcceptChannel this_ptr_conv;
22743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22744 this_ptr_conv.is_owned = false;
22745 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22746 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
22750 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
22751 LDKAcceptChannel this_ptr_conv;
22752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22753 this_ptr_conv.is_owned = false;
22754 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22755 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
22758 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
22759 LDKAcceptChannel this_ptr_conv;
22760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22761 this_ptr_conv.is_owned = false;
22762 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22763 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
22767 void __attribute__((visibility("default"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
22768 LDKAcceptChannel this_ptr_conv;
22769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22770 this_ptr_conv.is_owned = false;
22771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22772 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
22775 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
22776 LDKAcceptChannel this_ptr_conv;
22777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22778 this_ptr_conv.is_owned = false;
22779 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22780 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
22784 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
22785 LDKAcceptChannel this_ptr_conv;
22786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22787 this_ptr_conv.is_owned = false;
22788 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22789 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
22792 int32_t __attribute__((visibility("default"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
22793 LDKAcceptChannel this_ptr_conv;
22794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22795 this_ptr_conv.is_owned = false;
22796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22797 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
22801 void __attribute__((visibility("default"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
22802 LDKAcceptChannel this_ptr_conv;
22803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22804 this_ptr_conv.is_owned = false;
22805 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22806 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
22809 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
22810 LDKAcceptChannel this_ptr_conv;
22811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22812 this_ptr_conv.is_owned = false;
22813 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22814 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
22818 void __attribute__((visibility("default"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
22819 LDKAcceptChannel this_ptr_conv;
22820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22821 this_ptr_conv.is_owned = false;
22822 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22823 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
22826 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
22827 LDKAcceptChannel this_ptr_conv;
22828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22829 this_ptr_conv.is_owned = false;
22830 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22831 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
22835 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
22836 LDKAcceptChannel this_ptr_conv;
22837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22838 this_ptr_conv.is_owned = false;
22839 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22840 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
22843 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
22844 LDKAcceptChannel this_ptr_conv;
22845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22846 this_ptr_conv.is_owned = false;
22847 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22848 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22849 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
22853 void __attribute__((visibility("default"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
22854 LDKAcceptChannel this_ptr_conv;
22855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22856 this_ptr_conv.is_owned = false;
22857 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22858 LDKPublicKey val_ref;
22859 CHECK(*((uint32_t*)val) == 33);
22860 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22861 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
22864 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
22865 LDKAcceptChannel this_ptr_conv;
22866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22867 this_ptr_conv.is_owned = false;
22868 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22869 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22870 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
22874 void __attribute__((visibility("default"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
22875 LDKAcceptChannel this_ptr_conv;
22876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22877 this_ptr_conv.is_owned = false;
22878 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22879 LDKPublicKey val_ref;
22880 CHECK(*((uint32_t*)val) == 33);
22881 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22882 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
22885 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
22886 LDKAcceptChannel this_ptr_conv;
22887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22888 this_ptr_conv.is_owned = false;
22889 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22890 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22891 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
22895 void __attribute__((visibility("default"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
22896 LDKAcceptChannel this_ptr_conv;
22897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22898 this_ptr_conv.is_owned = false;
22899 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22900 LDKPublicKey val_ref;
22901 CHECK(*((uint32_t*)val) == 33);
22902 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22903 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
22906 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
22907 LDKAcceptChannel this_ptr_conv;
22908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22909 this_ptr_conv.is_owned = false;
22910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22911 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22912 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
22916 void __attribute__((visibility("default"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
22917 LDKAcceptChannel this_ptr_conv;
22918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22919 this_ptr_conv.is_owned = false;
22920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22921 LDKPublicKey val_ref;
22922 CHECK(*((uint32_t*)val) == 33);
22923 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22924 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
22927 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
22928 LDKAcceptChannel this_ptr_conv;
22929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22930 this_ptr_conv.is_owned = false;
22931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22932 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22933 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
22937 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
22938 LDKAcceptChannel this_ptr_conv;
22939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22940 this_ptr_conv.is_owned = false;
22941 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22942 LDKPublicKey val_ref;
22943 CHECK(*((uint32_t*)val) == 33);
22944 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22945 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
22948 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
22949 LDKAcceptChannel this_ptr_conv;
22950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22951 this_ptr_conv.is_owned = false;
22952 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22953 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22954 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
22958 void __attribute__((visibility("default"))) TS_AcceptChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
22959 LDKAcceptChannel this_ptr_conv;
22960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22961 this_ptr_conv.is_owned = false;
22962 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22963 LDKPublicKey val_ref;
22964 CHECK(*((uint32_t*)val) == 33);
22965 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22966 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
22969 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
22970 LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
22971 uint64_t ret_ref = 0;
22972 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22973 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22974 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22975 ret_ref = (uint64_t)ret_var.inner;
22976 if (ret_var.is_owned) {
22981 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_clone_ptr(uint32_t arg) {
22982 LDKAcceptChannel arg_conv;
22983 arg_conv.inner = (void*)(arg & (~1));
22984 arg_conv.is_owned = false;
22985 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22986 int64_t ret_val = AcceptChannel_clone_ptr(&arg_conv);
22990 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_clone(uint32_t orig) {
22991 LDKAcceptChannel orig_conv;
22992 orig_conv.inner = (void*)(orig & (~1));
22993 orig_conv.is_owned = false;
22994 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22995 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
22996 uint64_t ret_ref = 0;
22997 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22998 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22999 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23000 ret_ref = (uint64_t)ret_var.inner;
23001 if (ret_var.is_owned) {
23007 void __attribute__((visibility("default"))) TS_FundingCreated_free(uint32_t this_obj) {
23008 LDKFundingCreated this_obj_conv;
23009 this_obj_conv.inner = (void*)(this_obj & (~1));
23010 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23011 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23012 FundingCreated_free(this_obj_conv);
23015 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
23016 LDKFundingCreated this_ptr_conv;
23017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23018 this_ptr_conv.is_owned = false;
23019 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23020 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23021 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
23025 void __attribute__((visibility("default"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
23026 LDKFundingCreated this_ptr_conv;
23027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23028 this_ptr_conv.is_owned = false;
23029 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23030 LDKThirtyTwoBytes val_ref;
23031 CHECK(*((uint32_t*)val) == 32);
23032 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23033 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
23036 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
23037 LDKFundingCreated this_ptr_conv;
23038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23039 this_ptr_conv.is_owned = false;
23040 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23041 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23042 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
23046 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
23047 LDKFundingCreated this_ptr_conv;
23048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23049 this_ptr_conv.is_owned = false;
23050 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23051 LDKThirtyTwoBytes val_ref;
23052 CHECK(*((uint32_t*)val) == 32);
23053 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23054 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
23057 int16_t __attribute__((visibility("default"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
23058 LDKFundingCreated this_ptr_conv;
23059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23060 this_ptr_conv.is_owned = false;
23061 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23062 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
23066 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
23067 LDKFundingCreated this_ptr_conv;
23068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23069 this_ptr_conv.is_owned = false;
23070 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23071 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
23074 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
23075 LDKFundingCreated this_ptr_conv;
23076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23077 this_ptr_conv.is_owned = false;
23078 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23079 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
23080 memcpy((uint8_t*)(ret_arr + 4), FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
23084 void __attribute__((visibility("default"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
23085 LDKFundingCreated this_ptr_conv;
23086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23087 this_ptr_conv.is_owned = false;
23088 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23089 LDKSignature val_ref;
23090 CHECK(*((uint32_t*)val) == 64);
23091 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
23092 FundingCreated_set_signature(&this_ptr_conv, val_ref);
23095 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) {
23096 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
23097 CHECK(*((uint32_t*)temporary_channel_id_arg) == 32);
23098 memcpy(temporary_channel_id_arg_ref.data, (uint8_t*)(temporary_channel_id_arg + 4), 32);
23099 LDKThirtyTwoBytes funding_txid_arg_ref;
23100 CHECK(*((uint32_t*)funding_txid_arg) == 32);
23101 memcpy(funding_txid_arg_ref.data, (uint8_t*)(funding_txid_arg + 4), 32);
23102 LDKSignature signature_arg_ref;
23103 CHECK(*((uint32_t*)signature_arg) == 64);
23104 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
23105 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
23106 uint64_t ret_ref = 0;
23107 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23108 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23109 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23110 ret_ref = (uint64_t)ret_var.inner;
23111 if (ret_var.is_owned) {
23117 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
23118 LDKFundingCreated ret_var = FundingCreated_clone(arg);
23119 uint64_t ret_ref = 0;
23120 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23121 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23122 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23123 ret_ref = (uint64_t)ret_var.inner;
23124 if (ret_var.is_owned) {
23129 int64_t __attribute__((visibility("default"))) TS_FundingCreated_clone_ptr(uint32_t arg) {
23130 LDKFundingCreated arg_conv;
23131 arg_conv.inner = (void*)(arg & (~1));
23132 arg_conv.is_owned = false;
23133 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23134 int64_t ret_val = FundingCreated_clone_ptr(&arg_conv);
23138 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_clone(uint32_t orig) {
23139 LDKFundingCreated orig_conv;
23140 orig_conv.inner = (void*)(orig & (~1));
23141 orig_conv.is_owned = false;
23142 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23143 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
23144 uint64_t ret_ref = 0;
23145 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23146 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23147 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23148 ret_ref = (uint64_t)ret_var.inner;
23149 if (ret_var.is_owned) {
23155 void __attribute__((visibility("default"))) TS_FundingSigned_free(uint32_t this_obj) {
23156 LDKFundingSigned this_obj_conv;
23157 this_obj_conv.inner = (void*)(this_obj & (~1));
23158 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23159 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23160 FundingSigned_free(this_obj_conv);
23163 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
23164 LDKFundingSigned this_ptr_conv;
23165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23166 this_ptr_conv.is_owned = false;
23167 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23168 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23169 memcpy((uint8_t*)(ret_arr + 4), *FundingSigned_get_channel_id(&this_ptr_conv), 32);
23173 void __attribute__((visibility("default"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23174 LDKFundingSigned this_ptr_conv;
23175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23176 this_ptr_conv.is_owned = false;
23177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23178 LDKThirtyTwoBytes val_ref;
23179 CHECK(*((uint32_t*)val) == 32);
23180 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23181 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
23184 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
23185 LDKFundingSigned this_ptr_conv;
23186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23187 this_ptr_conv.is_owned = false;
23188 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23189 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
23190 memcpy((uint8_t*)(ret_arr + 4), FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
23194 void __attribute__((visibility("default"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
23195 LDKFundingSigned this_ptr_conv;
23196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23197 this_ptr_conv.is_owned = false;
23198 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23199 LDKSignature val_ref;
23200 CHECK(*((uint32_t*)val) == 64);
23201 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
23202 FundingSigned_set_signature(&this_ptr_conv, val_ref);
23205 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
23206 LDKThirtyTwoBytes channel_id_arg_ref;
23207 CHECK(*((uint32_t*)channel_id_arg) == 32);
23208 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
23209 LDKSignature signature_arg_ref;
23210 CHECK(*((uint32_t*)signature_arg) == 64);
23211 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
23212 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
23213 uint64_t ret_ref = 0;
23214 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23215 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23216 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23217 ret_ref = (uint64_t)ret_var.inner;
23218 if (ret_var.is_owned) {
23224 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
23225 LDKFundingSigned ret_var = FundingSigned_clone(arg);
23226 uint64_t ret_ref = 0;
23227 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23228 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23229 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23230 ret_ref = (uint64_t)ret_var.inner;
23231 if (ret_var.is_owned) {
23236 int64_t __attribute__((visibility("default"))) TS_FundingSigned_clone_ptr(uint32_t arg) {
23237 LDKFundingSigned arg_conv;
23238 arg_conv.inner = (void*)(arg & (~1));
23239 arg_conv.is_owned = false;
23240 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23241 int64_t ret_val = FundingSigned_clone_ptr(&arg_conv);
23245 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_clone(uint32_t orig) {
23246 LDKFundingSigned orig_conv;
23247 orig_conv.inner = (void*)(orig & (~1));
23248 orig_conv.is_owned = false;
23249 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23250 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
23251 uint64_t ret_ref = 0;
23252 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23253 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23254 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23255 ret_ref = (uint64_t)ret_var.inner;
23256 if (ret_var.is_owned) {
23262 void __attribute__((visibility("default"))) TS_FundingLocked_free(uint32_t this_obj) {
23263 LDKFundingLocked this_obj_conv;
23264 this_obj_conv.inner = (void*)(this_obj & (~1));
23265 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23267 FundingLocked_free(this_obj_conv);
23270 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_channel_id(uint32_t this_ptr) {
23271 LDKFundingLocked this_ptr_conv;
23272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23273 this_ptr_conv.is_owned = false;
23274 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23275 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23276 memcpy((uint8_t*)(ret_arr + 4), *FundingLocked_get_channel_id(&this_ptr_conv), 32);
23280 void __attribute__((visibility("default"))) TS_FundingLocked_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23281 LDKFundingLocked this_ptr_conv;
23282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23283 this_ptr_conv.is_owned = false;
23284 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23285 LDKThirtyTwoBytes val_ref;
23286 CHECK(*((uint32_t*)val) == 32);
23287 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23288 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
23291 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_next_per_commitment_point(uint32_t this_ptr) {
23292 LDKFundingLocked this_ptr_conv;
23293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23294 this_ptr_conv.is_owned = false;
23295 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23296 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23297 memcpy((uint8_t*)(ret_arr + 4), FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
23301 void __attribute__((visibility("default"))) TS_FundingLocked_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
23302 LDKFundingLocked this_ptr_conv;
23303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23304 this_ptr_conv.is_owned = false;
23305 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23306 LDKPublicKey val_ref;
23307 CHECK(*((uint32_t*)val) == 33);
23308 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
23309 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
23312 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
23313 LDKThirtyTwoBytes channel_id_arg_ref;
23314 CHECK(*((uint32_t*)channel_id_arg) == 32);
23315 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
23316 LDKPublicKey next_per_commitment_point_arg_ref;
23317 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
23318 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
23319 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
23320 uint64_t ret_ref = 0;
23321 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23322 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23323 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23324 ret_ref = (uint64_t)ret_var.inner;
23325 if (ret_var.is_owned) {
23331 static inline uint64_t FundingLocked_clone_ptr(LDKFundingLocked *NONNULL_PTR arg) {
23332 LDKFundingLocked ret_var = FundingLocked_clone(arg);
23333 uint64_t ret_ref = 0;
23334 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23335 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23336 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23337 ret_ref = (uint64_t)ret_var.inner;
23338 if (ret_var.is_owned) {
23343 int64_t __attribute__((visibility("default"))) TS_FundingLocked_clone_ptr(uint32_t arg) {
23344 LDKFundingLocked arg_conv;
23345 arg_conv.inner = (void*)(arg & (~1));
23346 arg_conv.is_owned = false;
23347 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23348 int64_t ret_val = FundingLocked_clone_ptr(&arg_conv);
23352 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_clone(uint32_t orig) {
23353 LDKFundingLocked orig_conv;
23354 orig_conv.inner = (void*)(orig & (~1));
23355 orig_conv.is_owned = false;
23356 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23357 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
23358 uint64_t ret_ref = 0;
23359 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23360 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23361 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23362 ret_ref = (uint64_t)ret_var.inner;
23363 if (ret_var.is_owned) {
23369 void __attribute__((visibility("default"))) TS_Shutdown_free(uint32_t this_obj) {
23370 LDKShutdown this_obj_conv;
23371 this_obj_conv.inner = (void*)(this_obj & (~1));
23372 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23373 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23374 Shutdown_free(this_obj_conv);
23377 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
23378 LDKShutdown this_ptr_conv;
23379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23380 this_ptr_conv.is_owned = false;
23381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23382 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23383 memcpy((uint8_t*)(ret_arr + 4), *Shutdown_get_channel_id(&this_ptr_conv), 32);
23387 void __attribute__((visibility("default"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23388 LDKShutdown this_ptr_conv;
23389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23390 this_ptr_conv.is_owned = false;
23391 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23392 LDKThirtyTwoBytes val_ref;
23393 CHECK(*((uint32_t*)val) == 32);
23394 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23395 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
23398 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
23399 LDKShutdown this_ptr_conv;
23400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23401 this_ptr_conv.is_owned = false;
23402 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23403 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
23404 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23405 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23409 void __attribute__((visibility("default"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
23410 LDKShutdown this_ptr_conv;
23411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23412 this_ptr_conv.is_owned = false;
23413 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23414 LDKCVec_u8Z val_ref;
23415 val_ref.datalen = *((uint32_t*)val);
23416 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
23417 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
23418 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
23421 uint32_t __attribute__((visibility("default"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
23422 LDKThirtyTwoBytes channel_id_arg_ref;
23423 CHECK(*((uint32_t*)channel_id_arg) == 32);
23424 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
23425 LDKCVec_u8Z scriptpubkey_arg_ref;
23426 scriptpubkey_arg_ref.datalen = *((uint32_t*)scriptpubkey_arg);
23427 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
23428 memcpy(scriptpubkey_arg_ref.data, (uint8_t*)(scriptpubkey_arg + 4), scriptpubkey_arg_ref.datalen);
23429 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
23430 uint64_t ret_ref = 0;
23431 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23432 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23433 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23434 ret_ref = (uint64_t)ret_var.inner;
23435 if (ret_var.is_owned) {
23441 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
23442 LDKShutdown ret_var = Shutdown_clone(arg);
23443 uint64_t ret_ref = 0;
23444 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23445 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23446 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23447 ret_ref = (uint64_t)ret_var.inner;
23448 if (ret_var.is_owned) {
23453 int64_t __attribute__((visibility("default"))) TS_Shutdown_clone_ptr(uint32_t arg) {
23454 LDKShutdown arg_conv;
23455 arg_conv.inner = (void*)(arg & (~1));
23456 arg_conv.is_owned = false;
23457 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23458 int64_t ret_val = Shutdown_clone_ptr(&arg_conv);
23462 uint32_t __attribute__((visibility("default"))) TS_Shutdown_clone(uint32_t orig) {
23463 LDKShutdown orig_conv;
23464 orig_conv.inner = (void*)(orig & (~1));
23465 orig_conv.is_owned = false;
23466 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23467 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
23468 uint64_t ret_ref = 0;
23469 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23470 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23471 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23472 ret_ref = (uint64_t)ret_var.inner;
23473 if (ret_var.is_owned) {
23479 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_free(uint32_t this_obj) {
23480 LDKClosingSignedFeeRange this_obj_conv;
23481 this_obj_conv.inner = (void*)(this_obj & (~1));
23482 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23483 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23484 ClosingSignedFeeRange_free(this_obj_conv);
23487 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint32_t this_ptr) {
23488 LDKClosingSignedFeeRange this_ptr_conv;
23489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23490 this_ptr_conv.is_owned = false;
23491 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23492 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
23496 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint32_t this_ptr, int64_t val) {
23497 LDKClosingSignedFeeRange this_ptr_conv;
23498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23499 this_ptr_conv.is_owned = false;
23500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23501 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
23504 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint32_t this_ptr) {
23505 LDKClosingSignedFeeRange this_ptr_conv;
23506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23507 this_ptr_conv.is_owned = false;
23508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23509 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
23513 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
23514 LDKClosingSignedFeeRange this_ptr_conv;
23515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23516 this_ptr_conv.is_owned = false;
23517 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23518 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
23521 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
23522 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
23523 uint64_t ret_ref = 0;
23524 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23525 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23526 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23527 ret_ref = (uint64_t)ret_var.inner;
23528 if (ret_var.is_owned) {
23534 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
23535 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
23536 uint64_t ret_ref = 0;
23537 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23538 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23539 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23540 ret_ref = (uint64_t)ret_var.inner;
23541 if (ret_var.is_owned) {
23546 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_clone_ptr(uint32_t arg) {
23547 LDKClosingSignedFeeRange arg_conv;
23548 arg_conv.inner = (void*)(arg & (~1));
23549 arg_conv.is_owned = false;
23550 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23551 int64_t ret_val = ClosingSignedFeeRange_clone_ptr(&arg_conv);
23555 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_clone(uint32_t orig) {
23556 LDKClosingSignedFeeRange orig_conv;
23557 orig_conv.inner = (void*)(orig & (~1));
23558 orig_conv.is_owned = false;
23559 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23560 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
23561 uint64_t ret_ref = 0;
23562 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23563 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23564 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23565 ret_ref = (uint64_t)ret_var.inner;
23566 if (ret_var.is_owned) {
23572 void __attribute__((visibility("default"))) TS_ClosingSigned_free(uint32_t this_obj) {
23573 LDKClosingSigned this_obj_conv;
23574 this_obj_conv.inner = (void*)(this_obj & (~1));
23575 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23576 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23577 ClosingSigned_free(this_obj_conv);
23580 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
23581 LDKClosingSigned this_ptr_conv;
23582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23583 this_ptr_conv.is_owned = false;
23584 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23585 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23586 memcpy((uint8_t*)(ret_arr + 4), *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
23590 void __attribute__((visibility("default"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23591 LDKClosingSigned this_ptr_conv;
23592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23593 this_ptr_conv.is_owned = false;
23594 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23595 LDKThirtyTwoBytes val_ref;
23596 CHECK(*((uint32_t*)val) == 32);
23597 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23598 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
23601 int64_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
23602 LDKClosingSigned this_ptr_conv;
23603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23604 this_ptr_conv.is_owned = false;
23605 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23606 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
23610 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
23611 LDKClosingSigned this_ptr_conv;
23612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23613 this_ptr_conv.is_owned = false;
23614 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23615 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
23618 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
23619 LDKClosingSigned this_ptr_conv;
23620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23621 this_ptr_conv.is_owned = false;
23622 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23623 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
23624 memcpy((uint8_t*)(ret_arr + 4), ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
23628 void __attribute__((visibility("default"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
23629 LDKClosingSigned this_ptr_conv;
23630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23631 this_ptr_conv.is_owned = false;
23632 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23633 LDKSignature val_ref;
23634 CHECK(*((uint32_t*)val) == 64);
23635 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
23636 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
23639 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_range(uint32_t this_ptr) {
23640 LDKClosingSigned this_ptr_conv;
23641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23642 this_ptr_conv.is_owned = false;
23643 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23644 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
23645 uint64_t ret_ref = 0;
23646 if ((uint64_t)ret_var.inner > 4096) {
23647 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23648 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23649 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23650 ret_ref = (uint64_t)ret_var.inner;
23651 if (ret_var.is_owned) {
23658 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_range(uint32_t this_ptr, uint32_t val) {
23659 LDKClosingSigned this_ptr_conv;
23660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23661 this_ptr_conv.is_owned = false;
23662 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23663 LDKClosingSignedFeeRange val_conv;
23664 val_conv.inner = (void*)(val & (~1));
23665 val_conv.is_owned = (val & 1) || (val == 0);
23666 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23667 val_conv = ClosingSignedFeeRange_clone(&val_conv);
23668 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
23671 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) {
23672 LDKThirtyTwoBytes channel_id_arg_ref;
23673 CHECK(*((uint32_t*)channel_id_arg) == 32);
23674 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
23675 LDKSignature signature_arg_ref;
23676 CHECK(*((uint32_t*)signature_arg) == 64);
23677 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
23678 LDKClosingSignedFeeRange fee_range_arg_conv;
23679 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
23680 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
23681 CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
23682 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
23683 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
23684 uint64_t ret_ref = 0;
23685 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23686 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23687 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23688 ret_ref = (uint64_t)ret_var.inner;
23689 if (ret_var.is_owned) {
23695 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
23696 LDKClosingSigned ret_var = ClosingSigned_clone(arg);
23697 uint64_t ret_ref = 0;
23698 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23699 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23700 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23701 ret_ref = (uint64_t)ret_var.inner;
23702 if (ret_var.is_owned) {
23707 int64_t __attribute__((visibility("default"))) TS_ClosingSigned_clone_ptr(uint32_t arg) {
23708 LDKClosingSigned arg_conv;
23709 arg_conv.inner = (void*)(arg & (~1));
23710 arg_conv.is_owned = false;
23711 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23712 int64_t ret_val = ClosingSigned_clone_ptr(&arg_conv);
23716 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_clone(uint32_t orig) {
23717 LDKClosingSigned orig_conv;
23718 orig_conv.inner = (void*)(orig & (~1));
23719 orig_conv.is_owned = false;
23720 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23721 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
23722 uint64_t ret_ref = 0;
23723 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23724 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23725 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23726 ret_ref = (uint64_t)ret_var.inner;
23727 if (ret_var.is_owned) {
23733 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_free(uint32_t this_obj) {
23734 LDKUpdateAddHTLC this_obj_conv;
23735 this_obj_conv.inner = (void*)(this_obj & (~1));
23736 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23737 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23738 UpdateAddHTLC_free(this_obj_conv);
23741 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
23742 LDKUpdateAddHTLC this_ptr_conv;
23743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23744 this_ptr_conv.is_owned = false;
23745 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23746 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23747 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
23751 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23752 LDKUpdateAddHTLC this_ptr_conv;
23753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23754 this_ptr_conv.is_owned = false;
23755 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23756 LDKThirtyTwoBytes val_ref;
23757 CHECK(*((uint32_t*)val) == 32);
23758 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23759 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
23762 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
23763 LDKUpdateAddHTLC this_ptr_conv;
23764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23765 this_ptr_conv.is_owned = false;
23766 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23767 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
23771 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
23772 LDKUpdateAddHTLC this_ptr_conv;
23773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23774 this_ptr_conv.is_owned = false;
23775 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23776 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
23779 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
23780 LDKUpdateAddHTLC this_ptr_conv;
23781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23782 this_ptr_conv.is_owned = false;
23783 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23784 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
23788 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
23789 LDKUpdateAddHTLC this_ptr_conv;
23790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23791 this_ptr_conv.is_owned = false;
23792 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23793 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
23796 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
23797 LDKUpdateAddHTLC this_ptr_conv;
23798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23799 this_ptr_conv.is_owned = false;
23800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23801 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23802 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
23806 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
23807 LDKUpdateAddHTLC this_ptr_conv;
23808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23809 this_ptr_conv.is_owned = false;
23810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23811 LDKThirtyTwoBytes val_ref;
23812 CHECK(*((uint32_t*)val) == 32);
23813 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23814 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
23817 int32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
23818 LDKUpdateAddHTLC this_ptr_conv;
23819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23820 this_ptr_conv.is_owned = false;
23821 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23822 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
23826 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
23827 LDKUpdateAddHTLC this_ptr_conv;
23828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23829 this_ptr_conv.is_owned = false;
23830 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23831 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
23834 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
23835 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
23836 uint64_t ret_ref = 0;
23837 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23838 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23839 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23840 ret_ref = (uint64_t)ret_var.inner;
23841 if (ret_var.is_owned) {
23846 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_clone_ptr(uint32_t arg) {
23847 LDKUpdateAddHTLC arg_conv;
23848 arg_conv.inner = (void*)(arg & (~1));
23849 arg_conv.is_owned = false;
23850 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23851 int64_t ret_val = UpdateAddHTLC_clone_ptr(&arg_conv);
23855 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
23856 LDKUpdateAddHTLC orig_conv;
23857 orig_conv.inner = (void*)(orig & (~1));
23858 orig_conv.is_owned = false;
23859 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23860 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
23861 uint64_t ret_ref = 0;
23862 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23863 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23864 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23865 ret_ref = (uint64_t)ret_var.inner;
23866 if (ret_var.is_owned) {
23872 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_free(uint32_t this_obj) {
23873 LDKUpdateFulfillHTLC this_obj_conv;
23874 this_obj_conv.inner = (void*)(this_obj & (~1));
23875 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23877 UpdateFulfillHTLC_free(this_obj_conv);
23880 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
23881 LDKUpdateFulfillHTLC this_ptr_conv;
23882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23883 this_ptr_conv.is_owned = false;
23884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23885 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23886 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
23890 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23891 LDKUpdateFulfillHTLC this_ptr_conv;
23892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23893 this_ptr_conv.is_owned = false;
23894 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23895 LDKThirtyTwoBytes val_ref;
23896 CHECK(*((uint32_t*)val) == 32);
23897 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23898 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
23901 int64_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
23902 LDKUpdateFulfillHTLC this_ptr_conv;
23903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23904 this_ptr_conv.is_owned = false;
23905 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23906 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
23910 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
23911 LDKUpdateFulfillHTLC this_ptr_conv;
23912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23913 this_ptr_conv.is_owned = false;
23914 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23915 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
23918 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
23919 LDKUpdateFulfillHTLC this_ptr_conv;
23920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23921 this_ptr_conv.is_owned = false;
23922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23923 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23924 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
23928 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
23929 LDKUpdateFulfillHTLC this_ptr_conv;
23930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23931 this_ptr_conv.is_owned = false;
23932 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23933 LDKThirtyTwoBytes val_ref;
23934 CHECK(*((uint32_t*)val) == 32);
23935 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23936 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
23939 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
23940 LDKThirtyTwoBytes channel_id_arg_ref;
23941 CHECK(*((uint32_t*)channel_id_arg) == 32);
23942 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
23943 LDKThirtyTwoBytes payment_preimage_arg_ref;
23944 CHECK(*((uint32_t*)payment_preimage_arg) == 32);
23945 memcpy(payment_preimage_arg_ref.data, (uint8_t*)(payment_preimage_arg + 4), 32);
23946 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
23947 uint64_t ret_ref = 0;
23948 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23949 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23950 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23951 ret_ref = (uint64_t)ret_var.inner;
23952 if (ret_var.is_owned) {
23958 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
23959 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
23960 uint64_t ret_ref = 0;
23961 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23962 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23963 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23964 ret_ref = (uint64_t)ret_var.inner;
23965 if (ret_var.is_owned) {
23970 int64_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_clone_ptr(uint32_t arg) {
23971 LDKUpdateFulfillHTLC arg_conv;
23972 arg_conv.inner = (void*)(arg & (~1));
23973 arg_conv.is_owned = false;
23974 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23975 int64_t ret_val = UpdateFulfillHTLC_clone_ptr(&arg_conv);
23979 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
23980 LDKUpdateFulfillHTLC orig_conv;
23981 orig_conv.inner = (void*)(orig & (~1));
23982 orig_conv.is_owned = false;
23983 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23984 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
23985 uint64_t ret_ref = 0;
23986 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23987 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23988 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23989 ret_ref = (uint64_t)ret_var.inner;
23990 if (ret_var.is_owned) {
23996 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_free(uint32_t this_obj) {
23997 LDKUpdateFailHTLC this_obj_conv;
23998 this_obj_conv.inner = (void*)(this_obj & (~1));
23999 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24000 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24001 UpdateFailHTLC_free(this_obj_conv);
24004 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
24005 LDKUpdateFailHTLC this_ptr_conv;
24006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24007 this_ptr_conv.is_owned = false;
24008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24009 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24010 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
24014 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24015 LDKUpdateFailHTLC this_ptr_conv;
24016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24017 this_ptr_conv.is_owned = false;
24018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24019 LDKThirtyTwoBytes val_ref;
24020 CHECK(*((uint32_t*)val) == 32);
24021 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24022 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
24025 int64_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
24026 LDKUpdateFailHTLC this_ptr_conv;
24027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24028 this_ptr_conv.is_owned = false;
24029 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24030 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
24034 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
24035 LDKUpdateFailHTLC this_ptr_conv;
24036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24037 this_ptr_conv.is_owned = false;
24038 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24039 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
24042 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
24043 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
24044 uint64_t ret_ref = 0;
24045 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24046 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24047 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24048 ret_ref = (uint64_t)ret_var.inner;
24049 if (ret_var.is_owned) {
24054 int64_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_clone_ptr(uint32_t arg) {
24055 LDKUpdateFailHTLC arg_conv;
24056 arg_conv.inner = (void*)(arg & (~1));
24057 arg_conv.is_owned = false;
24058 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24059 int64_t ret_val = UpdateFailHTLC_clone_ptr(&arg_conv);
24063 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
24064 LDKUpdateFailHTLC orig_conv;
24065 orig_conv.inner = (void*)(orig & (~1));
24066 orig_conv.is_owned = false;
24067 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24068 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
24069 uint64_t ret_ref = 0;
24070 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24071 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24072 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24073 ret_ref = (uint64_t)ret_var.inner;
24074 if (ret_var.is_owned) {
24080 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_obj) {
24081 LDKUpdateFailMalformedHTLC this_obj_conv;
24082 this_obj_conv.inner = (void*)(this_obj & (~1));
24083 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24084 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24085 UpdateFailMalformedHTLC_free(this_obj_conv);
24088 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
24089 LDKUpdateFailMalformedHTLC this_ptr_conv;
24090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24091 this_ptr_conv.is_owned = false;
24092 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24093 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24094 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
24098 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24099 LDKUpdateFailMalformedHTLC this_ptr_conv;
24100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24101 this_ptr_conv.is_owned = false;
24102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24103 LDKThirtyTwoBytes val_ref;
24104 CHECK(*((uint32_t*)val) == 32);
24105 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24106 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
24109 int64_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
24110 LDKUpdateFailMalformedHTLC this_ptr_conv;
24111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24112 this_ptr_conv.is_owned = false;
24113 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24114 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
24118 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
24119 LDKUpdateFailMalformedHTLC this_ptr_conv;
24120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24121 this_ptr_conv.is_owned = false;
24122 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24123 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
24126 int16_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
24127 LDKUpdateFailMalformedHTLC this_ptr_conv;
24128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24129 this_ptr_conv.is_owned = false;
24130 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24131 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
24135 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
24136 LDKUpdateFailMalformedHTLC this_ptr_conv;
24137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24138 this_ptr_conv.is_owned = false;
24139 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24140 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
24143 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
24144 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
24145 uint64_t ret_ref = 0;
24146 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24147 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24148 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24149 ret_ref = (uint64_t)ret_var.inner;
24150 if (ret_var.is_owned) {
24155 int64_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint32_t arg) {
24156 LDKUpdateFailMalformedHTLC arg_conv;
24157 arg_conv.inner = (void*)(arg & (~1));
24158 arg_conv.is_owned = false;
24159 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24160 int64_t ret_val = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
24164 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
24165 LDKUpdateFailMalformedHTLC orig_conv;
24166 orig_conv.inner = (void*)(orig & (~1));
24167 orig_conv.is_owned = false;
24168 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24169 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
24170 uint64_t ret_ref = 0;
24171 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24172 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24173 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24174 ret_ref = (uint64_t)ret_var.inner;
24175 if (ret_var.is_owned) {
24181 void __attribute__((visibility("default"))) TS_CommitmentSigned_free(uint32_t this_obj) {
24182 LDKCommitmentSigned this_obj_conv;
24183 this_obj_conv.inner = (void*)(this_obj & (~1));
24184 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24185 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24186 CommitmentSigned_free(this_obj_conv);
24189 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
24190 LDKCommitmentSigned this_ptr_conv;
24191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24192 this_ptr_conv.is_owned = false;
24193 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24194 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24195 memcpy((uint8_t*)(ret_arr + 4), *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
24199 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24200 LDKCommitmentSigned this_ptr_conv;
24201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24202 this_ptr_conv.is_owned = false;
24203 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24204 LDKThirtyTwoBytes val_ref;
24205 CHECK(*((uint32_t*)val) == 32);
24206 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24207 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
24210 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
24211 LDKCommitmentSigned this_ptr_conv;
24212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24213 this_ptr_conv.is_owned = false;
24214 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24215 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
24216 memcpy((uint8_t*)(ret_arr + 4), CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
24220 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
24221 LDKCommitmentSigned this_ptr_conv;
24222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24223 this_ptr_conv.is_owned = false;
24224 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24225 LDKSignature val_ref;
24226 CHECK(*((uint32_t*)val) == 64);
24227 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
24228 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
24231 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
24232 LDKCommitmentSigned this_ptr_conv;
24233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24234 this_ptr_conv.is_owned = false;
24235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24236 LDKCVec_SignatureZ val_constr;
24237 val_constr.datalen = *((uint32_t*)val);
24238 if (val_constr.datalen > 0)
24239 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
24241 val_constr.data = NULL;
24242 int8_tArray* val_vals = (int8_tArray*)(val + 4);
24243 for (size_t m = 0; m < val_constr.datalen; m++) {
24244 int8_tArray val_conv_12 = val_vals[m];
24245 LDKSignature val_conv_12_ref;
24246 CHECK(*((uint32_t*)val_conv_12) == 64);
24247 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
24248 val_constr.data[m] = val_conv_12_ref;
24250 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
24253 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
24254 LDKThirtyTwoBytes channel_id_arg_ref;
24255 CHECK(*((uint32_t*)channel_id_arg) == 32);
24256 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
24257 LDKSignature signature_arg_ref;
24258 CHECK(*((uint32_t*)signature_arg) == 64);
24259 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
24260 LDKCVec_SignatureZ htlc_signatures_arg_constr;
24261 htlc_signatures_arg_constr.datalen = *((uint32_t*)htlc_signatures_arg);
24262 if (htlc_signatures_arg_constr.datalen > 0)
24263 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
24265 htlc_signatures_arg_constr.data = NULL;
24266 int8_tArray* htlc_signatures_arg_vals = (int8_tArray*)(htlc_signatures_arg + 4);
24267 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
24268 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
24269 LDKSignature htlc_signatures_arg_conv_12_ref;
24270 CHECK(*((uint32_t*)htlc_signatures_arg_conv_12) == 64);
24271 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, (uint8_t*)(htlc_signatures_arg_conv_12 + 4), 64);
24272 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
24274 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
24275 uint64_t ret_ref = 0;
24276 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24277 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24278 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24279 ret_ref = (uint64_t)ret_var.inner;
24280 if (ret_var.is_owned) {
24286 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
24287 LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
24288 uint64_t ret_ref = 0;
24289 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24290 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24291 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24292 ret_ref = (uint64_t)ret_var.inner;
24293 if (ret_var.is_owned) {
24298 int64_t __attribute__((visibility("default"))) TS_CommitmentSigned_clone_ptr(uint32_t arg) {
24299 LDKCommitmentSigned arg_conv;
24300 arg_conv.inner = (void*)(arg & (~1));
24301 arg_conv.is_owned = false;
24302 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24303 int64_t ret_val = CommitmentSigned_clone_ptr(&arg_conv);
24307 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_clone(uint32_t orig) {
24308 LDKCommitmentSigned orig_conv;
24309 orig_conv.inner = (void*)(orig & (~1));
24310 orig_conv.is_owned = false;
24311 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24312 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
24313 uint64_t ret_ref = 0;
24314 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24315 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24316 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24317 ret_ref = (uint64_t)ret_var.inner;
24318 if (ret_var.is_owned) {
24324 void __attribute__((visibility("default"))) TS_RevokeAndACK_free(uint32_t this_obj) {
24325 LDKRevokeAndACK this_obj_conv;
24326 this_obj_conv.inner = (void*)(this_obj & (~1));
24327 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24328 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24329 RevokeAndACK_free(this_obj_conv);
24332 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
24333 LDKRevokeAndACK this_ptr_conv;
24334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24335 this_ptr_conv.is_owned = false;
24336 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24337 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24338 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
24342 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24343 LDKRevokeAndACK this_ptr_conv;
24344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24345 this_ptr_conv.is_owned = false;
24346 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24347 LDKThirtyTwoBytes val_ref;
24348 CHECK(*((uint32_t*)val) == 32);
24349 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24350 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
24353 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
24354 LDKRevokeAndACK this_ptr_conv;
24355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24356 this_ptr_conv.is_owned = false;
24357 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24358 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24359 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
24363 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
24364 LDKRevokeAndACK this_ptr_conv;
24365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24366 this_ptr_conv.is_owned = false;
24367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24368 LDKThirtyTwoBytes val_ref;
24369 CHECK(*((uint32_t*)val) == 32);
24370 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24371 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
24374 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
24375 LDKRevokeAndACK this_ptr_conv;
24376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24377 this_ptr_conv.is_owned = false;
24378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24379 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
24380 memcpy((uint8_t*)(ret_arr + 4), RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
24384 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
24385 LDKRevokeAndACK this_ptr_conv;
24386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24387 this_ptr_conv.is_owned = false;
24388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24389 LDKPublicKey val_ref;
24390 CHECK(*((uint32_t*)val) == 33);
24391 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
24392 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
24395 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) {
24396 LDKThirtyTwoBytes channel_id_arg_ref;
24397 CHECK(*((uint32_t*)channel_id_arg) == 32);
24398 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
24399 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
24400 CHECK(*((uint32_t*)per_commitment_secret_arg) == 32);
24401 memcpy(per_commitment_secret_arg_ref.data, (uint8_t*)(per_commitment_secret_arg + 4), 32);
24402 LDKPublicKey next_per_commitment_point_arg_ref;
24403 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
24404 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
24405 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
24406 uint64_t ret_ref = 0;
24407 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24408 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24409 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24410 ret_ref = (uint64_t)ret_var.inner;
24411 if (ret_var.is_owned) {
24417 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
24418 LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
24419 uint64_t ret_ref = 0;
24420 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24421 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24422 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24423 ret_ref = (uint64_t)ret_var.inner;
24424 if (ret_var.is_owned) {
24429 int64_t __attribute__((visibility("default"))) TS_RevokeAndACK_clone_ptr(uint32_t arg) {
24430 LDKRevokeAndACK arg_conv;
24431 arg_conv.inner = (void*)(arg & (~1));
24432 arg_conv.is_owned = false;
24433 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24434 int64_t ret_val = RevokeAndACK_clone_ptr(&arg_conv);
24438 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_clone(uint32_t orig) {
24439 LDKRevokeAndACK orig_conv;
24440 orig_conv.inner = (void*)(orig & (~1));
24441 orig_conv.is_owned = false;
24442 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24443 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
24444 uint64_t ret_ref = 0;
24445 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24446 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24447 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24448 ret_ref = (uint64_t)ret_var.inner;
24449 if (ret_var.is_owned) {
24455 void __attribute__((visibility("default"))) TS_UpdateFee_free(uint32_t this_obj) {
24456 LDKUpdateFee this_obj_conv;
24457 this_obj_conv.inner = (void*)(this_obj & (~1));
24458 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24459 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24460 UpdateFee_free(this_obj_conv);
24463 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
24464 LDKUpdateFee this_ptr_conv;
24465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24466 this_ptr_conv.is_owned = false;
24467 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24468 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24469 memcpy((uint8_t*)(ret_arr + 4), *UpdateFee_get_channel_id(&this_ptr_conv), 32);
24473 void __attribute__((visibility("default"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24474 LDKUpdateFee this_ptr_conv;
24475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24476 this_ptr_conv.is_owned = false;
24477 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24478 LDKThirtyTwoBytes val_ref;
24479 CHECK(*((uint32_t*)val) == 32);
24480 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24481 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
24484 int32_t __attribute__((visibility("default"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
24485 LDKUpdateFee this_ptr_conv;
24486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24487 this_ptr_conv.is_owned = false;
24488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24489 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
24493 void __attribute__((visibility("default"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
24494 LDKUpdateFee this_ptr_conv;
24495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24496 this_ptr_conv.is_owned = false;
24497 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24498 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
24501 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
24502 LDKThirtyTwoBytes channel_id_arg_ref;
24503 CHECK(*((uint32_t*)channel_id_arg) == 32);
24504 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
24505 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
24506 uint64_t ret_ref = 0;
24507 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24508 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24509 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24510 ret_ref = (uint64_t)ret_var.inner;
24511 if (ret_var.is_owned) {
24517 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
24518 LDKUpdateFee ret_var = UpdateFee_clone(arg);
24519 uint64_t ret_ref = 0;
24520 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24521 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24522 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24523 ret_ref = (uint64_t)ret_var.inner;
24524 if (ret_var.is_owned) {
24529 int64_t __attribute__((visibility("default"))) TS_UpdateFee_clone_ptr(uint32_t arg) {
24530 LDKUpdateFee arg_conv;
24531 arg_conv.inner = (void*)(arg & (~1));
24532 arg_conv.is_owned = false;
24533 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24534 int64_t ret_val = UpdateFee_clone_ptr(&arg_conv);
24538 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_clone(uint32_t orig) {
24539 LDKUpdateFee orig_conv;
24540 orig_conv.inner = (void*)(orig & (~1));
24541 orig_conv.is_owned = false;
24542 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24543 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
24544 uint64_t ret_ref = 0;
24545 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24546 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24547 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24548 ret_ref = (uint64_t)ret_var.inner;
24549 if (ret_var.is_owned) {
24555 void __attribute__((visibility("default"))) TS_DataLossProtect_free(uint32_t this_obj) {
24556 LDKDataLossProtect this_obj_conv;
24557 this_obj_conv.inner = (void*)(this_obj & (~1));
24558 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24559 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24560 DataLossProtect_free(this_obj_conv);
24563 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_your_last_per_commitment_secret(uint32_t this_ptr) {
24564 LDKDataLossProtect this_ptr_conv;
24565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24566 this_ptr_conv.is_owned = false;
24567 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24568 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24569 memcpy((uint8_t*)(ret_arr + 4), *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
24573 void __attribute__((visibility("default"))) TS_DataLossProtect_set_your_last_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
24574 LDKDataLossProtect this_ptr_conv;
24575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24576 this_ptr_conv.is_owned = false;
24577 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24578 LDKThirtyTwoBytes val_ref;
24579 CHECK(*((uint32_t*)val) == 32);
24580 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24581 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
24584 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_my_current_per_commitment_point(uint32_t this_ptr) {
24585 LDKDataLossProtect this_ptr_conv;
24586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24587 this_ptr_conv.is_owned = false;
24588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24589 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
24590 memcpy((uint8_t*)(ret_arr + 4), DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
24594 void __attribute__((visibility("default"))) TS_DataLossProtect_set_my_current_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
24595 LDKDataLossProtect this_ptr_conv;
24596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24597 this_ptr_conv.is_owned = false;
24598 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24599 LDKPublicKey val_ref;
24600 CHECK(*((uint32_t*)val) == 33);
24601 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
24602 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
24605 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_new(int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
24606 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
24607 CHECK(*((uint32_t*)your_last_per_commitment_secret_arg) == 32);
24608 memcpy(your_last_per_commitment_secret_arg_ref.data, (uint8_t*)(your_last_per_commitment_secret_arg + 4), 32);
24609 LDKPublicKey my_current_per_commitment_point_arg_ref;
24610 CHECK(*((uint32_t*)my_current_per_commitment_point_arg) == 33);
24611 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(my_current_per_commitment_point_arg + 4), 33);
24612 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
24613 uint64_t ret_ref = 0;
24614 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24615 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24616 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24617 ret_ref = (uint64_t)ret_var.inner;
24618 if (ret_var.is_owned) {
24624 static inline uint64_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
24625 LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
24626 uint64_t ret_ref = 0;
24627 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24628 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24629 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24630 ret_ref = (uint64_t)ret_var.inner;
24631 if (ret_var.is_owned) {
24636 int64_t __attribute__((visibility("default"))) TS_DataLossProtect_clone_ptr(uint32_t arg) {
24637 LDKDataLossProtect arg_conv;
24638 arg_conv.inner = (void*)(arg & (~1));
24639 arg_conv.is_owned = false;
24640 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24641 int64_t ret_val = DataLossProtect_clone_ptr(&arg_conv);
24645 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_clone(uint32_t orig) {
24646 LDKDataLossProtect orig_conv;
24647 orig_conv.inner = (void*)(orig & (~1));
24648 orig_conv.is_owned = false;
24649 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24650 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
24651 uint64_t ret_ref = 0;
24652 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24653 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24654 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24655 ret_ref = (uint64_t)ret_var.inner;
24656 if (ret_var.is_owned) {
24662 void __attribute__((visibility("default"))) TS_ChannelReestablish_free(uint32_t this_obj) {
24663 LDKChannelReestablish this_obj_conv;
24664 this_obj_conv.inner = (void*)(this_obj & (~1));
24665 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24667 ChannelReestablish_free(this_obj_conv);
24670 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
24671 LDKChannelReestablish this_ptr_conv;
24672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24673 this_ptr_conv.is_owned = false;
24674 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24675 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24676 memcpy((uint8_t*)(ret_arr + 4), *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
24680 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24681 LDKChannelReestablish this_ptr_conv;
24682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24683 this_ptr_conv.is_owned = false;
24684 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24685 LDKThirtyTwoBytes val_ref;
24686 CHECK(*((uint32_t*)val) == 32);
24687 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24688 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
24691 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
24692 LDKChannelReestablish this_ptr_conv;
24693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24694 this_ptr_conv.is_owned = false;
24695 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24696 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
24700 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_local_commitment_number(uint32_t this_ptr, int64_t val) {
24701 LDKChannelReestablish this_ptr_conv;
24702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24703 this_ptr_conv.is_owned = false;
24704 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24705 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
24708 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
24709 LDKChannelReestablish this_ptr_conv;
24710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24711 this_ptr_conv.is_owned = false;
24712 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24713 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
24717 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_remote_commitment_number(uint32_t this_ptr, int64_t val) {
24718 LDKChannelReestablish this_ptr_conv;
24719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24720 this_ptr_conv.is_owned = false;
24721 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24722 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
24725 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
24726 LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
24727 uint64_t ret_ref = 0;
24728 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24729 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24730 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24731 ret_ref = (uint64_t)ret_var.inner;
24732 if (ret_var.is_owned) {
24737 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_clone_ptr(uint32_t arg) {
24738 LDKChannelReestablish arg_conv;
24739 arg_conv.inner = (void*)(arg & (~1));
24740 arg_conv.is_owned = false;
24741 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24742 int64_t ret_val = ChannelReestablish_clone_ptr(&arg_conv);
24746 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_clone(uint32_t orig) {
24747 LDKChannelReestablish orig_conv;
24748 orig_conv.inner = (void*)(orig & (~1));
24749 orig_conv.is_owned = false;
24750 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24751 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
24752 uint64_t ret_ref = 0;
24753 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24754 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24755 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24756 ret_ref = (uint64_t)ret_var.inner;
24757 if (ret_var.is_owned) {
24763 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_free(uint32_t this_obj) {
24764 LDKAnnouncementSignatures this_obj_conv;
24765 this_obj_conv.inner = (void*)(this_obj & (~1));
24766 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24767 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24768 AnnouncementSignatures_free(this_obj_conv);
24771 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
24772 LDKAnnouncementSignatures this_ptr_conv;
24773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24774 this_ptr_conv.is_owned = false;
24775 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24776 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24777 memcpy((uint8_t*)(ret_arr + 4), *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
24781 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24782 LDKAnnouncementSignatures this_ptr_conv;
24783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24784 this_ptr_conv.is_owned = false;
24785 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24786 LDKThirtyTwoBytes val_ref;
24787 CHECK(*((uint32_t*)val) == 32);
24788 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24789 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
24792 int64_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
24793 LDKAnnouncementSignatures this_ptr_conv;
24794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24795 this_ptr_conv.is_owned = false;
24796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24797 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
24801 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
24802 LDKAnnouncementSignatures this_ptr_conv;
24803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24804 this_ptr_conv.is_owned = false;
24805 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24806 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
24809 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
24810 LDKAnnouncementSignatures this_ptr_conv;
24811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24812 this_ptr_conv.is_owned = false;
24813 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24814 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
24815 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
24819 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
24820 LDKAnnouncementSignatures this_ptr_conv;
24821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24822 this_ptr_conv.is_owned = false;
24823 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24824 LDKSignature val_ref;
24825 CHECK(*((uint32_t*)val) == 64);
24826 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
24827 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
24830 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
24831 LDKAnnouncementSignatures this_ptr_conv;
24832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24833 this_ptr_conv.is_owned = false;
24834 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24835 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
24836 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
24840 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
24841 LDKAnnouncementSignatures this_ptr_conv;
24842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24843 this_ptr_conv.is_owned = false;
24844 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24845 LDKSignature val_ref;
24846 CHECK(*((uint32_t*)val) == 64);
24847 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
24848 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
24851 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) {
24852 LDKThirtyTwoBytes channel_id_arg_ref;
24853 CHECK(*((uint32_t*)channel_id_arg) == 32);
24854 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
24855 LDKSignature node_signature_arg_ref;
24856 CHECK(*((uint32_t*)node_signature_arg) == 64);
24857 memcpy(node_signature_arg_ref.compact_form, (uint8_t*)(node_signature_arg + 4), 64);
24858 LDKSignature bitcoin_signature_arg_ref;
24859 CHECK(*((uint32_t*)bitcoin_signature_arg) == 64);
24860 memcpy(bitcoin_signature_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_arg + 4), 64);
24861 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
24862 uint64_t ret_ref = 0;
24863 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24864 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24865 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24866 ret_ref = (uint64_t)ret_var.inner;
24867 if (ret_var.is_owned) {
24873 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
24874 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
24875 uint64_t ret_ref = 0;
24876 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24877 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24878 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24879 ret_ref = (uint64_t)ret_var.inner;
24880 if (ret_var.is_owned) {
24885 int64_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_clone_ptr(uint32_t arg) {
24886 LDKAnnouncementSignatures arg_conv;
24887 arg_conv.inner = (void*)(arg & (~1));
24888 arg_conv.is_owned = false;
24889 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24890 int64_t ret_val = AnnouncementSignatures_clone_ptr(&arg_conv);
24894 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
24895 LDKAnnouncementSignatures orig_conv;
24896 orig_conv.inner = (void*)(orig & (~1));
24897 orig_conv.is_owned = false;
24898 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24899 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
24900 uint64_t ret_ref = 0;
24901 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24902 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24903 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24904 ret_ref = (uint64_t)ret_var.inner;
24905 if (ret_var.is_owned) {
24911 void __attribute__((visibility("default"))) TS_NetAddress_free(uint32_t this_ptr) {
24912 if ((this_ptr & 1) != 0) return;
24913 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
24914 CHECK_ACCESS(this_ptr_ptr);
24915 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
24916 FREE((void*)this_ptr);
24917 NetAddress_free(this_ptr_conv);
24920 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
24921 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
24922 *ret_copy = NetAddress_clone(arg);
24923 uint64_t ret_ref = (uint64_t)ret_copy;
24926 int64_t __attribute__((visibility("default"))) TS_NetAddress_clone_ptr(uint32_t arg) {
24927 LDKNetAddress* arg_conv = (LDKNetAddress*)arg;
24928 int64_t ret_val = NetAddress_clone_ptr(arg_conv);
24932 uint32_t __attribute__((visibility("default"))) TS_NetAddress_clone(uint32_t orig) {
24933 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
24934 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
24935 *ret_copy = NetAddress_clone(orig_conv);
24936 uint64_t ret_ref = (uint64_t)ret_copy;
24940 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
24941 LDKFourBytes addr_ref;
24942 CHECK(*((uint32_t*)addr) == 4);
24943 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 4);
24944 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
24945 *ret_copy = NetAddress_ipv4(addr_ref, port);
24946 uint64_t ret_ref = (uint64_t)ret_copy;
24950 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
24951 LDKSixteenBytes addr_ref;
24952 CHECK(*((uint32_t*)addr) == 16);
24953 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 16);
24954 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
24955 *ret_copy = NetAddress_ipv6(addr_ref, port);
24956 uint64_t ret_ref = (uint64_t)ret_copy;
24960 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v2(int8_tArray addr, int16_t port) {
24961 LDKTenBytes addr_ref;
24962 CHECK(*((uint32_t*)addr) == 10);
24963 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 10);
24964 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
24965 *ret_copy = NetAddress_onion_v2(addr_ref, port);
24966 uint64_t ret_ref = (uint64_t)ret_copy;
24970 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v3(int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
24971 LDKThirtyTwoBytes ed25519_pubkey_ref;
24972 CHECK(*((uint32_t*)ed25519_pubkey) == 32);
24973 memcpy(ed25519_pubkey_ref.data, (uint8_t*)(ed25519_pubkey + 4), 32);
24974 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
24975 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
24976 uint64_t ret_ref = (uint64_t)ret_copy;
24980 int8_tArray __attribute__((visibility("default"))) TS_NetAddress_write(uint32_t obj) {
24981 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
24982 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
24983 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24984 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24985 CVec_u8Z_free(ret_var);
24989 uint32_t __attribute__((visibility("default"))) TS_NetAddress_read(int8_tArray ser) {
24990 LDKu8slice ser_ref;
24991 ser_ref.datalen = *((uint32_t*)ser);
24992 ser_ref.data = (int8_t*)(ser + 4);
24993 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
24994 *ret_conv = NetAddress_read(ser_ref);
24995 return (uint64_t)ret_conv;
24998 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_obj) {
24999 LDKUnsignedNodeAnnouncement this_obj_conv;
25000 this_obj_conv.inner = (void*)(this_obj & (~1));
25001 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25002 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25003 UnsignedNodeAnnouncement_free(this_obj_conv);
25006 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
25007 LDKUnsignedNodeAnnouncement this_ptr_conv;
25008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25009 this_ptr_conv.is_owned = false;
25010 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25011 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
25012 uint64_t ret_ref = 0;
25013 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25014 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25015 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25016 ret_ref = (uint64_t)ret_var.inner;
25017 if (ret_var.is_owned) {
25023 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
25024 LDKUnsignedNodeAnnouncement this_ptr_conv;
25025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25026 this_ptr_conv.is_owned = false;
25027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25028 LDKNodeFeatures val_conv;
25029 val_conv.inner = (void*)(val & (~1));
25030 val_conv.is_owned = (val & 1) || (val == 0);
25031 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25032 val_conv = NodeFeatures_clone(&val_conv);
25033 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
25036 int32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
25037 LDKUnsignedNodeAnnouncement this_ptr_conv;
25038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25039 this_ptr_conv.is_owned = false;
25040 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25041 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
25045 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
25046 LDKUnsignedNodeAnnouncement this_ptr_conv;
25047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25048 this_ptr_conv.is_owned = false;
25049 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25050 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
25053 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
25054 LDKUnsignedNodeAnnouncement this_ptr_conv;
25055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25056 this_ptr_conv.is_owned = false;
25057 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25058 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
25059 memcpy((uint8_t*)(ret_arr + 4), UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
25063 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
25064 LDKUnsignedNodeAnnouncement this_ptr_conv;
25065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25066 this_ptr_conv.is_owned = false;
25067 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25068 LDKPublicKey val_ref;
25069 CHECK(*((uint32_t*)val) == 33);
25070 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
25071 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
25074 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
25075 LDKUnsignedNodeAnnouncement this_ptr_conv;
25076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25077 this_ptr_conv.is_owned = false;
25078 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25079 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
25080 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
25084 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
25085 LDKUnsignedNodeAnnouncement this_ptr_conv;
25086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25087 this_ptr_conv.is_owned = false;
25088 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25089 LDKThreeBytes val_ref;
25090 CHECK(*((uint32_t*)val) == 3);
25091 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
25092 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
25095 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
25096 LDKUnsignedNodeAnnouncement this_ptr_conv;
25097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25098 this_ptr_conv.is_owned = false;
25099 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25100 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
25101 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
25105 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
25106 LDKUnsignedNodeAnnouncement this_ptr_conv;
25107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25108 this_ptr_conv.is_owned = false;
25109 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25110 LDKThirtyTwoBytes val_ref;
25111 CHECK(*((uint32_t*)val) == 32);
25112 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
25113 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
25116 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
25117 LDKUnsignedNodeAnnouncement this_ptr_conv;
25118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25119 this_ptr_conv.is_owned = false;
25120 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25121 LDKCVec_NetAddressZ val_constr;
25122 val_constr.datalen = *((uint32_t*)val);
25123 if (val_constr.datalen > 0)
25124 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
25126 val_constr.data = NULL;
25127 uint32_t* val_vals = (uint32_t*)(val + 4);
25128 for (size_t m = 0; m < val_constr.datalen; m++) {
25129 uint32_t val_conv_12 = val_vals[m];
25130 void* val_conv_12_ptr = (void*)(((uint64_t)val_conv_12) & ~1);
25131 CHECK_ACCESS(val_conv_12_ptr);
25132 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
25133 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
25134 val_constr.data[m] = val_conv_12_conv;
25136 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
25139 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
25140 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
25141 uint64_t ret_ref = 0;
25142 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25143 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25144 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25145 ret_ref = (uint64_t)ret_var.inner;
25146 if (ret_var.is_owned) {
25151 int64_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint32_t arg) {
25152 LDKUnsignedNodeAnnouncement arg_conv;
25153 arg_conv.inner = (void*)(arg & (~1));
25154 arg_conv.is_owned = false;
25155 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25156 int64_t ret_val = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
25160 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
25161 LDKUnsignedNodeAnnouncement orig_conv;
25162 orig_conv.inner = (void*)(orig & (~1));
25163 orig_conv.is_owned = false;
25164 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25165 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
25166 uint64_t ret_ref = 0;
25167 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25168 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25169 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25170 ret_ref = (uint64_t)ret_var.inner;
25171 if (ret_var.is_owned) {
25177 void __attribute__((visibility("default"))) TS_NodeAnnouncement_free(uint32_t this_obj) {
25178 LDKNodeAnnouncement this_obj_conv;
25179 this_obj_conv.inner = (void*)(this_obj & (~1));
25180 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25181 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25182 NodeAnnouncement_free(this_obj_conv);
25185 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
25186 LDKNodeAnnouncement this_ptr_conv;
25187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25188 this_ptr_conv.is_owned = false;
25189 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25190 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
25191 memcpy((uint8_t*)(ret_arr + 4), NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
25195 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
25196 LDKNodeAnnouncement this_ptr_conv;
25197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25198 this_ptr_conv.is_owned = false;
25199 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25200 LDKSignature val_ref;
25201 CHECK(*((uint32_t*)val) == 64);
25202 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
25203 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
25206 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
25207 LDKNodeAnnouncement this_ptr_conv;
25208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25209 this_ptr_conv.is_owned = false;
25210 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25211 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
25212 uint64_t ret_ref = 0;
25213 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25214 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25215 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25216 ret_ref = (uint64_t)ret_var.inner;
25217 if (ret_var.is_owned) {
25223 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
25224 LDKNodeAnnouncement this_ptr_conv;
25225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25226 this_ptr_conv.is_owned = false;
25227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25228 LDKUnsignedNodeAnnouncement val_conv;
25229 val_conv.inner = (void*)(val & (~1));
25230 val_conv.is_owned = (val & 1) || (val == 0);
25231 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25232 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
25233 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
25236 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
25237 LDKSignature signature_arg_ref;
25238 CHECK(*((uint32_t*)signature_arg) == 64);
25239 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
25240 LDKUnsignedNodeAnnouncement contents_arg_conv;
25241 contents_arg_conv.inner = (void*)(contents_arg & (~1));
25242 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
25243 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
25244 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
25245 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
25246 uint64_t ret_ref = 0;
25247 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25248 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25249 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25250 ret_ref = (uint64_t)ret_var.inner;
25251 if (ret_var.is_owned) {
25257 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
25258 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
25259 uint64_t ret_ref = 0;
25260 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25261 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25262 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25263 ret_ref = (uint64_t)ret_var.inner;
25264 if (ret_var.is_owned) {
25269 int64_t __attribute__((visibility("default"))) TS_NodeAnnouncement_clone_ptr(uint32_t arg) {
25270 LDKNodeAnnouncement arg_conv;
25271 arg_conv.inner = (void*)(arg & (~1));
25272 arg_conv.is_owned = false;
25273 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25274 int64_t ret_val = NodeAnnouncement_clone_ptr(&arg_conv);
25278 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_clone(uint32_t orig) {
25279 LDKNodeAnnouncement orig_conv;
25280 orig_conv.inner = (void*)(orig & (~1));
25281 orig_conv.is_owned = false;
25282 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25283 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
25284 uint64_t ret_ref = 0;
25285 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25286 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25287 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25288 ret_ref = (uint64_t)ret_var.inner;
25289 if (ret_var.is_owned) {
25295 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_obj) {
25296 LDKUnsignedChannelAnnouncement this_obj_conv;
25297 this_obj_conv.inner = (void*)(this_obj & (~1));
25298 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25299 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25300 UnsignedChannelAnnouncement_free(this_obj_conv);
25303 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
25304 LDKUnsignedChannelAnnouncement this_ptr_conv;
25305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25306 this_ptr_conv.is_owned = false;
25307 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25308 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
25309 uint64_t ret_ref = 0;
25310 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25311 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25312 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25313 ret_ref = (uint64_t)ret_var.inner;
25314 if (ret_var.is_owned) {
25320 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
25321 LDKUnsignedChannelAnnouncement this_ptr_conv;
25322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25323 this_ptr_conv.is_owned = false;
25324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25325 LDKChannelFeatures val_conv;
25326 val_conv.inner = (void*)(val & (~1));
25327 val_conv.is_owned = (val & 1) || (val == 0);
25328 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25329 val_conv = ChannelFeatures_clone(&val_conv);
25330 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
25333 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
25334 LDKUnsignedChannelAnnouncement this_ptr_conv;
25335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25336 this_ptr_conv.is_owned = false;
25337 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25338 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
25339 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
25343 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
25344 LDKUnsignedChannelAnnouncement this_ptr_conv;
25345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25346 this_ptr_conv.is_owned = false;
25347 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25348 LDKThirtyTwoBytes val_ref;
25349 CHECK(*((uint32_t*)val) == 32);
25350 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
25351 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
25354 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
25355 LDKUnsignedChannelAnnouncement this_ptr_conv;
25356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25357 this_ptr_conv.is_owned = false;
25358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25359 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
25363 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
25364 LDKUnsignedChannelAnnouncement this_ptr_conv;
25365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25366 this_ptr_conv.is_owned = false;
25367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25368 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
25371 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
25372 LDKUnsignedChannelAnnouncement this_ptr_conv;
25373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25374 this_ptr_conv.is_owned = false;
25375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25376 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
25377 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
25381 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
25382 LDKUnsignedChannelAnnouncement this_ptr_conv;
25383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25384 this_ptr_conv.is_owned = false;
25385 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25386 LDKPublicKey val_ref;
25387 CHECK(*((uint32_t*)val) == 33);
25388 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
25389 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
25392 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
25393 LDKUnsignedChannelAnnouncement this_ptr_conv;
25394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25395 this_ptr_conv.is_owned = false;
25396 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25397 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
25398 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
25402 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
25403 LDKUnsignedChannelAnnouncement this_ptr_conv;
25404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25405 this_ptr_conv.is_owned = false;
25406 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25407 LDKPublicKey val_ref;
25408 CHECK(*((uint32_t*)val) == 33);
25409 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
25410 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
25413 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
25414 LDKUnsignedChannelAnnouncement this_ptr_conv;
25415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25416 this_ptr_conv.is_owned = false;
25417 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25418 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
25419 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
25423 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
25424 LDKUnsignedChannelAnnouncement this_ptr_conv;
25425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25426 this_ptr_conv.is_owned = false;
25427 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25428 LDKPublicKey val_ref;
25429 CHECK(*((uint32_t*)val) == 33);
25430 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
25431 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
25434 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
25435 LDKUnsignedChannelAnnouncement this_ptr_conv;
25436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25437 this_ptr_conv.is_owned = false;
25438 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25439 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
25440 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
25444 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
25445 LDKUnsignedChannelAnnouncement this_ptr_conv;
25446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25447 this_ptr_conv.is_owned = false;
25448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25449 LDKPublicKey val_ref;
25450 CHECK(*((uint32_t*)val) == 33);
25451 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
25452 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
25455 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
25456 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
25457 uint64_t ret_ref = 0;
25458 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25459 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25460 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25461 ret_ref = (uint64_t)ret_var.inner;
25462 if (ret_var.is_owned) {
25467 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint32_t arg) {
25468 LDKUnsignedChannelAnnouncement arg_conv;
25469 arg_conv.inner = (void*)(arg & (~1));
25470 arg_conv.is_owned = false;
25471 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25472 int64_t ret_val = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
25476 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
25477 LDKUnsignedChannelAnnouncement orig_conv;
25478 orig_conv.inner = (void*)(orig & (~1));
25479 orig_conv.is_owned = false;
25480 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25481 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
25482 uint64_t ret_ref = 0;
25483 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25484 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25485 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25486 ret_ref = (uint64_t)ret_var.inner;
25487 if (ret_var.is_owned) {
25493 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_free(uint32_t this_obj) {
25494 LDKChannelAnnouncement this_obj_conv;
25495 this_obj_conv.inner = (void*)(this_obj & (~1));
25496 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25497 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25498 ChannelAnnouncement_free(this_obj_conv);
25501 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
25502 LDKChannelAnnouncement this_ptr_conv;
25503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25504 this_ptr_conv.is_owned = false;
25505 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25506 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
25507 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
25511 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
25512 LDKChannelAnnouncement this_ptr_conv;
25513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25514 this_ptr_conv.is_owned = false;
25515 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25516 LDKSignature val_ref;
25517 CHECK(*((uint32_t*)val) == 64);
25518 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
25519 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
25522 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
25523 LDKChannelAnnouncement this_ptr_conv;
25524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25525 this_ptr_conv.is_owned = false;
25526 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25527 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
25528 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
25532 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
25533 LDKChannelAnnouncement this_ptr_conv;
25534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25535 this_ptr_conv.is_owned = false;
25536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25537 LDKSignature val_ref;
25538 CHECK(*((uint32_t*)val) == 64);
25539 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
25540 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
25543 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
25544 LDKChannelAnnouncement this_ptr_conv;
25545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25546 this_ptr_conv.is_owned = false;
25547 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25548 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
25549 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
25553 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
25554 LDKChannelAnnouncement this_ptr_conv;
25555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25556 this_ptr_conv.is_owned = false;
25557 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25558 LDKSignature val_ref;
25559 CHECK(*((uint32_t*)val) == 64);
25560 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
25561 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
25564 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
25565 LDKChannelAnnouncement this_ptr_conv;
25566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25567 this_ptr_conv.is_owned = false;
25568 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25569 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
25570 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
25574 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
25575 LDKChannelAnnouncement this_ptr_conv;
25576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25577 this_ptr_conv.is_owned = false;
25578 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25579 LDKSignature val_ref;
25580 CHECK(*((uint32_t*)val) == 64);
25581 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
25582 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
25585 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
25586 LDKChannelAnnouncement this_ptr_conv;
25587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25588 this_ptr_conv.is_owned = false;
25589 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25590 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
25591 uint64_t ret_ref = 0;
25592 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25593 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25594 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25595 ret_ref = (uint64_t)ret_var.inner;
25596 if (ret_var.is_owned) {
25602 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
25603 LDKChannelAnnouncement this_ptr_conv;
25604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25605 this_ptr_conv.is_owned = false;
25606 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25607 LDKUnsignedChannelAnnouncement val_conv;
25608 val_conv.inner = (void*)(val & (~1));
25609 val_conv.is_owned = (val & 1) || (val == 0);
25610 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25611 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
25612 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
25615 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) {
25616 LDKSignature node_signature_1_arg_ref;
25617 CHECK(*((uint32_t*)node_signature_1_arg) == 64);
25618 memcpy(node_signature_1_arg_ref.compact_form, (uint8_t*)(node_signature_1_arg + 4), 64);
25619 LDKSignature node_signature_2_arg_ref;
25620 CHECK(*((uint32_t*)node_signature_2_arg) == 64);
25621 memcpy(node_signature_2_arg_ref.compact_form, (uint8_t*)(node_signature_2_arg + 4), 64);
25622 LDKSignature bitcoin_signature_1_arg_ref;
25623 CHECK(*((uint32_t*)bitcoin_signature_1_arg) == 64);
25624 memcpy(bitcoin_signature_1_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_1_arg + 4), 64);
25625 LDKSignature bitcoin_signature_2_arg_ref;
25626 CHECK(*((uint32_t*)bitcoin_signature_2_arg) == 64);
25627 memcpy(bitcoin_signature_2_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_2_arg + 4), 64);
25628 LDKUnsignedChannelAnnouncement contents_arg_conv;
25629 contents_arg_conv.inner = (void*)(contents_arg & (~1));
25630 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
25631 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
25632 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
25633 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);
25634 uint64_t ret_ref = 0;
25635 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25636 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25637 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25638 ret_ref = (uint64_t)ret_var.inner;
25639 if (ret_var.is_owned) {
25645 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
25646 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
25647 uint64_t ret_ref = 0;
25648 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25649 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25650 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25651 ret_ref = (uint64_t)ret_var.inner;
25652 if (ret_var.is_owned) {
25657 int64_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_clone_ptr(uint32_t arg) {
25658 LDKChannelAnnouncement arg_conv;
25659 arg_conv.inner = (void*)(arg & (~1));
25660 arg_conv.is_owned = false;
25661 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25662 int64_t ret_val = ChannelAnnouncement_clone_ptr(&arg_conv);
25666 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
25667 LDKChannelAnnouncement orig_conv;
25668 orig_conv.inner = (void*)(orig & (~1));
25669 orig_conv.is_owned = false;
25670 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25671 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
25672 uint64_t ret_ref = 0;
25673 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25674 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25675 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25676 ret_ref = (uint64_t)ret_var.inner;
25677 if (ret_var.is_owned) {
25683 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_free(uint32_t this_obj) {
25684 LDKUnsignedChannelUpdate this_obj_conv;
25685 this_obj_conv.inner = (void*)(this_obj & (~1));
25686 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25688 UnsignedChannelUpdate_free(this_obj_conv);
25691 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
25692 LDKUnsignedChannelUpdate this_ptr_conv;
25693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25694 this_ptr_conv.is_owned = false;
25695 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25696 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
25697 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
25701 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
25702 LDKUnsignedChannelUpdate this_ptr_conv;
25703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25704 this_ptr_conv.is_owned = false;
25705 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25706 LDKThirtyTwoBytes val_ref;
25707 CHECK(*((uint32_t*)val) == 32);
25708 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
25709 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
25712 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
25713 LDKUnsignedChannelUpdate this_ptr_conv;
25714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25715 this_ptr_conv.is_owned = false;
25716 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25717 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
25721 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
25722 LDKUnsignedChannelUpdate this_ptr_conv;
25723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25724 this_ptr_conv.is_owned = false;
25725 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25726 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
25729 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
25730 LDKUnsignedChannelUpdate this_ptr_conv;
25731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25732 this_ptr_conv.is_owned = false;
25733 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25734 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
25738 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
25739 LDKUnsignedChannelUpdate this_ptr_conv;
25740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25741 this_ptr_conv.is_owned = false;
25742 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25743 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
25746 int8_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
25747 LDKUnsignedChannelUpdate this_ptr_conv;
25748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25749 this_ptr_conv.is_owned = false;
25750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25751 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
25755 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
25756 LDKUnsignedChannelUpdate this_ptr_conv;
25757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25758 this_ptr_conv.is_owned = false;
25759 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25760 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
25763 int16_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
25764 LDKUnsignedChannelUpdate this_ptr_conv;
25765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25766 this_ptr_conv.is_owned = false;
25767 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25768 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
25772 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
25773 LDKUnsignedChannelUpdate this_ptr_conv;
25774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25775 this_ptr_conv.is_owned = false;
25776 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25777 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
25780 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
25781 LDKUnsignedChannelUpdate this_ptr_conv;
25782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25783 this_ptr_conv.is_owned = false;
25784 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25785 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
25789 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
25790 LDKUnsignedChannelUpdate this_ptr_conv;
25791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25792 this_ptr_conv.is_owned = false;
25793 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25794 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
25797 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
25798 LDKUnsignedChannelUpdate this_ptr_conv;
25799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25800 this_ptr_conv.is_owned = false;
25801 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25802 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
25806 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
25807 LDKUnsignedChannelUpdate this_ptr_conv;
25808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25809 this_ptr_conv.is_owned = false;
25810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25811 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
25814 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
25815 LDKUnsignedChannelUpdate this_ptr_conv;
25816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25817 this_ptr_conv.is_owned = false;
25818 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25819 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
25823 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
25824 LDKUnsignedChannelUpdate this_ptr_conv;
25825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25826 this_ptr_conv.is_owned = false;
25827 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25828 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
25831 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
25832 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
25833 uint64_t ret_ref = 0;
25834 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25835 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25836 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25837 ret_ref = (uint64_t)ret_var.inner;
25838 if (ret_var.is_owned) {
25843 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_clone_ptr(uint32_t arg) {
25844 LDKUnsignedChannelUpdate arg_conv;
25845 arg_conv.inner = (void*)(arg & (~1));
25846 arg_conv.is_owned = false;
25847 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25848 int64_t ret_val = UnsignedChannelUpdate_clone_ptr(&arg_conv);
25852 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
25853 LDKUnsignedChannelUpdate orig_conv;
25854 orig_conv.inner = (void*)(orig & (~1));
25855 orig_conv.is_owned = false;
25856 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25857 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
25858 uint64_t ret_ref = 0;
25859 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25860 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25861 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25862 ret_ref = (uint64_t)ret_var.inner;
25863 if (ret_var.is_owned) {
25869 void __attribute__((visibility("default"))) TS_ChannelUpdate_free(uint32_t this_obj) {
25870 LDKChannelUpdate this_obj_conv;
25871 this_obj_conv.inner = (void*)(this_obj & (~1));
25872 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25874 ChannelUpdate_free(this_obj_conv);
25877 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
25878 LDKChannelUpdate this_ptr_conv;
25879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25880 this_ptr_conv.is_owned = false;
25881 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25882 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
25883 memcpy((uint8_t*)(ret_arr + 4), ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
25887 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
25888 LDKChannelUpdate this_ptr_conv;
25889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25890 this_ptr_conv.is_owned = false;
25891 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25892 LDKSignature val_ref;
25893 CHECK(*((uint32_t*)val) == 64);
25894 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
25895 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
25898 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
25899 LDKChannelUpdate this_ptr_conv;
25900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25901 this_ptr_conv.is_owned = false;
25902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25903 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
25904 uint64_t ret_ref = 0;
25905 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25906 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25907 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25908 ret_ref = (uint64_t)ret_var.inner;
25909 if (ret_var.is_owned) {
25915 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
25916 LDKChannelUpdate this_ptr_conv;
25917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25918 this_ptr_conv.is_owned = false;
25919 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25920 LDKUnsignedChannelUpdate val_conv;
25921 val_conv.inner = (void*)(val & (~1));
25922 val_conv.is_owned = (val & 1) || (val == 0);
25923 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25924 val_conv = UnsignedChannelUpdate_clone(&val_conv);
25925 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
25928 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
25929 LDKSignature signature_arg_ref;
25930 CHECK(*((uint32_t*)signature_arg) == 64);
25931 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
25932 LDKUnsignedChannelUpdate contents_arg_conv;
25933 contents_arg_conv.inner = (void*)(contents_arg & (~1));
25934 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
25935 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
25936 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
25937 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
25938 uint64_t ret_ref = 0;
25939 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25940 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25941 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25942 ret_ref = (uint64_t)ret_var.inner;
25943 if (ret_var.is_owned) {
25949 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
25950 LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
25951 uint64_t ret_ref = 0;
25952 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25953 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25954 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25955 ret_ref = (uint64_t)ret_var.inner;
25956 if (ret_var.is_owned) {
25961 int64_t __attribute__((visibility("default"))) TS_ChannelUpdate_clone_ptr(uint32_t arg) {
25962 LDKChannelUpdate arg_conv;
25963 arg_conv.inner = (void*)(arg & (~1));
25964 arg_conv.is_owned = false;
25965 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25966 int64_t ret_val = ChannelUpdate_clone_ptr(&arg_conv);
25970 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_clone(uint32_t orig) {
25971 LDKChannelUpdate orig_conv;
25972 orig_conv.inner = (void*)(orig & (~1));
25973 orig_conv.is_owned = false;
25974 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25975 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
25976 uint64_t ret_ref = 0;
25977 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25978 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25979 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25980 ret_ref = (uint64_t)ret_var.inner;
25981 if (ret_var.is_owned) {
25987 void __attribute__((visibility("default"))) TS_QueryChannelRange_free(uint32_t this_obj) {
25988 LDKQueryChannelRange this_obj_conv;
25989 this_obj_conv.inner = (void*)(this_obj & (~1));
25990 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25992 QueryChannelRange_free(this_obj_conv);
25995 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
25996 LDKQueryChannelRange this_ptr_conv;
25997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25998 this_ptr_conv.is_owned = false;
25999 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26000 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
26001 memcpy((uint8_t*)(ret_arr + 4), *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
26005 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26006 LDKQueryChannelRange this_ptr_conv;
26007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26008 this_ptr_conv.is_owned = false;
26009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26010 LDKThirtyTwoBytes val_ref;
26011 CHECK(*((uint32_t*)val) == 32);
26012 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
26013 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
26016 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
26017 LDKQueryChannelRange this_ptr_conv;
26018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26019 this_ptr_conv.is_owned = false;
26020 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26021 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
26025 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
26026 LDKQueryChannelRange this_ptr_conv;
26027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26028 this_ptr_conv.is_owned = false;
26029 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26030 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
26033 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
26034 LDKQueryChannelRange this_ptr_conv;
26035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26036 this_ptr_conv.is_owned = false;
26037 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26038 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
26042 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
26043 LDKQueryChannelRange this_ptr_conv;
26044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26045 this_ptr_conv.is_owned = false;
26046 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26047 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
26050 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
26051 LDKThirtyTwoBytes chain_hash_arg_ref;
26052 CHECK(*((uint32_t*)chain_hash_arg) == 32);
26053 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
26054 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
26055 uint64_t ret_ref = 0;
26056 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26057 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26058 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26059 ret_ref = (uint64_t)ret_var.inner;
26060 if (ret_var.is_owned) {
26066 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
26067 LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
26068 uint64_t ret_ref = 0;
26069 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26070 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26071 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26072 ret_ref = (uint64_t)ret_var.inner;
26073 if (ret_var.is_owned) {
26078 int64_t __attribute__((visibility("default"))) TS_QueryChannelRange_clone_ptr(uint32_t arg) {
26079 LDKQueryChannelRange arg_conv;
26080 arg_conv.inner = (void*)(arg & (~1));
26081 arg_conv.is_owned = false;
26082 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26083 int64_t ret_val = QueryChannelRange_clone_ptr(&arg_conv);
26087 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_clone(uint32_t orig) {
26088 LDKQueryChannelRange orig_conv;
26089 orig_conv.inner = (void*)(orig & (~1));
26090 orig_conv.is_owned = false;
26091 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26092 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
26093 uint64_t ret_ref = 0;
26094 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26095 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26096 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26097 ret_ref = (uint64_t)ret_var.inner;
26098 if (ret_var.is_owned) {
26104 void __attribute__((visibility("default"))) TS_ReplyChannelRange_free(uint32_t this_obj) {
26105 LDKReplyChannelRange this_obj_conv;
26106 this_obj_conv.inner = (void*)(this_obj & (~1));
26107 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26108 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26109 ReplyChannelRange_free(this_obj_conv);
26112 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
26113 LDKReplyChannelRange this_ptr_conv;
26114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26115 this_ptr_conv.is_owned = false;
26116 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26117 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
26118 memcpy((uint8_t*)(ret_arr + 4), *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
26122 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26123 LDKReplyChannelRange this_ptr_conv;
26124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26125 this_ptr_conv.is_owned = false;
26126 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26127 LDKThirtyTwoBytes val_ref;
26128 CHECK(*((uint32_t*)val) == 32);
26129 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
26130 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
26133 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
26134 LDKReplyChannelRange this_ptr_conv;
26135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26136 this_ptr_conv.is_owned = false;
26137 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26138 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
26142 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
26143 LDKReplyChannelRange this_ptr_conv;
26144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26145 this_ptr_conv.is_owned = false;
26146 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26147 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
26150 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
26151 LDKReplyChannelRange this_ptr_conv;
26152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26153 this_ptr_conv.is_owned = false;
26154 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26155 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
26159 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
26160 LDKReplyChannelRange this_ptr_conv;
26161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26162 this_ptr_conv.is_owned = false;
26163 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26164 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
26167 jboolean __attribute__((visibility("default"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
26168 LDKReplyChannelRange this_ptr_conv;
26169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26170 this_ptr_conv.is_owned = false;
26171 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26172 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
26176 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
26177 LDKReplyChannelRange this_ptr_conv;
26178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26179 this_ptr_conv.is_owned = false;
26180 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26181 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
26184 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
26185 LDKReplyChannelRange this_ptr_conv;
26186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26187 this_ptr_conv.is_owned = false;
26188 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26189 LDKCVec_u64Z val_constr;
26190 val_constr.datalen = *((uint32_t*)val);
26191 if (val_constr.datalen > 0)
26192 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26194 val_constr.data = NULL;
26195 int64_t* val_vals = (int64_t*)(val + 4);
26196 for (size_t i = 0; i < val_constr.datalen; i++) {
26197 int64_t val_conv_8 = val_vals[i];
26198 val_constr.data[i] = val_conv_8;
26200 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
26203 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) {
26204 LDKThirtyTwoBytes chain_hash_arg_ref;
26205 CHECK(*((uint32_t*)chain_hash_arg) == 32);
26206 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
26207 LDKCVec_u64Z short_channel_ids_arg_constr;
26208 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
26209 if (short_channel_ids_arg_constr.datalen > 0)
26210 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26212 short_channel_ids_arg_constr.data = NULL;
26213 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
26214 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
26215 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
26216 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
26218 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
26219 uint64_t ret_ref = 0;
26220 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26221 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26222 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26223 ret_ref = (uint64_t)ret_var.inner;
26224 if (ret_var.is_owned) {
26230 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
26231 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
26232 uint64_t ret_ref = 0;
26233 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26234 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26235 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26236 ret_ref = (uint64_t)ret_var.inner;
26237 if (ret_var.is_owned) {
26242 int64_t __attribute__((visibility("default"))) TS_ReplyChannelRange_clone_ptr(uint32_t arg) {
26243 LDKReplyChannelRange arg_conv;
26244 arg_conv.inner = (void*)(arg & (~1));
26245 arg_conv.is_owned = false;
26246 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26247 int64_t ret_val = ReplyChannelRange_clone_ptr(&arg_conv);
26251 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_clone(uint32_t orig) {
26252 LDKReplyChannelRange orig_conv;
26253 orig_conv.inner = (void*)(orig & (~1));
26254 orig_conv.is_owned = false;
26255 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26256 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
26257 uint64_t ret_ref = 0;
26258 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26259 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26260 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26261 ret_ref = (uint64_t)ret_var.inner;
26262 if (ret_var.is_owned) {
26268 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_free(uint32_t this_obj) {
26269 LDKQueryShortChannelIds this_obj_conv;
26270 this_obj_conv.inner = (void*)(this_obj & (~1));
26271 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26273 QueryShortChannelIds_free(this_obj_conv);
26276 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
26277 LDKQueryShortChannelIds this_ptr_conv;
26278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26279 this_ptr_conv.is_owned = false;
26280 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26281 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
26282 memcpy((uint8_t*)(ret_arr + 4), *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
26286 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26287 LDKQueryShortChannelIds this_ptr_conv;
26288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26289 this_ptr_conv.is_owned = false;
26290 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26291 LDKThirtyTwoBytes val_ref;
26292 CHECK(*((uint32_t*)val) == 32);
26293 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
26294 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
26297 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
26298 LDKQueryShortChannelIds this_ptr_conv;
26299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26300 this_ptr_conv.is_owned = false;
26301 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26302 LDKCVec_u64Z val_constr;
26303 val_constr.datalen = *((uint32_t*)val);
26304 if (val_constr.datalen > 0)
26305 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26307 val_constr.data = NULL;
26308 int64_t* val_vals = (int64_t*)(val + 4);
26309 for (size_t i = 0; i < val_constr.datalen; i++) {
26310 int64_t val_conv_8 = val_vals[i];
26311 val_constr.data[i] = val_conv_8;
26313 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
26316 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
26317 LDKThirtyTwoBytes chain_hash_arg_ref;
26318 CHECK(*((uint32_t*)chain_hash_arg) == 32);
26319 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
26320 LDKCVec_u64Z short_channel_ids_arg_constr;
26321 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
26322 if (short_channel_ids_arg_constr.datalen > 0)
26323 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26325 short_channel_ids_arg_constr.data = NULL;
26326 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
26327 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
26328 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
26329 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
26331 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
26332 uint64_t ret_ref = 0;
26333 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26334 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26335 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26336 ret_ref = (uint64_t)ret_var.inner;
26337 if (ret_var.is_owned) {
26343 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
26344 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
26345 uint64_t ret_ref = 0;
26346 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26347 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26348 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26349 ret_ref = (uint64_t)ret_var.inner;
26350 if (ret_var.is_owned) {
26355 int64_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_clone_ptr(uint32_t arg) {
26356 LDKQueryShortChannelIds arg_conv;
26357 arg_conv.inner = (void*)(arg & (~1));
26358 arg_conv.is_owned = false;
26359 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26360 int64_t ret_val = QueryShortChannelIds_clone_ptr(&arg_conv);
26364 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
26365 LDKQueryShortChannelIds orig_conv;
26366 orig_conv.inner = (void*)(orig & (~1));
26367 orig_conv.is_owned = false;
26368 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26369 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
26370 uint64_t ret_ref = 0;
26371 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26372 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26373 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26374 ret_ref = (uint64_t)ret_var.inner;
26375 if (ret_var.is_owned) {
26381 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_obj) {
26382 LDKReplyShortChannelIdsEnd this_obj_conv;
26383 this_obj_conv.inner = (void*)(this_obj & (~1));
26384 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26385 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26386 ReplyShortChannelIdsEnd_free(this_obj_conv);
26389 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
26390 LDKReplyShortChannelIdsEnd this_ptr_conv;
26391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26392 this_ptr_conv.is_owned = false;
26393 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26394 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
26395 memcpy((uint8_t*)(ret_arr + 4), *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
26399 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26400 LDKReplyShortChannelIdsEnd this_ptr_conv;
26401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26402 this_ptr_conv.is_owned = false;
26403 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26404 LDKThirtyTwoBytes val_ref;
26405 CHECK(*((uint32_t*)val) == 32);
26406 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
26407 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
26410 jboolean __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
26411 LDKReplyShortChannelIdsEnd this_ptr_conv;
26412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26413 this_ptr_conv.is_owned = false;
26414 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26415 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
26419 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
26420 LDKReplyShortChannelIdsEnd this_ptr_conv;
26421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26422 this_ptr_conv.is_owned = false;
26423 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26424 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
26427 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
26428 LDKThirtyTwoBytes chain_hash_arg_ref;
26429 CHECK(*((uint32_t*)chain_hash_arg) == 32);
26430 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
26431 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
26432 uint64_t ret_ref = 0;
26433 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26434 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26435 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26436 ret_ref = (uint64_t)ret_var.inner;
26437 if (ret_var.is_owned) {
26443 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
26444 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
26445 uint64_t ret_ref = 0;
26446 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26447 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26448 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26449 ret_ref = (uint64_t)ret_var.inner;
26450 if (ret_var.is_owned) {
26455 int64_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint32_t arg) {
26456 LDKReplyShortChannelIdsEnd arg_conv;
26457 arg_conv.inner = (void*)(arg & (~1));
26458 arg_conv.is_owned = false;
26459 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26460 int64_t ret_val = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
26464 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
26465 LDKReplyShortChannelIdsEnd orig_conv;
26466 orig_conv.inner = (void*)(orig & (~1));
26467 orig_conv.is_owned = false;
26468 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26469 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
26470 uint64_t ret_ref = 0;
26471 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26472 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26473 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26474 ret_ref = (uint64_t)ret_var.inner;
26475 if (ret_var.is_owned) {
26481 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_free(uint32_t this_obj) {
26482 LDKGossipTimestampFilter this_obj_conv;
26483 this_obj_conv.inner = (void*)(this_obj & (~1));
26484 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26485 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26486 GossipTimestampFilter_free(this_obj_conv);
26489 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
26490 LDKGossipTimestampFilter this_ptr_conv;
26491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26492 this_ptr_conv.is_owned = false;
26493 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26494 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
26495 memcpy((uint8_t*)(ret_arr + 4), *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
26499 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26500 LDKGossipTimestampFilter this_ptr_conv;
26501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26502 this_ptr_conv.is_owned = false;
26503 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26504 LDKThirtyTwoBytes val_ref;
26505 CHECK(*((uint32_t*)val) == 32);
26506 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
26507 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
26510 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
26511 LDKGossipTimestampFilter this_ptr_conv;
26512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26513 this_ptr_conv.is_owned = false;
26514 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26515 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
26519 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
26520 LDKGossipTimestampFilter this_ptr_conv;
26521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26522 this_ptr_conv.is_owned = false;
26523 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26524 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
26527 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
26528 LDKGossipTimestampFilter this_ptr_conv;
26529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26530 this_ptr_conv.is_owned = false;
26531 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26532 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
26536 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
26537 LDKGossipTimestampFilter this_ptr_conv;
26538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26539 this_ptr_conv.is_owned = false;
26540 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26541 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
26544 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
26545 LDKThirtyTwoBytes chain_hash_arg_ref;
26546 CHECK(*((uint32_t*)chain_hash_arg) == 32);
26547 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
26548 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
26549 uint64_t ret_ref = 0;
26550 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26551 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26552 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26553 ret_ref = (uint64_t)ret_var.inner;
26554 if (ret_var.is_owned) {
26560 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
26561 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
26562 uint64_t ret_ref = 0;
26563 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26564 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26565 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26566 ret_ref = (uint64_t)ret_var.inner;
26567 if (ret_var.is_owned) {
26572 int64_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_clone_ptr(uint32_t arg) {
26573 LDKGossipTimestampFilter arg_conv;
26574 arg_conv.inner = (void*)(arg & (~1));
26575 arg_conv.is_owned = false;
26576 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26577 int64_t ret_val = GossipTimestampFilter_clone_ptr(&arg_conv);
26581 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
26582 LDKGossipTimestampFilter orig_conv;
26583 orig_conv.inner = (void*)(orig & (~1));
26584 orig_conv.is_owned = false;
26585 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26586 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
26587 uint64_t ret_ref = 0;
26588 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26589 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26590 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26591 ret_ref = (uint64_t)ret_var.inner;
26592 if (ret_var.is_owned) {
26598 void __attribute__((visibility("default"))) TS_ErrorAction_free(uint32_t this_ptr) {
26599 if ((this_ptr & 1) != 0) return;
26600 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
26601 CHECK_ACCESS(this_ptr_ptr);
26602 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
26603 FREE((void*)this_ptr);
26604 ErrorAction_free(this_ptr_conv);
26607 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
26608 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26609 *ret_copy = ErrorAction_clone(arg);
26610 uint64_t ret_ref = (uint64_t)ret_copy;
26613 int64_t __attribute__((visibility("default"))) TS_ErrorAction_clone_ptr(uint32_t arg) {
26614 LDKErrorAction* arg_conv = (LDKErrorAction*)arg;
26615 int64_t ret_val = ErrorAction_clone_ptr(arg_conv);
26619 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_clone(uint32_t orig) {
26620 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
26621 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26622 *ret_copy = ErrorAction_clone(orig_conv);
26623 uint64_t ret_ref = (uint64_t)ret_copy;
26627 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_disconnect_peer(uint32_t msg) {
26628 LDKErrorMessage msg_conv;
26629 msg_conv.inner = (void*)(msg & (~1));
26630 msg_conv.is_owned = (msg & 1) || (msg == 0);
26631 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
26632 msg_conv = ErrorMessage_clone(&msg_conv);
26633 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26634 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
26635 uint64_t ret_ref = (uint64_t)ret_copy;
26639 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_error() {
26640 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26641 *ret_copy = ErrorAction_ignore_error();
26642 uint64_t ret_ref = (uint64_t)ret_copy;
26646 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
26647 LDKLevel a_conv = LDKLevel_from_js(a);
26648 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26649 *ret_copy = ErrorAction_ignore_and_log(a_conv);
26650 uint64_t ret_ref = (uint64_t)ret_copy;
26654 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_send_error_message(uint32_t msg) {
26655 LDKErrorMessage msg_conv;
26656 msg_conv.inner = (void*)(msg & (~1));
26657 msg_conv.is_owned = (msg & 1) || (msg == 0);
26658 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
26659 msg_conv = ErrorMessage_clone(&msg_conv);
26660 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26661 *ret_copy = ErrorAction_send_error_message(msg_conv);
26662 uint64_t ret_ref = (uint64_t)ret_copy;
26666 void __attribute__((visibility("default"))) TS_LightningError_free(uint32_t this_obj) {
26667 LDKLightningError this_obj_conv;
26668 this_obj_conv.inner = (void*)(this_obj & (~1));
26669 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26670 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26671 LightningError_free(this_obj_conv);
26674 jstring __attribute__((visibility("default"))) TS_LightningError_get_err(uint32_t this_ptr) {
26675 LDKLightningError this_ptr_conv;
26676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26677 this_ptr_conv.is_owned = false;
26678 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26679 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
26680 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26685 void __attribute__((visibility("default"))) TS_LightningError_set_err(uint32_t this_ptr, jstring val) {
26686 LDKLightningError this_ptr_conv;
26687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26688 this_ptr_conv.is_owned = false;
26689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26690 LDKStr val_conv = str_ref_to_owned_c(val);
26691 LightningError_set_err(&this_ptr_conv, val_conv);
26694 uint32_t __attribute__((visibility("default"))) TS_LightningError_get_action(uint32_t this_ptr) {
26695 LDKLightningError this_ptr_conv;
26696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26697 this_ptr_conv.is_owned = false;
26698 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26699 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26700 *ret_copy = LightningError_get_action(&this_ptr_conv);
26701 uint64_t ret_ref = (uint64_t)ret_copy;
26705 void __attribute__((visibility("default"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
26706 LDKLightningError this_ptr_conv;
26707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26708 this_ptr_conv.is_owned = false;
26709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26710 void* val_ptr = (void*)(((uint64_t)val) & ~1);
26711 CHECK_ACCESS(val_ptr);
26712 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
26713 val_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)val) & ~1));
26714 LightningError_set_action(&this_ptr_conv, val_conv);
26717 uint32_t __attribute__((visibility("default"))) TS_LightningError_new(jstring err_arg, uint32_t action_arg) {
26718 LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
26719 void* action_arg_ptr = (void*)(((uint64_t)action_arg) & ~1);
26720 CHECK_ACCESS(action_arg_ptr);
26721 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
26722 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action_arg) & ~1));
26723 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
26724 uint64_t ret_ref = 0;
26725 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26726 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26727 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26728 ret_ref = (uint64_t)ret_var.inner;
26729 if (ret_var.is_owned) {
26735 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
26736 LDKLightningError ret_var = LightningError_clone(arg);
26737 uint64_t ret_ref = 0;
26738 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26739 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26740 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26741 ret_ref = (uint64_t)ret_var.inner;
26742 if (ret_var.is_owned) {
26747 int64_t __attribute__((visibility("default"))) TS_LightningError_clone_ptr(uint32_t arg) {
26748 LDKLightningError arg_conv;
26749 arg_conv.inner = (void*)(arg & (~1));
26750 arg_conv.is_owned = false;
26751 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26752 int64_t ret_val = LightningError_clone_ptr(&arg_conv);
26756 uint32_t __attribute__((visibility("default"))) TS_LightningError_clone(uint32_t orig) {
26757 LDKLightningError orig_conv;
26758 orig_conv.inner = (void*)(orig & (~1));
26759 orig_conv.is_owned = false;
26760 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26761 LDKLightningError ret_var = LightningError_clone(&orig_conv);
26762 uint64_t ret_ref = 0;
26763 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26764 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26765 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26766 ret_ref = (uint64_t)ret_var.inner;
26767 if (ret_var.is_owned) {
26773 void __attribute__((visibility("default"))) TS_CommitmentUpdate_free(uint32_t this_obj) {
26774 LDKCommitmentUpdate this_obj_conv;
26775 this_obj_conv.inner = (void*)(this_obj & (~1));
26776 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26777 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26778 CommitmentUpdate_free(this_obj_conv);
26781 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_add_htlcs(uint32_t this_ptr) {
26782 LDKCommitmentUpdate this_ptr_conv;
26783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26784 this_ptr_conv.is_owned = false;
26785 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26786 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
26787 uint32_tArray ret_arr = NULL;
26788 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
26789 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
26790 for (size_t p = 0; p < ret_var.datalen; p++) {
26791 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
26792 uint64_t ret_conv_15_ref = 0;
26793 CHECK((((uint64_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26794 CHECK((((uint64_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26795 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
26796 ret_conv_15_ref = (uint64_t)ret_conv_15_var.inner;
26797 if (ret_conv_15_var.is_owned) {
26798 ret_conv_15_ref |= 1;
26800 ret_arr_ptr[p] = ret_conv_15_ref;
26803 FREE(ret_var.data);
26807 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
26808 LDKCommitmentUpdate this_ptr_conv;
26809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26810 this_ptr_conv.is_owned = false;
26811 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26812 LDKCVec_UpdateAddHTLCZ val_constr;
26813 val_constr.datalen = *((uint32_t*)val);
26814 if (val_constr.datalen > 0)
26815 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
26817 val_constr.data = NULL;
26818 uint32_t* val_vals = (uint32_t*)(val + 4);
26819 for (size_t p = 0; p < val_constr.datalen; p++) {
26820 uint32_t val_conv_15 = val_vals[p];
26821 LDKUpdateAddHTLC val_conv_15_conv;
26822 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
26823 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
26824 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
26825 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
26826 val_constr.data[p] = val_conv_15_conv;
26828 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
26831 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint32_t this_ptr) {
26832 LDKCommitmentUpdate this_ptr_conv;
26833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26834 this_ptr_conv.is_owned = false;
26835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26836 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
26837 uint32_tArray ret_arr = NULL;
26838 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
26839 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
26840 for (size_t t = 0; t < ret_var.datalen; t++) {
26841 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
26842 uint64_t ret_conv_19_ref = 0;
26843 CHECK((((uint64_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26844 CHECK((((uint64_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26845 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
26846 ret_conv_19_ref = (uint64_t)ret_conv_19_var.inner;
26847 if (ret_conv_19_var.is_owned) {
26848 ret_conv_19_ref |= 1;
26850 ret_arr_ptr[t] = ret_conv_19_ref;
26853 FREE(ret_var.data);
26857 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
26858 LDKCommitmentUpdate this_ptr_conv;
26859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26860 this_ptr_conv.is_owned = false;
26861 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26862 LDKCVec_UpdateFulfillHTLCZ val_constr;
26863 val_constr.datalen = *((uint32_t*)val);
26864 if (val_constr.datalen > 0)
26865 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
26867 val_constr.data = NULL;
26868 uint32_t* val_vals = (uint32_t*)(val + 4);
26869 for (size_t t = 0; t < val_constr.datalen; t++) {
26870 uint32_t val_conv_19 = val_vals[t];
26871 LDKUpdateFulfillHTLC val_conv_19_conv;
26872 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
26873 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
26874 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
26875 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
26876 val_constr.data[t] = val_conv_19_conv;
26878 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
26881 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint32_t this_ptr) {
26882 LDKCommitmentUpdate this_ptr_conv;
26883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26884 this_ptr_conv.is_owned = false;
26885 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26886 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
26887 uint32_tArray ret_arr = NULL;
26888 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
26889 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
26890 for (size_t q = 0; q < ret_var.datalen; q++) {
26891 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
26892 uint64_t ret_conv_16_ref = 0;
26893 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26894 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26895 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
26896 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
26897 if (ret_conv_16_var.is_owned) {
26898 ret_conv_16_ref |= 1;
26900 ret_arr_ptr[q] = ret_conv_16_ref;
26903 FREE(ret_var.data);
26907 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
26908 LDKCommitmentUpdate this_ptr_conv;
26909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26910 this_ptr_conv.is_owned = false;
26911 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26912 LDKCVec_UpdateFailHTLCZ val_constr;
26913 val_constr.datalen = *((uint32_t*)val);
26914 if (val_constr.datalen > 0)
26915 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
26917 val_constr.data = NULL;
26918 uint32_t* val_vals = (uint32_t*)(val + 4);
26919 for (size_t q = 0; q < val_constr.datalen; q++) {
26920 uint32_t val_conv_16 = val_vals[q];
26921 LDKUpdateFailHTLC val_conv_16_conv;
26922 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
26923 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
26924 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
26925 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
26926 val_constr.data[q] = val_conv_16_conv;
26928 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
26931 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint32_t this_ptr) {
26932 LDKCommitmentUpdate this_ptr_conv;
26933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26934 this_ptr_conv.is_owned = false;
26935 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26936 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
26937 uint32_tArray ret_arr = NULL;
26938 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
26939 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
26940 for (size_t z = 0; z < ret_var.datalen; z++) {
26941 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
26942 uint64_t ret_conv_25_ref = 0;
26943 CHECK((((uint64_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26944 CHECK((((uint64_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26945 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
26946 ret_conv_25_ref = (uint64_t)ret_conv_25_var.inner;
26947 if (ret_conv_25_var.is_owned) {
26948 ret_conv_25_ref |= 1;
26950 ret_arr_ptr[z] = ret_conv_25_ref;
26953 FREE(ret_var.data);
26957 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_malformed_htlcs(uint32_t this_ptr, uint32_tArray val) {
26958 LDKCommitmentUpdate this_ptr_conv;
26959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26960 this_ptr_conv.is_owned = false;
26961 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26962 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
26963 val_constr.datalen = *((uint32_t*)val);
26964 if (val_constr.datalen > 0)
26965 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
26967 val_constr.data = NULL;
26968 uint32_t* val_vals = (uint32_t*)(val + 4);
26969 for (size_t z = 0; z < val_constr.datalen; z++) {
26970 uint32_t val_conv_25 = val_vals[z];
26971 LDKUpdateFailMalformedHTLC val_conv_25_conv;
26972 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
26973 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
26974 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
26975 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
26976 val_constr.data[z] = val_conv_25_conv;
26978 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
26981 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
26982 LDKCommitmentUpdate this_ptr_conv;
26983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26984 this_ptr_conv.is_owned = false;
26985 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26986 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
26987 uint64_t ret_ref = 0;
26988 if ((uint64_t)ret_var.inner > 4096) {
26989 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26990 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26991 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26992 ret_ref = (uint64_t)ret_var.inner;
26993 if (ret_var.is_owned) {
27000 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
27001 LDKCommitmentUpdate this_ptr_conv;
27002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27003 this_ptr_conv.is_owned = false;
27004 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27005 LDKUpdateFee val_conv;
27006 val_conv.inner = (void*)(val & (~1));
27007 val_conv.is_owned = (val & 1) || (val == 0);
27008 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27009 val_conv = UpdateFee_clone(&val_conv);
27010 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
27013 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
27014 LDKCommitmentUpdate this_ptr_conv;
27015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27016 this_ptr_conv.is_owned = false;
27017 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27018 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
27019 uint64_t ret_ref = 0;
27020 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27021 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27022 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27023 ret_ref = (uint64_t)ret_var.inner;
27024 if (ret_var.is_owned) {
27030 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
27031 LDKCommitmentUpdate this_ptr_conv;
27032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27033 this_ptr_conv.is_owned = false;
27034 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27035 LDKCommitmentSigned val_conv;
27036 val_conv.inner = (void*)(val & (~1));
27037 val_conv.is_owned = (val & 1) || (val == 0);
27038 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27039 val_conv = CommitmentSigned_clone(&val_conv);
27040 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
27043 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) {
27044 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
27045 update_add_htlcs_arg_constr.datalen = *((uint32_t*)update_add_htlcs_arg);
27046 if (update_add_htlcs_arg_constr.datalen > 0)
27047 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
27049 update_add_htlcs_arg_constr.data = NULL;
27050 uint32_t* update_add_htlcs_arg_vals = (uint32_t*)(update_add_htlcs_arg + 4);
27051 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
27052 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
27053 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
27054 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
27055 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
27056 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
27057 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
27058 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
27060 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
27061 update_fulfill_htlcs_arg_constr.datalen = *((uint32_t*)update_fulfill_htlcs_arg);
27062 if (update_fulfill_htlcs_arg_constr.datalen > 0)
27063 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
27065 update_fulfill_htlcs_arg_constr.data = NULL;
27066 uint32_t* update_fulfill_htlcs_arg_vals = (uint32_t*)(update_fulfill_htlcs_arg + 4);
27067 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
27068 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
27069 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
27070 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
27071 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
27072 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
27073 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
27074 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
27076 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
27077 update_fail_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_htlcs_arg);
27078 if (update_fail_htlcs_arg_constr.datalen > 0)
27079 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
27081 update_fail_htlcs_arg_constr.data = NULL;
27082 uint32_t* update_fail_htlcs_arg_vals = (uint32_t*)(update_fail_htlcs_arg + 4);
27083 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
27084 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
27085 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
27086 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
27087 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
27088 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
27089 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
27090 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
27092 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
27093 update_fail_malformed_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_malformed_htlcs_arg);
27094 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
27095 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
27097 update_fail_malformed_htlcs_arg_constr.data = NULL;
27098 uint32_t* update_fail_malformed_htlcs_arg_vals = (uint32_t*)(update_fail_malformed_htlcs_arg + 4);
27099 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
27100 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
27101 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
27102 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
27103 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);
27104 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
27105 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
27106 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
27108 LDKUpdateFee update_fee_arg_conv;
27109 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
27110 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
27111 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
27112 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
27113 LDKCommitmentSigned commitment_signed_arg_conv;
27114 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
27115 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
27116 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
27117 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
27118 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);
27119 uint64_t ret_ref = 0;
27120 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27121 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27122 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27123 ret_ref = (uint64_t)ret_var.inner;
27124 if (ret_var.is_owned) {
27130 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
27131 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
27132 uint64_t ret_ref = 0;
27133 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27134 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27135 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27136 ret_ref = (uint64_t)ret_var.inner;
27137 if (ret_var.is_owned) {
27142 int64_t __attribute__((visibility("default"))) TS_CommitmentUpdate_clone_ptr(uint32_t arg) {
27143 LDKCommitmentUpdate arg_conv;
27144 arg_conv.inner = (void*)(arg & (~1));
27145 arg_conv.is_owned = false;
27146 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27147 int64_t ret_val = CommitmentUpdate_clone_ptr(&arg_conv);
27151 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_clone(uint32_t orig) {
27152 LDKCommitmentUpdate orig_conv;
27153 orig_conv.inner = (void*)(orig & (~1));
27154 orig_conv.is_owned = false;
27155 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27156 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
27157 uint64_t ret_ref = 0;
27158 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27159 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27160 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27161 ret_ref = (uint64_t)ret_var.inner;
27162 if (ret_var.is_owned) {
27168 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
27169 if ((this_ptr & 1) != 0) return;
27170 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
27171 CHECK_ACCESS(this_ptr_ptr);
27172 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
27173 FREE((void*)this_ptr);
27174 ChannelMessageHandler_free(this_ptr_conv);
27177 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
27178 if ((this_ptr & 1) != 0) return;
27179 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
27180 CHECK_ACCESS(this_ptr_ptr);
27181 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
27182 FREE((void*)this_ptr);
27183 RoutingMessageHandler_free(this_ptr_conv);
27186 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_write(uint32_t obj) {
27187 LDKAcceptChannel obj_conv;
27188 obj_conv.inner = (void*)(obj & (~1));
27189 obj_conv.is_owned = false;
27190 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27191 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
27192 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27193 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27194 CVec_u8Z_free(ret_var);
27198 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_read(int8_tArray ser) {
27199 LDKu8slice ser_ref;
27200 ser_ref.datalen = *((uint32_t*)ser);
27201 ser_ref.data = (int8_t*)(ser + 4);
27202 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
27203 *ret_conv = AcceptChannel_read(ser_ref);
27204 return (uint64_t)ret_conv;
27207 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_write(uint32_t obj) {
27208 LDKAnnouncementSignatures obj_conv;
27209 obj_conv.inner = (void*)(obj & (~1));
27210 obj_conv.is_owned = false;
27211 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27212 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
27213 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27214 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27215 CVec_u8Z_free(ret_var);
27219 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
27220 LDKu8slice ser_ref;
27221 ser_ref.datalen = *((uint32_t*)ser);
27222 ser_ref.data = (int8_t*)(ser + 4);
27223 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
27224 *ret_conv = AnnouncementSignatures_read(ser_ref);
27225 return (uint64_t)ret_conv;
27228 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_write(uint32_t obj) {
27229 LDKChannelReestablish obj_conv;
27230 obj_conv.inner = (void*)(obj & (~1));
27231 obj_conv.is_owned = false;
27232 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27233 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
27234 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27235 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27236 CVec_u8Z_free(ret_var);
27240 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_read(int8_tArray ser) {
27241 LDKu8slice ser_ref;
27242 ser_ref.datalen = *((uint32_t*)ser);
27243 ser_ref.data = (int8_t*)(ser + 4);
27244 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
27245 *ret_conv = ChannelReestablish_read(ser_ref);
27246 return (uint64_t)ret_conv;
27249 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_write(uint32_t obj) {
27250 LDKClosingSigned obj_conv;
27251 obj_conv.inner = (void*)(obj & (~1));
27252 obj_conv.is_owned = false;
27253 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27254 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
27255 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27256 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27257 CVec_u8Z_free(ret_var);
27261 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_read(int8_tArray ser) {
27262 LDKu8slice ser_ref;
27263 ser_ref.datalen = *((uint32_t*)ser);
27264 ser_ref.data = (int8_t*)(ser + 4);
27265 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
27266 *ret_conv = ClosingSigned_read(ser_ref);
27267 return (uint64_t)ret_conv;
27270 int8_tArray __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_write(uint32_t obj) {
27271 LDKClosingSignedFeeRange obj_conv;
27272 obj_conv.inner = (void*)(obj & (~1));
27273 obj_conv.is_owned = false;
27274 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27275 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
27276 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27277 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27278 CVec_u8Z_free(ret_var);
27282 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
27283 LDKu8slice ser_ref;
27284 ser_ref.datalen = *((uint32_t*)ser);
27285 ser_ref.data = (int8_t*)(ser + 4);
27286 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
27287 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
27288 return (uint64_t)ret_conv;
27291 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_write(uint32_t obj) {
27292 LDKCommitmentSigned obj_conv;
27293 obj_conv.inner = (void*)(obj & (~1));
27294 obj_conv.is_owned = false;
27295 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27296 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
27297 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27298 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27299 CVec_u8Z_free(ret_var);
27303 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_read(int8_tArray ser) {
27304 LDKu8slice ser_ref;
27305 ser_ref.datalen = *((uint32_t*)ser);
27306 ser_ref.data = (int8_t*)(ser + 4);
27307 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
27308 *ret_conv = CommitmentSigned_read(ser_ref);
27309 return (uint64_t)ret_conv;
27312 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_write(uint32_t obj) {
27313 LDKFundingCreated obj_conv;
27314 obj_conv.inner = (void*)(obj & (~1));
27315 obj_conv.is_owned = false;
27316 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27317 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
27318 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27319 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27320 CVec_u8Z_free(ret_var);
27324 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_read(int8_tArray ser) {
27325 LDKu8slice ser_ref;
27326 ser_ref.datalen = *((uint32_t*)ser);
27327 ser_ref.data = (int8_t*)(ser + 4);
27328 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
27329 *ret_conv = FundingCreated_read(ser_ref);
27330 return (uint64_t)ret_conv;
27333 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_write(uint32_t obj) {
27334 LDKFundingSigned obj_conv;
27335 obj_conv.inner = (void*)(obj & (~1));
27336 obj_conv.is_owned = false;
27337 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27338 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
27339 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27340 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27341 CVec_u8Z_free(ret_var);
27345 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_read(int8_tArray ser) {
27346 LDKu8slice ser_ref;
27347 ser_ref.datalen = *((uint32_t*)ser);
27348 ser_ref.data = (int8_t*)(ser + 4);
27349 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
27350 *ret_conv = FundingSigned_read(ser_ref);
27351 return (uint64_t)ret_conv;
27354 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_write(uint32_t obj) {
27355 LDKFundingLocked obj_conv;
27356 obj_conv.inner = (void*)(obj & (~1));
27357 obj_conv.is_owned = false;
27358 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27359 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
27360 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27361 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27362 CVec_u8Z_free(ret_var);
27366 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_read(int8_tArray ser) {
27367 LDKu8slice ser_ref;
27368 ser_ref.datalen = *((uint32_t*)ser);
27369 ser_ref.data = (int8_t*)(ser + 4);
27370 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
27371 *ret_conv = FundingLocked_read(ser_ref);
27372 return (uint64_t)ret_conv;
27375 int8_tArray __attribute__((visibility("default"))) TS_Init_write(uint32_t obj) {
27377 obj_conv.inner = (void*)(obj & (~1));
27378 obj_conv.is_owned = false;
27379 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27380 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
27381 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27382 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27383 CVec_u8Z_free(ret_var);
27387 uint32_t __attribute__((visibility("default"))) TS_Init_read(int8_tArray ser) {
27388 LDKu8slice ser_ref;
27389 ser_ref.datalen = *((uint32_t*)ser);
27390 ser_ref.data = (int8_t*)(ser + 4);
27391 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
27392 *ret_conv = Init_read(ser_ref);
27393 return (uint64_t)ret_conv;
27396 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_write(uint32_t obj) {
27397 LDKOpenChannel obj_conv;
27398 obj_conv.inner = (void*)(obj & (~1));
27399 obj_conv.is_owned = false;
27400 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27401 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
27402 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27403 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27404 CVec_u8Z_free(ret_var);
27408 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_read(int8_tArray ser) {
27409 LDKu8slice ser_ref;
27410 ser_ref.datalen = *((uint32_t*)ser);
27411 ser_ref.data = (int8_t*)(ser + 4);
27412 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
27413 *ret_conv = OpenChannel_read(ser_ref);
27414 return (uint64_t)ret_conv;
27417 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_write(uint32_t obj) {
27418 LDKRevokeAndACK obj_conv;
27419 obj_conv.inner = (void*)(obj & (~1));
27420 obj_conv.is_owned = false;
27421 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27422 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
27423 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27424 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27425 CVec_u8Z_free(ret_var);
27429 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_read(int8_tArray ser) {
27430 LDKu8slice ser_ref;
27431 ser_ref.datalen = *((uint32_t*)ser);
27432 ser_ref.data = (int8_t*)(ser + 4);
27433 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
27434 *ret_conv = RevokeAndACK_read(ser_ref);
27435 return (uint64_t)ret_conv;
27438 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_write(uint32_t obj) {
27439 LDKShutdown obj_conv;
27440 obj_conv.inner = (void*)(obj & (~1));
27441 obj_conv.is_owned = false;
27442 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27443 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
27444 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27445 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27446 CVec_u8Z_free(ret_var);
27450 uint32_t __attribute__((visibility("default"))) TS_Shutdown_read(int8_tArray ser) {
27451 LDKu8slice ser_ref;
27452 ser_ref.datalen = *((uint32_t*)ser);
27453 ser_ref.data = (int8_t*)(ser + 4);
27454 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
27455 *ret_conv = Shutdown_read(ser_ref);
27456 return (uint64_t)ret_conv;
27459 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_write(uint32_t obj) {
27460 LDKUpdateFailHTLC obj_conv;
27461 obj_conv.inner = (void*)(obj & (~1));
27462 obj_conv.is_owned = false;
27463 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27464 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
27465 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27466 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27467 CVec_u8Z_free(ret_var);
27471 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
27472 LDKu8slice ser_ref;
27473 ser_ref.datalen = *((uint32_t*)ser);
27474 ser_ref.data = (int8_t*)(ser + 4);
27475 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
27476 *ret_conv = UpdateFailHTLC_read(ser_ref);
27477 return (uint64_t)ret_conv;
27480 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
27481 LDKUpdateFailMalformedHTLC obj_conv;
27482 obj_conv.inner = (void*)(obj & (~1));
27483 obj_conv.is_owned = false;
27484 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27485 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
27486 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27487 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27488 CVec_u8Z_free(ret_var);
27492 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
27493 LDKu8slice ser_ref;
27494 ser_ref.datalen = *((uint32_t*)ser);
27495 ser_ref.data = (int8_t*)(ser + 4);
27496 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
27497 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
27498 return (uint64_t)ret_conv;
27501 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_write(uint32_t obj) {
27502 LDKUpdateFee obj_conv;
27503 obj_conv.inner = (void*)(obj & (~1));
27504 obj_conv.is_owned = false;
27505 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27506 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
27507 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27508 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27509 CVec_u8Z_free(ret_var);
27513 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_read(int8_tArray ser) {
27514 LDKu8slice ser_ref;
27515 ser_ref.datalen = *((uint32_t*)ser);
27516 ser_ref.data = (int8_t*)(ser + 4);
27517 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
27518 *ret_conv = UpdateFee_read(ser_ref);
27519 return (uint64_t)ret_conv;
27522 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
27523 LDKUpdateFulfillHTLC obj_conv;
27524 obj_conv.inner = (void*)(obj & (~1));
27525 obj_conv.is_owned = false;
27526 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27527 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
27528 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27529 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27530 CVec_u8Z_free(ret_var);
27534 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
27535 LDKu8slice ser_ref;
27536 ser_ref.datalen = *((uint32_t*)ser);
27537 ser_ref.data = (int8_t*)(ser + 4);
27538 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
27539 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
27540 return (uint64_t)ret_conv;
27543 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_write(uint32_t obj) {
27544 LDKUpdateAddHTLC obj_conv;
27545 obj_conv.inner = (void*)(obj & (~1));
27546 obj_conv.is_owned = false;
27547 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27548 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
27549 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27550 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27551 CVec_u8Z_free(ret_var);
27555 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
27556 LDKu8slice ser_ref;
27557 ser_ref.datalen = *((uint32_t*)ser);
27558 ser_ref.data = (int8_t*)(ser + 4);
27559 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
27560 *ret_conv = UpdateAddHTLC_read(ser_ref);
27561 return (uint64_t)ret_conv;
27564 int8_tArray __attribute__((visibility("default"))) TS_Ping_write(uint32_t obj) {
27566 obj_conv.inner = (void*)(obj & (~1));
27567 obj_conv.is_owned = false;
27568 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27569 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
27570 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27571 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27572 CVec_u8Z_free(ret_var);
27576 uint32_t __attribute__((visibility("default"))) TS_Ping_read(int8_tArray ser) {
27577 LDKu8slice ser_ref;
27578 ser_ref.datalen = *((uint32_t*)ser);
27579 ser_ref.data = (int8_t*)(ser + 4);
27580 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
27581 *ret_conv = Ping_read(ser_ref);
27582 return (uint64_t)ret_conv;
27585 int8_tArray __attribute__((visibility("default"))) TS_Pong_write(uint32_t obj) {
27587 obj_conv.inner = (void*)(obj & (~1));
27588 obj_conv.is_owned = false;
27589 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27590 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
27591 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27592 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27593 CVec_u8Z_free(ret_var);
27597 uint32_t __attribute__((visibility("default"))) TS_Pong_read(int8_tArray ser) {
27598 LDKu8slice ser_ref;
27599 ser_ref.datalen = *((uint32_t*)ser);
27600 ser_ref.data = (int8_t*)(ser + 4);
27601 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
27602 *ret_conv = Pong_read(ser_ref);
27603 return (uint64_t)ret_conv;
27606 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
27607 LDKUnsignedChannelAnnouncement obj_conv;
27608 obj_conv.inner = (void*)(obj & (~1));
27609 obj_conv.is_owned = false;
27610 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27611 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
27612 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27613 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27614 CVec_u8Z_free(ret_var);
27618 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
27619 LDKu8slice ser_ref;
27620 ser_ref.datalen = *((uint32_t*)ser);
27621 ser_ref.data = (int8_t*)(ser + 4);
27622 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
27623 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
27624 return (uint64_t)ret_conv;
27627 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_write(uint32_t obj) {
27628 LDKChannelAnnouncement obj_conv;
27629 obj_conv.inner = (void*)(obj & (~1));
27630 obj_conv.is_owned = false;
27631 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27632 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
27633 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27634 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27635 CVec_u8Z_free(ret_var);
27639 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
27640 LDKu8slice ser_ref;
27641 ser_ref.datalen = *((uint32_t*)ser);
27642 ser_ref.data = (int8_t*)(ser + 4);
27643 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
27644 *ret_conv = ChannelAnnouncement_read(ser_ref);
27645 return (uint64_t)ret_conv;
27648 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
27649 LDKUnsignedChannelUpdate obj_conv;
27650 obj_conv.inner = (void*)(obj & (~1));
27651 obj_conv.is_owned = false;
27652 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27653 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
27654 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27655 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27656 CVec_u8Z_free(ret_var);
27660 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
27661 LDKu8slice ser_ref;
27662 ser_ref.datalen = *((uint32_t*)ser);
27663 ser_ref.data = (int8_t*)(ser + 4);
27664 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
27665 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
27666 return (uint64_t)ret_conv;
27669 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_write(uint32_t obj) {
27670 LDKChannelUpdate obj_conv;
27671 obj_conv.inner = (void*)(obj & (~1));
27672 obj_conv.is_owned = false;
27673 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27674 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
27675 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27676 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27677 CVec_u8Z_free(ret_var);
27681 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_read(int8_tArray ser) {
27682 LDKu8slice ser_ref;
27683 ser_ref.datalen = *((uint32_t*)ser);
27684 ser_ref.data = (int8_t*)(ser + 4);
27685 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
27686 *ret_conv = ChannelUpdate_read(ser_ref);
27687 return (uint64_t)ret_conv;
27690 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_write(uint32_t obj) {
27691 LDKErrorMessage obj_conv;
27692 obj_conv.inner = (void*)(obj & (~1));
27693 obj_conv.is_owned = false;
27694 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27695 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
27696 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27697 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27698 CVec_u8Z_free(ret_var);
27702 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_read(int8_tArray ser) {
27703 LDKu8slice ser_ref;
27704 ser_ref.datalen = *((uint32_t*)ser);
27705 ser_ref.data = (int8_t*)(ser + 4);
27706 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
27707 *ret_conv = ErrorMessage_read(ser_ref);
27708 return (uint64_t)ret_conv;
27711 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
27712 LDKUnsignedNodeAnnouncement obj_conv;
27713 obj_conv.inner = (void*)(obj & (~1));
27714 obj_conv.is_owned = false;
27715 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27716 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
27717 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27718 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27719 CVec_u8Z_free(ret_var);
27723 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
27724 LDKu8slice ser_ref;
27725 ser_ref.datalen = *((uint32_t*)ser);
27726 ser_ref.data = (int8_t*)(ser + 4);
27727 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
27728 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
27729 return (uint64_t)ret_conv;
27732 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_write(uint32_t obj) {
27733 LDKNodeAnnouncement obj_conv;
27734 obj_conv.inner = (void*)(obj & (~1));
27735 obj_conv.is_owned = false;
27736 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27737 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
27738 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27739 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27740 CVec_u8Z_free(ret_var);
27744 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_read(int8_tArray ser) {
27745 LDKu8slice ser_ref;
27746 ser_ref.datalen = *((uint32_t*)ser);
27747 ser_ref.data = (int8_t*)(ser + 4);
27748 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
27749 *ret_conv = NodeAnnouncement_read(ser_ref);
27750 return (uint64_t)ret_conv;
27753 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
27754 LDKu8slice ser_ref;
27755 ser_ref.datalen = *((uint32_t*)ser);
27756 ser_ref.data = (int8_t*)(ser + 4);
27757 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
27758 *ret_conv = QueryShortChannelIds_read(ser_ref);
27759 return (uint64_t)ret_conv;
27762 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_write(uint32_t obj) {
27763 LDKQueryShortChannelIds obj_conv;
27764 obj_conv.inner = (void*)(obj & (~1));
27765 obj_conv.is_owned = false;
27766 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27767 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
27768 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27769 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27770 CVec_u8Z_free(ret_var);
27774 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
27775 LDKReplyShortChannelIdsEnd obj_conv;
27776 obj_conv.inner = (void*)(obj & (~1));
27777 obj_conv.is_owned = false;
27778 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27779 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
27780 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27781 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27782 CVec_u8Z_free(ret_var);
27786 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
27787 LDKu8slice ser_ref;
27788 ser_ref.datalen = *((uint32_t*)ser);
27789 ser_ref.data = (int8_t*)(ser + 4);
27790 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
27791 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
27792 return (uint64_t)ret_conv;
27795 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
27796 LDKQueryChannelRange this_arg_conv;
27797 this_arg_conv.inner = (void*)(this_arg & (~1));
27798 this_arg_conv.is_owned = false;
27799 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27800 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
27804 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_write(uint32_t obj) {
27805 LDKQueryChannelRange obj_conv;
27806 obj_conv.inner = (void*)(obj & (~1));
27807 obj_conv.is_owned = false;
27808 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27809 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
27810 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27811 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27812 CVec_u8Z_free(ret_var);
27816 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_read(int8_tArray ser) {
27817 LDKu8slice ser_ref;
27818 ser_ref.datalen = *((uint32_t*)ser);
27819 ser_ref.data = (int8_t*)(ser + 4);
27820 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
27821 *ret_conv = QueryChannelRange_read(ser_ref);
27822 return (uint64_t)ret_conv;
27825 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_read(int8_tArray ser) {
27826 LDKu8slice ser_ref;
27827 ser_ref.datalen = *((uint32_t*)ser);
27828 ser_ref.data = (int8_t*)(ser + 4);
27829 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
27830 *ret_conv = ReplyChannelRange_read(ser_ref);
27831 return (uint64_t)ret_conv;
27834 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_write(uint32_t obj) {
27835 LDKReplyChannelRange obj_conv;
27836 obj_conv.inner = (void*)(obj & (~1));
27837 obj_conv.is_owned = false;
27838 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27839 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
27840 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27841 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27842 CVec_u8Z_free(ret_var);
27846 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_write(uint32_t obj) {
27847 LDKGossipTimestampFilter obj_conv;
27848 obj_conv.inner = (void*)(obj & (~1));
27849 obj_conv.is_owned = false;
27850 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27851 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
27852 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27853 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27854 CVec_u8Z_free(ret_var);
27858 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
27859 LDKu8slice ser_ref;
27860 ser_ref.datalen = *((uint32_t*)ser);
27861 ser_ref.data = (int8_t*)(ser + 4);
27862 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
27863 *ret_conv = GossipTimestampFilter_read(ser_ref);
27864 return (uint64_t)ret_conv;
27867 void __attribute__((visibility("default"))) TS_CustomMessageHandler_free(uint32_t this_ptr) {
27868 if ((this_ptr & 1) != 0) return;
27869 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
27870 CHECK_ACCESS(this_ptr_ptr);
27871 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
27872 FREE((void*)this_ptr);
27873 CustomMessageHandler_free(this_ptr_conv);
27876 void __attribute__((visibility("default"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
27877 LDKIgnoringMessageHandler this_obj_conv;
27878 this_obj_conv.inner = (void*)(this_obj & (~1));
27879 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27880 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27881 IgnoringMessageHandler_free(this_obj_conv);
27884 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_new() {
27885 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
27886 uint64_t ret_ref = 0;
27887 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27888 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27889 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27890 ret_ref = (uint64_t)ret_var.inner;
27891 if (ret_var.is_owned) {
27897 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
27898 LDKIgnoringMessageHandler this_arg_conv;
27899 this_arg_conv.inner = (void*)(this_arg & (~1));
27900 this_arg_conv.is_owned = false;
27901 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27902 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
27903 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
27904 return (uint64_t)ret_ret;
27907 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
27908 LDKIgnoringMessageHandler this_arg_conv;
27909 this_arg_conv.inner = (void*)(this_arg & (~1));
27910 this_arg_conv.is_owned = false;
27911 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27912 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
27913 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
27914 return (uint64_t)ret_ret;
27917 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint32_t this_arg) {
27918 LDKIgnoringMessageHandler this_arg_conv;
27919 this_arg_conv.inner = (void*)(this_arg & (~1));
27920 this_arg_conv.is_owned = false;
27921 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27922 LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
27923 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
27924 return (uint64_t)ret_ret;
27927 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint32_t this_arg) {
27928 LDKIgnoringMessageHandler this_arg_conv;
27929 this_arg_conv.inner = (void*)(this_arg & (~1));
27930 this_arg_conv.is_owned = false;
27931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27932 LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
27933 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
27934 return (uint64_t)ret_ret;
27937 void __attribute__((visibility("default"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
27938 LDKErroringMessageHandler this_obj_conv;
27939 this_obj_conv.inner = (void*)(this_obj & (~1));
27940 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27941 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27942 ErroringMessageHandler_free(this_obj_conv);
27945 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_new() {
27946 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
27947 uint64_t ret_ref = 0;
27948 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27949 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27950 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27951 ret_ref = (uint64_t)ret_var.inner;
27952 if (ret_var.is_owned) {
27958 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
27959 LDKErroringMessageHandler this_arg_conv;
27960 this_arg_conv.inner = (void*)(this_arg & (~1));
27961 this_arg_conv.is_owned = false;
27962 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27963 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
27964 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
27965 return (uint64_t)ret_ret;
27968 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
27969 LDKErroringMessageHandler this_arg_conv;
27970 this_arg_conv.inner = (void*)(this_arg & (~1));
27971 this_arg_conv.is_owned = false;
27972 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27973 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
27974 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
27975 return (uint64_t)ret_ret;
27978 void __attribute__((visibility("default"))) TS_MessageHandler_free(uint32_t this_obj) {
27979 LDKMessageHandler this_obj_conv;
27980 this_obj_conv.inner = (void*)(this_obj & (~1));
27981 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27982 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27983 MessageHandler_free(this_obj_conv);
27986 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
27987 LDKMessageHandler this_ptr_conv;
27988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27989 this_ptr_conv.is_owned = false;
27990 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27991 // WARNING: This object doesn't live past this scope, needs clone!
27992 uint64_t ret_ret = ((uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv)) | 1;
27996 void __attribute__((visibility("default"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
27997 LDKMessageHandler this_ptr_conv;
27998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27999 this_ptr_conv.is_owned = false;
28000 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28001 void* val_ptr = (void*)(((uint64_t)val) & ~1);
28002 CHECK_ACCESS(val_ptr);
28003 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
28004 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
28007 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
28008 LDKMessageHandler this_ptr_conv;
28009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28010 this_ptr_conv.is_owned = false;
28011 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28012 // WARNING: This object doesn't live past this scope, needs clone!
28013 uint64_t ret_ret = ((uint64_t)MessageHandler_get_route_handler(&this_ptr_conv)) | 1;
28017 void __attribute__((visibility("default"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
28018 LDKMessageHandler this_ptr_conv;
28019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28020 this_ptr_conv.is_owned = false;
28021 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28022 void* val_ptr = (void*)(((uint64_t)val) & ~1);
28023 CHECK_ACCESS(val_ptr);
28024 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
28025 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
28028 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
28029 void* chan_handler_arg_ptr = (void*)(((uint64_t)chan_handler_arg) & ~1);
28030 CHECK_ACCESS(chan_handler_arg_ptr);
28031 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
28032 void* route_handler_arg_ptr = (void*)(((uint64_t)route_handler_arg) & ~1);
28033 CHECK_ACCESS(route_handler_arg_ptr);
28034 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
28035 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
28036 uint64_t ret_ref = 0;
28037 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28038 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28039 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28040 ret_ref = (uint64_t)ret_var.inner;
28041 if (ret_var.is_owned) {
28047 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
28048 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
28049 *ret_ret = SocketDescriptor_clone(arg);
28050 return (uint64_t)ret_ret;
28052 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone_ptr(uint32_t arg) {
28053 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
28054 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
28055 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
28056 int64_t ret_val = SocketDescriptor_clone_ptr(arg_conv);
28060 uint32_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone(uint32_t orig) {
28061 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
28062 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
28063 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
28064 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
28065 *ret_ret = SocketDescriptor_clone(orig_conv);
28066 return (uint64_t)ret_ret;
28069 void __attribute__((visibility("default"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
28070 if ((this_ptr & 1) != 0) return;
28071 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
28072 CHECK_ACCESS(this_ptr_ptr);
28073 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
28074 FREE((void*)this_ptr);
28075 SocketDescriptor_free(this_ptr_conv);
28078 void __attribute__((visibility("default"))) TS_PeerHandleError_free(uint32_t this_obj) {
28079 LDKPeerHandleError this_obj_conv;
28080 this_obj_conv.inner = (void*)(this_obj & (~1));
28081 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28082 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28083 PeerHandleError_free(this_obj_conv);
28086 jboolean __attribute__((visibility("default"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
28087 LDKPeerHandleError this_ptr_conv;
28088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28089 this_ptr_conv.is_owned = false;
28090 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28091 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
28095 void __attribute__((visibility("default"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
28096 LDKPeerHandleError this_ptr_conv;
28097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28098 this_ptr_conv.is_owned = false;
28099 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28100 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
28103 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
28104 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
28105 uint64_t ret_ref = 0;
28106 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28107 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28108 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28109 ret_ref = (uint64_t)ret_var.inner;
28110 if (ret_var.is_owned) {
28116 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
28117 LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
28118 uint64_t ret_ref = 0;
28119 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28120 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28121 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28122 ret_ref = (uint64_t)ret_var.inner;
28123 if (ret_var.is_owned) {
28128 int64_t __attribute__((visibility("default"))) TS_PeerHandleError_clone_ptr(uint32_t arg) {
28129 LDKPeerHandleError arg_conv;
28130 arg_conv.inner = (void*)(arg & (~1));
28131 arg_conv.is_owned = false;
28132 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28133 int64_t ret_val = PeerHandleError_clone_ptr(&arg_conv);
28137 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_clone(uint32_t orig) {
28138 LDKPeerHandleError orig_conv;
28139 orig_conv.inner = (void*)(orig & (~1));
28140 orig_conv.is_owned = false;
28141 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28142 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
28143 uint64_t ret_ref = 0;
28144 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28145 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28146 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28147 ret_ref = (uint64_t)ret_var.inner;
28148 if (ret_var.is_owned) {
28154 void __attribute__((visibility("default"))) TS_PeerManager_free(uint32_t this_obj) {
28155 LDKPeerManager this_obj_conv;
28156 this_obj_conv.inner = (void*)(this_obj & (~1));
28157 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28158 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28159 PeerManager_free(this_obj_conv);
28162 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) {
28163 LDKMessageHandler message_handler_conv;
28164 message_handler_conv.inner = (void*)(message_handler & (~1));
28165 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
28166 CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
28167 // Warning: we need a move here but no clone is available for LDKMessageHandler
28168 LDKSecretKey our_node_secret_ref;
28169 CHECK(*((uint32_t*)our_node_secret) == 32);
28170 memcpy(our_node_secret_ref.bytes, (uint8_t*)(our_node_secret + 4), 32);
28171 unsigned char ephemeral_random_data_arr[32];
28172 CHECK(*((uint32_t*)ephemeral_random_data) == 32);
28173 memcpy(ephemeral_random_data_arr, (uint8_t*)(ephemeral_random_data + 4), 32);
28174 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
28175 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
28176 CHECK_ACCESS(logger_ptr);
28177 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28178 void* custom_message_handler_ptr = (void*)(((uint64_t)custom_message_handler) & ~1);
28179 CHECK_ACCESS(custom_message_handler_ptr);
28180 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
28181 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
28182 uint64_t ret_ref = 0;
28183 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28184 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28185 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28186 ret_ref = (uint64_t)ret_var.inner;
28187 if (ret_var.is_owned) {
28193 ptrArray __attribute__((visibility("default"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
28194 LDKPeerManager this_arg_conv;
28195 this_arg_conv.inner = (void*)(this_arg & (~1));
28196 this_arg_conv.is_owned = false;
28197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28198 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
28199 ptrArray ret_arr = NULL;
28200 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
28201 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
28202 for (size_t m = 0; m < ret_var.datalen; m++) {
28203 int8_tArray ret_conv_12_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
28204 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].compressed_form, 33);
28205 ret_arr_ptr[m] = ret_conv_12_arr;
28208 FREE(ret_var.data);
28212 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_outbound_connection(uint32_t this_arg, int8_tArray their_node_id, uint32_t descriptor) {
28213 LDKPeerManager this_arg_conv;
28214 this_arg_conv.inner = (void*)(this_arg & (~1));
28215 this_arg_conv.is_owned = false;
28216 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28217 LDKPublicKey their_node_id_ref;
28218 CHECK(*((uint32_t*)their_node_id) == 33);
28219 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
28220 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28221 CHECK_ACCESS(descriptor_ptr);
28222 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
28223 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
28224 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
28225 return (uint64_t)ret_conv;
28228 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_inbound_connection(uint32_t this_arg, uint32_t descriptor) {
28229 LDKPeerManager this_arg_conv;
28230 this_arg_conv.inner = (void*)(this_arg & (~1));
28231 this_arg_conv.is_owned = false;
28232 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28233 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28234 CHECK_ACCESS(descriptor_ptr);
28235 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
28236 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
28237 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
28238 return (uint64_t)ret_conv;
28241 uint32_t __attribute__((visibility("default"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
28242 LDKPeerManager this_arg_conv;
28243 this_arg_conv.inner = (void*)(this_arg & (~1));
28244 this_arg_conv.is_owned = false;
28245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28246 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28247 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
28248 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
28249 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
28250 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
28251 return (uint64_t)ret_conv;
28254 uint32_t __attribute__((visibility("default"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
28255 LDKPeerManager this_arg_conv;
28256 this_arg_conv.inner = (void*)(this_arg & (~1));
28257 this_arg_conv.is_owned = false;
28258 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28259 void* peer_descriptor_ptr = (void*)(((uint64_t)peer_descriptor) & ~1);
28260 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
28261 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
28262 LDKu8slice data_ref;
28263 data_ref.datalen = *((uint32_t*)data);
28264 data_ref.data = (int8_t*)(data + 4);
28265 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
28266 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
28267 return (uint64_t)ret_conv;
28270 void __attribute__((visibility("default"))) TS_PeerManager_process_events(uint32_t this_arg) {
28271 LDKPeerManager this_arg_conv;
28272 this_arg_conv.inner = (void*)(this_arg & (~1));
28273 this_arg_conv.is_owned = false;
28274 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28275 PeerManager_process_events(&this_arg_conv);
28278 void __attribute__((visibility("default"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
28279 LDKPeerManager this_arg_conv;
28280 this_arg_conv.inner = (void*)(this_arg & (~1));
28281 this_arg_conv.is_owned = false;
28282 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28283 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28284 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
28285 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
28286 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
28289 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_by_node_id(uint32_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
28290 LDKPeerManager this_arg_conv;
28291 this_arg_conv.inner = (void*)(this_arg & (~1));
28292 this_arg_conv.is_owned = false;
28293 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28294 LDKPublicKey node_id_ref;
28295 CHECK(*((uint32_t*)node_id) == 33);
28296 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
28297 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
28300 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_all_peers(uint32_t this_arg) {
28301 LDKPeerManager this_arg_conv;
28302 this_arg_conv.inner = (void*)(this_arg & (~1));
28303 this_arg_conv.is_owned = false;
28304 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28305 PeerManager_disconnect_all_peers(&this_arg_conv);
28308 void __attribute__((visibility("default"))) TS_PeerManager_timer_tick_occurred(uint32_t this_arg) {
28309 LDKPeerManager this_arg_conv;
28310 this_arg_conv.inner = (void*)(this_arg & (~1));
28311 this_arg_conv.is_owned = false;
28312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28313 PeerManager_timer_tick_occurred(&this_arg_conv);
28316 int8_tArray __attribute__((visibility("default"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
28317 unsigned char commitment_seed_arr[32];
28318 CHECK(*((uint32_t*)commitment_seed) == 32);
28319 memcpy(commitment_seed_arr, (uint8_t*)(commitment_seed + 4), 32);
28320 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
28321 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
28322 memcpy((uint8_t*)(ret_arr + 4), build_commitment_secret(commitment_seed_ref, idx).data, 32);
28326 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) {
28327 LDKCVec_u8Z to_holder_script_ref;
28328 to_holder_script_ref.datalen = *((uint32_t*)to_holder_script);
28329 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
28330 memcpy(to_holder_script_ref.data, (uint8_t*)(to_holder_script + 4), to_holder_script_ref.datalen);
28331 LDKCVec_u8Z to_counterparty_script_ref;
28332 to_counterparty_script_ref.datalen = *((uint32_t*)to_counterparty_script);
28333 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
28334 memcpy(to_counterparty_script_ref.data, (uint8_t*)(to_counterparty_script + 4), to_counterparty_script_ref.datalen);
28335 LDKOutPoint funding_outpoint_conv;
28336 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
28337 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
28338 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
28339 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
28340 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);
28341 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28342 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28343 Transaction_free(ret_var);
28347 uint32_t __attribute__((visibility("default"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
28348 LDKPublicKey per_commitment_point_ref;
28349 CHECK(*((uint32_t*)per_commitment_point) == 33);
28350 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
28351 unsigned char base_secret_arr[32];
28352 CHECK(*((uint32_t*)base_secret) == 32);
28353 memcpy(base_secret_arr, (uint8_t*)(base_secret + 4), 32);
28354 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
28355 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
28356 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
28357 return (uint64_t)ret_conv;
28360 uint32_t __attribute__((visibility("default"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
28361 LDKPublicKey per_commitment_point_ref;
28362 CHECK(*((uint32_t*)per_commitment_point) == 33);
28363 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
28364 LDKPublicKey base_point_ref;
28365 CHECK(*((uint32_t*)base_point) == 33);
28366 memcpy(base_point_ref.compressed_form, (uint8_t*)(base_point + 4), 33);
28367 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
28368 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
28369 return (uint64_t)ret_conv;
28372 uint32_t __attribute__((visibility("default"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
28373 unsigned char per_commitment_secret_arr[32];
28374 CHECK(*((uint32_t*)per_commitment_secret) == 32);
28375 memcpy(per_commitment_secret_arr, (uint8_t*)(per_commitment_secret + 4), 32);
28376 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
28377 unsigned char countersignatory_revocation_base_secret_arr[32];
28378 CHECK(*((uint32_t*)countersignatory_revocation_base_secret) == 32);
28379 memcpy(countersignatory_revocation_base_secret_arr, (uint8_t*)(countersignatory_revocation_base_secret + 4), 32);
28380 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
28381 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
28382 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
28383 return (uint64_t)ret_conv;
28386 uint32_t __attribute__((visibility("default"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
28387 LDKPublicKey per_commitment_point_ref;
28388 CHECK(*((uint32_t*)per_commitment_point) == 33);
28389 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
28390 LDKPublicKey countersignatory_revocation_base_point_ref;
28391 CHECK(*((uint32_t*)countersignatory_revocation_base_point) == 33);
28392 memcpy(countersignatory_revocation_base_point_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base_point + 4), 33);
28393 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
28394 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
28395 return (uint64_t)ret_conv;
28398 void __attribute__((visibility("default"))) TS_TxCreationKeys_free(uint32_t this_obj) {
28399 LDKTxCreationKeys this_obj_conv;
28400 this_obj_conv.inner = (void*)(this_obj & (~1));
28401 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28402 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28403 TxCreationKeys_free(this_obj_conv);
28406 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
28407 LDKTxCreationKeys this_ptr_conv;
28408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28409 this_ptr_conv.is_owned = false;
28410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28411 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
28412 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
28416 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
28417 LDKTxCreationKeys this_ptr_conv;
28418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28419 this_ptr_conv.is_owned = false;
28420 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28421 LDKPublicKey val_ref;
28422 CHECK(*((uint32_t*)val) == 33);
28423 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
28424 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
28427 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
28428 LDKTxCreationKeys this_ptr_conv;
28429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28430 this_ptr_conv.is_owned = false;
28431 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28432 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
28433 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
28437 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
28438 LDKTxCreationKeys this_ptr_conv;
28439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28440 this_ptr_conv.is_owned = false;
28441 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28442 LDKPublicKey val_ref;
28443 CHECK(*((uint32_t*)val) == 33);
28444 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
28445 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
28448 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
28449 LDKTxCreationKeys this_ptr_conv;
28450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28451 this_ptr_conv.is_owned = false;
28452 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28453 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
28454 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
28458 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
28459 LDKTxCreationKeys this_ptr_conv;
28460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28461 this_ptr_conv.is_owned = false;
28462 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28463 LDKPublicKey val_ref;
28464 CHECK(*((uint32_t*)val) == 33);
28465 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
28466 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
28469 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
28470 LDKTxCreationKeys this_ptr_conv;
28471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28472 this_ptr_conv.is_owned = false;
28473 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28474 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
28475 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
28479 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
28480 LDKTxCreationKeys this_ptr_conv;
28481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28482 this_ptr_conv.is_owned = false;
28483 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28484 LDKPublicKey val_ref;
28485 CHECK(*((uint32_t*)val) == 33);
28486 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
28487 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
28490 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
28491 LDKTxCreationKeys this_ptr_conv;
28492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28493 this_ptr_conv.is_owned = false;
28494 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28495 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
28496 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
28500 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint32_t this_ptr, int8_tArray val) {
28501 LDKTxCreationKeys this_ptr_conv;
28502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28503 this_ptr_conv.is_owned = false;
28504 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28505 LDKPublicKey val_ref;
28506 CHECK(*((uint32_t*)val) == 33);
28507 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
28508 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
28511 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) {
28512 LDKPublicKey per_commitment_point_arg_ref;
28513 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
28514 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
28515 LDKPublicKey revocation_key_arg_ref;
28516 CHECK(*((uint32_t*)revocation_key_arg) == 33);
28517 memcpy(revocation_key_arg_ref.compressed_form, (uint8_t*)(revocation_key_arg + 4), 33);
28518 LDKPublicKey broadcaster_htlc_key_arg_ref;
28519 CHECK(*((uint32_t*)broadcaster_htlc_key_arg) == 33);
28520 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_htlc_key_arg + 4), 33);
28521 LDKPublicKey countersignatory_htlc_key_arg_ref;
28522 CHECK(*((uint32_t*)countersignatory_htlc_key_arg) == 33);
28523 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, (uint8_t*)(countersignatory_htlc_key_arg + 4), 33);
28524 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
28525 CHECK(*((uint32_t*)broadcaster_delayed_payment_key_arg) == 33);
28526 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key_arg + 4), 33);
28527 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);
28528 uint64_t ret_ref = 0;
28529 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28530 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28531 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28532 ret_ref = (uint64_t)ret_var.inner;
28533 if (ret_var.is_owned) {
28539 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
28540 LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
28541 uint64_t ret_ref = 0;
28542 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28543 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28544 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28545 ret_ref = (uint64_t)ret_var.inner;
28546 if (ret_var.is_owned) {
28551 int64_t __attribute__((visibility("default"))) TS_TxCreationKeys_clone_ptr(uint32_t arg) {
28552 LDKTxCreationKeys arg_conv;
28553 arg_conv.inner = (void*)(arg & (~1));
28554 arg_conv.is_owned = false;
28555 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28556 int64_t ret_val = TxCreationKeys_clone_ptr(&arg_conv);
28560 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_clone(uint32_t orig) {
28561 LDKTxCreationKeys orig_conv;
28562 orig_conv.inner = (void*)(orig & (~1));
28563 orig_conv.is_owned = false;
28564 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28565 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
28566 uint64_t ret_ref = 0;
28567 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28568 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28569 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28570 ret_ref = (uint64_t)ret_var.inner;
28571 if (ret_var.is_owned) {
28577 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_write(uint32_t obj) {
28578 LDKTxCreationKeys obj_conv;
28579 obj_conv.inner = (void*)(obj & (~1));
28580 obj_conv.is_owned = false;
28581 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28582 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
28583 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28584 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28585 CVec_u8Z_free(ret_var);
28589 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_read(int8_tArray ser) {
28590 LDKu8slice ser_ref;
28591 ser_ref.datalen = *((uint32_t*)ser);
28592 ser_ref.data = (int8_t*)(ser + 4);
28593 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
28594 *ret_conv = TxCreationKeys_read(ser_ref);
28595 return (uint64_t)ret_conv;
28598 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_free(uint32_t this_obj) {
28599 LDKChannelPublicKeys this_obj_conv;
28600 this_obj_conv.inner = (void*)(this_obj & (~1));
28601 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28602 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28603 ChannelPublicKeys_free(this_obj_conv);
28606 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
28607 LDKChannelPublicKeys this_ptr_conv;
28608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28609 this_ptr_conv.is_owned = false;
28610 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28611 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
28612 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
28616 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
28617 LDKChannelPublicKeys this_ptr_conv;
28618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28619 this_ptr_conv.is_owned = false;
28620 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28621 LDKPublicKey val_ref;
28622 CHECK(*((uint32_t*)val) == 33);
28623 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
28624 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
28627 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
28628 LDKChannelPublicKeys this_ptr_conv;
28629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28630 this_ptr_conv.is_owned = false;
28631 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28632 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
28633 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
28637 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
28638 LDKChannelPublicKeys this_ptr_conv;
28639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28640 this_ptr_conv.is_owned = false;
28641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28642 LDKPublicKey val_ref;
28643 CHECK(*((uint32_t*)val) == 33);
28644 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
28645 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
28648 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
28649 LDKChannelPublicKeys this_ptr_conv;
28650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28651 this_ptr_conv.is_owned = false;
28652 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28653 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
28654 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
28658 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
28659 LDKChannelPublicKeys this_ptr_conv;
28660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28661 this_ptr_conv.is_owned = false;
28662 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28663 LDKPublicKey val_ref;
28664 CHECK(*((uint32_t*)val) == 33);
28665 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
28666 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
28669 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
28670 LDKChannelPublicKeys this_ptr_conv;
28671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28672 this_ptr_conv.is_owned = false;
28673 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28674 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
28675 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
28679 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
28680 LDKChannelPublicKeys this_ptr_conv;
28681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28682 this_ptr_conv.is_owned = false;
28683 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28684 LDKPublicKey val_ref;
28685 CHECK(*((uint32_t*)val) == 33);
28686 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
28687 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
28690 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
28691 LDKChannelPublicKeys this_ptr_conv;
28692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28693 this_ptr_conv.is_owned = false;
28694 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28695 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
28696 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
28700 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
28701 LDKChannelPublicKeys this_ptr_conv;
28702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28703 this_ptr_conv.is_owned = false;
28704 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28705 LDKPublicKey val_ref;
28706 CHECK(*((uint32_t*)val) == 33);
28707 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
28708 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
28711 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) {
28712 LDKPublicKey funding_pubkey_arg_ref;
28713 CHECK(*((uint32_t*)funding_pubkey_arg) == 33);
28714 memcpy(funding_pubkey_arg_ref.compressed_form, (uint8_t*)(funding_pubkey_arg + 4), 33);
28715 LDKPublicKey revocation_basepoint_arg_ref;
28716 CHECK(*((uint32_t*)revocation_basepoint_arg) == 33);
28717 memcpy(revocation_basepoint_arg_ref.compressed_form, (uint8_t*)(revocation_basepoint_arg + 4), 33);
28718 LDKPublicKey payment_point_arg_ref;
28719 CHECK(*((uint32_t*)payment_point_arg) == 33);
28720 memcpy(payment_point_arg_ref.compressed_form, (uint8_t*)(payment_point_arg + 4), 33);
28721 LDKPublicKey delayed_payment_basepoint_arg_ref;
28722 CHECK(*((uint32_t*)delayed_payment_basepoint_arg) == 33);
28723 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, (uint8_t*)(delayed_payment_basepoint_arg + 4), 33);
28724 LDKPublicKey htlc_basepoint_arg_ref;
28725 CHECK(*((uint32_t*)htlc_basepoint_arg) == 33);
28726 memcpy(htlc_basepoint_arg_ref.compressed_form, (uint8_t*)(htlc_basepoint_arg + 4), 33);
28727 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);
28728 uint64_t ret_ref = 0;
28729 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28730 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28731 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28732 ret_ref = (uint64_t)ret_var.inner;
28733 if (ret_var.is_owned) {
28739 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
28740 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
28741 uint64_t ret_ref = 0;
28742 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28743 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28744 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28745 ret_ref = (uint64_t)ret_var.inner;
28746 if (ret_var.is_owned) {
28751 int64_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_clone_ptr(uint32_t arg) {
28752 LDKChannelPublicKeys arg_conv;
28753 arg_conv.inner = (void*)(arg & (~1));
28754 arg_conv.is_owned = false;
28755 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28756 int64_t ret_val = ChannelPublicKeys_clone_ptr(&arg_conv);
28760 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
28761 LDKChannelPublicKeys orig_conv;
28762 orig_conv.inner = (void*)(orig & (~1));
28763 orig_conv.is_owned = false;
28764 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28765 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
28766 uint64_t ret_ref = 0;
28767 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28768 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28769 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28770 ret_ref = (uint64_t)ret_var.inner;
28771 if (ret_var.is_owned) {
28777 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_write(uint32_t obj) {
28778 LDKChannelPublicKeys obj_conv;
28779 obj_conv.inner = (void*)(obj & (~1));
28780 obj_conv.is_owned = false;
28781 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28782 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
28783 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28784 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28785 CVec_u8Z_free(ret_var);
28789 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
28790 LDKu8slice ser_ref;
28791 ser_ref.datalen = *((uint32_t*)ser);
28792 ser_ref.data = (int8_t*)(ser + 4);
28793 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
28794 *ret_conv = ChannelPublicKeys_read(ser_ref);
28795 return (uint64_t)ret_conv;
28798 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) {
28799 LDKPublicKey per_commitment_point_ref;
28800 CHECK(*((uint32_t*)per_commitment_point) == 33);
28801 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
28802 LDKPublicKey broadcaster_delayed_payment_base_ref;
28803 CHECK(*((uint32_t*)broadcaster_delayed_payment_base) == 33);
28804 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_base + 4), 33);
28805 LDKPublicKey broadcaster_htlc_base_ref;
28806 CHECK(*((uint32_t*)broadcaster_htlc_base) == 33);
28807 memcpy(broadcaster_htlc_base_ref.compressed_form, (uint8_t*)(broadcaster_htlc_base + 4), 33);
28808 LDKPublicKey countersignatory_revocation_base_ref;
28809 CHECK(*((uint32_t*)countersignatory_revocation_base) == 33);
28810 memcpy(countersignatory_revocation_base_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base + 4), 33);
28811 LDKPublicKey countersignatory_htlc_base_ref;
28812 CHECK(*((uint32_t*)countersignatory_htlc_base) == 33);
28813 memcpy(countersignatory_htlc_base_ref.compressed_form, (uint8_t*)(countersignatory_htlc_base + 4), 33);
28814 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
28815 *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);
28816 return (uint64_t)ret_conv;
28819 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
28820 LDKPublicKey per_commitment_point_ref;
28821 CHECK(*((uint32_t*)per_commitment_point) == 33);
28822 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
28823 LDKChannelPublicKeys broadcaster_keys_conv;
28824 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
28825 broadcaster_keys_conv.is_owned = false;
28826 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
28827 LDKChannelPublicKeys countersignatory_keys_conv;
28828 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
28829 countersignatory_keys_conv.is_owned = false;
28830 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
28831 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
28832 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
28833 return (uint64_t)ret_conv;
28836 int8_tArray __attribute__((visibility("default"))) TS_get_revokeable_redeemscript(int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
28837 LDKPublicKey revocation_key_ref;
28838 CHECK(*((uint32_t*)revocation_key) == 33);
28839 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
28840 LDKPublicKey broadcaster_delayed_payment_key_ref;
28841 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
28842 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
28843 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
28844 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28845 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28846 CVec_u8Z_free(ret_var);
28850 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_free(uint32_t this_obj) {
28851 LDKHTLCOutputInCommitment this_obj_conv;
28852 this_obj_conv.inner = (void*)(this_obj & (~1));
28853 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28854 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28855 HTLCOutputInCommitment_free(this_obj_conv);
28858 jboolean __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
28859 LDKHTLCOutputInCommitment this_ptr_conv;
28860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28861 this_ptr_conv.is_owned = false;
28862 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28863 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
28867 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
28868 LDKHTLCOutputInCommitment this_ptr_conv;
28869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28870 this_ptr_conv.is_owned = false;
28871 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28872 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
28875 int64_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
28876 LDKHTLCOutputInCommitment this_ptr_conv;
28877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28878 this_ptr_conv.is_owned = false;
28879 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28880 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
28884 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
28885 LDKHTLCOutputInCommitment this_ptr_conv;
28886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28887 this_ptr_conv.is_owned = false;
28888 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28889 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
28892 int32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
28893 LDKHTLCOutputInCommitment this_ptr_conv;
28894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28895 this_ptr_conv.is_owned = false;
28896 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28897 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
28901 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
28902 LDKHTLCOutputInCommitment this_ptr_conv;
28903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28904 this_ptr_conv.is_owned = false;
28905 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28906 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
28909 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
28910 LDKHTLCOutputInCommitment this_ptr_conv;
28911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28912 this_ptr_conv.is_owned = false;
28913 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28914 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
28915 memcpy((uint8_t*)(ret_arr + 4), *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
28919 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
28920 LDKHTLCOutputInCommitment this_ptr_conv;
28921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28922 this_ptr_conv.is_owned = false;
28923 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28924 LDKThirtyTwoBytes val_ref;
28925 CHECK(*((uint32_t*)val) == 32);
28926 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
28927 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
28930 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint32_t this_ptr) {
28931 LDKHTLCOutputInCommitment this_ptr_conv;
28932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28933 this_ptr_conv.is_owned = false;
28934 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28935 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
28936 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
28937 uint64_t ret_ref = (uint64_t)ret_copy;
28941 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint32_t this_ptr, uint32_t val) {
28942 LDKHTLCOutputInCommitment this_ptr_conv;
28943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28944 this_ptr_conv.is_owned = false;
28945 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28946 void* val_ptr = (void*)(((uint64_t)val) & ~1);
28947 CHECK_ACCESS(val_ptr);
28948 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
28949 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
28950 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
28953 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) {
28954 LDKThirtyTwoBytes payment_hash_arg_ref;
28955 CHECK(*((uint32_t*)payment_hash_arg) == 32);
28956 memcpy(payment_hash_arg_ref.data, (uint8_t*)(payment_hash_arg + 4), 32);
28957 void* transaction_output_index_arg_ptr = (void*)(((uint64_t)transaction_output_index_arg) & ~1);
28958 CHECK_ACCESS(transaction_output_index_arg_ptr);
28959 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
28960 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1));
28961 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
28962 uint64_t ret_ref = 0;
28963 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28964 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28965 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28966 ret_ref = (uint64_t)ret_var.inner;
28967 if (ret_var.is_owned) {
28973 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
28974 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
28975 uint64_t ret_ref = 0;
28976 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28977 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28978 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28979 ret_ref = (uint64_t)ret_var.inner;
28980 if (ret_var.is_owned) {
28985 int64_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_clone_ptr(uint32_t arg) {
28986 LDKHTLCOutputInCommitment arg_conv;
28987 arg_conv.inner = (void*)(arg & (~1));
28988 arg_conv.is_owned = false;
28989 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28990 int64_t ret_val = HTLCOutputInCommitment_clone_ptr(&arg_conv);
28994 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
28995 LDKHTLCOutputInCommitment orig_conv;
28996 orig_conv.inner = (void*)(orig & (~1));
28997 orig_conv.is_owned = false;
28998 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28999 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
29000 uint64_t ret_ref = 0;
29001 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29002 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29003 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29004 ret_ref = (uint64_t)ret_var.inner;
29005 if (ret_var.is_owned) {
29011 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
29012 LDKHTLCOutputInCommitment obj_conv;
29013 obj_conv.inner = (void*)(obj & (~1));
29014 obj_conv.is_owned = false;
29015 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29016 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
29017 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
29018 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
29019 CVec_u8Z_free(ret_var);
29023 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
29024 LDKu8slice ser_ref;
29025 ser_ref.datalen = *((uint32_t*)ser);
29026 ser_ref.data = (int8_t*)(ser + 4);
29027 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
29028 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
29029 return (uint64_t)ret_conv;
29032 int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uint32_t htlc, uint32_t keys) {
29033 LDKHTLCOutputInCommitment htlc_conv;
29034 htlc_conv.inner = (void*)(htlc & (~1));
29035 htlc_conv.is_owned = false;
29036 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
29037 LDKTxCreationKeys keys_conv;
29038 keys_conv.inner = (void*)(keys & (~1));
29039 keys_conv.is_owned = false;
29040 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
29041 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
29042 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
29043 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
29044 CVec_u8Z_free(ret_var);
29048 int8_tArray __attribute__((visibility("default"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
29049 LDKPublicKey broadcaster_ref;
29050 CHECK(*((uint32_t*)broadcaster) == 33);
29051 memcpy(broadcaster_ref.compressed_form, (uint8_t*)(broadcaster + 4), 33);
29052 LDKPublicKey countersignatory_ref;
29053 CHECK(*((uint32_t*)countersignatory) == 33);
29054 memcpy(countersignatory_ref.compressed_form, (uint8_t*)(countersignatory + 4), 33);
29055 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
29056 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
29057 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
29058 CVec_u8Z_free(ret_var);
29062 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) {
29063 unsigned char commitment_txid_arr[32];
29064 CHECK(*((uint32_t*)commitment_txid) == 32);
29065 memcpy(commitment_txid_arr, (uint8_t*)(commitment_txid + 4), 32);
29066 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
29067 LDKHTLCOutputInCommitment htlc_conv;
29068 htlc_conv.inner = (void*)(htlc & (~1));
29069 htlc_conv.is_owned = false;
29070 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
29071 LDKPublicKey broadcaster_delayed_payment_key_ref;
29072 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
29073 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
29074 LDKPublicKey revocation_key_ref;
29075 CHECK(*((uint32_t*)revocation_key) == 33);
29076 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
29077 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
29078 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
29079 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
29080 Transaction_free(ret_var);
29084 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) {
29085 LDKChannelTransactionParameters this_obj_conv;
29086 this_obj_conv.inner = (void*)(this_obj & (~1));
29087 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29088 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29089 ChannelTransactionParameters_free(this_obj_conv);
29092 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
29093 LDKChannelTransactionParameters this_ptr_conv;
29094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29095 this_ptr_conv.is_owned = false;
29096 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29097 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
29098 uint64_t ret_ref = 0;
29099 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29100 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29101 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29102 ret_ref = (uint64_t)ret_var.inner;
29103 if (ret_var.is_owned) {
29109 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
29110 LDKChannelTransactionParameters this_ptr_conv;
29111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29112 this_ptr_conv.is_owned = false;
29113 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29114 LDKChannelPublicKeys val_conv;
29115 val_conv.inner = (void*)(val & (~1));
29116 val_conv.is_owned = (val & 1) || (val == 0);
29117 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29118 val_conv = ChannelPublicKeys_clone(&val_conv);
29119 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
29122 int16_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
29123 LDKChannelTransactionParameters this_ptr_conv;
29124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29125 this_ptr_conv.is_owned = false;
29126 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29127 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
29131 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_selected_contest_delay(uint32_t this_ptr, int16_t val) {
29132 LDKChannelTransactionParameters this_ptr_conv;
29133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29134 this_ptr_conv.is_owned = false;
29135 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29136 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
29139 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
29140 LDKChannelTransactionParameters this_ptr_conv;
29141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29142 this_ptr_conv.is_owned = false;
29143 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29144 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
29148 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
29149 LDKChannelTransactionParameters this_ptr_conv;
29150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29151 this_ptr_conv.is_owned = false;
29152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29153 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
29156 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
29157 LDKChannelTransactionParameters this_ptr_conv;
29158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29159 this_ptr_conv.is_owned = false;
29160 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29161 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
29162 uint64_t ret_ref = 0;
29163 if ((uint64_t)ret_var.inner > 4096) {
29164 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29165 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29166 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29167 ret_ref = (uint64_t)ret_var.inner;
29168 if (ret_var.is_owned) {
29175 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
29176 LDKChannelTransactionParameters this_ptr_conv;
29177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29178 this_ptr_conv.is_owned = false;
29179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29180 LDKCounterpartyChannelTransactionParameters val_conv;
29181 val_conv.inner = (void*)(val & (~1));
29182 val_conv.is_owned = (val & 1) || (val == 0);
29183 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29184 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
29185 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
29188 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
29189 LDKChannelTransactionParameters this_ptr_conv;
29190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29191 this_ptr_conv.is_owned = false;
29192 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29193 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
29194 uint64_t ret_ref = 0;
29195 if ((uint64_t)ret_var.inner > 4096) {
29196 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29197 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29198 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29199 ret_ref = (uint64_t)ret_var.inner;
29200 if (ret_var.is_owned) {
29207 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
29208 LDKChannelTransactionParameters this_ptr_conv;
29209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29210 this_ptr_conv.is_owned = false;
29211 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29212 LDKOutPoint val_conv;
29213 val_conv.inner = (void*)(val & (~1));
29214 val_conv.is_owned = (val & 1) || (val == 0);
29215 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29216 val_conv = OutPoint_clone(&val_conv);
29217 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
29220 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) {
29221 LDKChannelPublicKeys holder_pubkeys_arg_conv;
29222 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
29223 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
29224 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
29225 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
29226 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
29227 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
29228 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
29229 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
29230 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
29231 LDKOutPoint funding_outpoint_arg_conv;
29232 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
29233 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
29234 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
29235 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
29236 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);
29237 uint64_t ret_ref = 0;
29238 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29239 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29240 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29241 ret_ref = (uint64_t)ret_var.inner;
29242 if (ret_var.is_owned) {
29248 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
29249 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
29250 uint64_t ret_ref = 0;
29251 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29252 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29253 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29254 ret_ref = (uint64_t)ret_var.inner;
29255 if (ret_var.is_owned) {
29260 int64_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_clone_ptr(uint32_t arg) {
29261 LDKChannelTransactionParameters arg_conv;
29262 arg_conv.inner = (void*)(arg & (~1));
29263 arg_conv.is_owned = false;
29264 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29265 int64_t ret_val = ChannelTransactionParameters_clone_ptr(&arg_conv);
29269 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
29270 LDKChannelTransactionParameters orig_conv;
29271 orig_conv.inner = (void*)(orig & (~1));
29272 orig_conv.is_owned = false;
29273 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29274 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
29275 uint64_t ret_ref = 0;
29276 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29277 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29278 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29279 ret_ref = (uint64_t)ret_var.inner;
29280 if (ret_var.is_owned) {
29286 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_obj) {
29287 LDKCounterpartyChannelTransactionParameters this_obj_conv;
29288 this_obj_conv.inner = (void*)(this_obj & (~1));
29289 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29290 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29291 CounterpartyChannelTransactionParameters_free(this_obj_conv);
29294 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
29295 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29297 this_ptr_conv.is_owned = false;
29298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29299 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
29300 uint64_t ret_ref = 0;
29301 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29302 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29303 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29304 ret_ref = (uint64_t)ret_var.inner;
29305 if (ret_var.is_owned) {
29311 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
29312 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29314 this_ptr_conv.is_owned = false;
29315 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29316 LDKChannelPublicKeys val_conv;
29317 val_conv.inner = (void*)(val & (~1));
29318 val_conv.is_owned = (val & 1) || (val == 0);
29319 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29320 val_conv = ChannelPublicKeys_clone(&val_conv);
29321 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
29324 int16_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
29325 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29327 this_ptr_conv.is_owned = false;
29328 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29329 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
29333 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
29334 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29336 this_ptr_conv.is_owned = false;
29337 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29338 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
29341 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
29342 LDKChannelPublicKeys pubkeys_arg_conv;
29343 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
29344 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
29345 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
29346 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
29347 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
29348 uint64_t ret_ref = 0;
29349 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29350 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29351 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29352 ret_ref = (uint64_t)ret_var.inner;
29353 if (ret_var.is_owned) {
29359 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
29360 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
29361 uint64_t ret_ref = 0;
29362 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29363 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29364 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29365 ret_ref = (uint64_t)ret_var.inner;
29366 if (ret_var.is_owned) {
29371 int64_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint32_t arg) {
29372 LDKCounterpartyChannelTransactionParameters arg_conv;
29373 arg_conv.inner = (void*)(arg & (~1));
29374 arg_conv.is_owned = false;
29375 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29376 int64_t ret_val = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
29380 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
29381 LDKCounterpartyChannelTransactionParameters orig_conv;
29382 orig_conv.inner = (void*)(orig & (~1));
29383 orig_conv.is_owned = false;
29384 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29385 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
29386 uint64_t ret_ref = 0;
29387 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29388 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29389 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29390 ret_ref = (uint64_t)ret_var.inner;
29391 if (ret_var.is_owned) {
29397 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
29398 LDKChannelTransactionParameters this_arg_conv;
29399 this_arg_conv.inner = (void*)(this_arg & (~1));
29400 this_arg_conv.is_owned = false;
29401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29402 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
29406 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
29407 LDKChannelTransactionParameters this_arg_conv;
29408 this_arg_conv.inner = (void*)(this_arg & (~1));
29409 this_arg_conv.is_owned = false;
29410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29411 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
29412 uint64_t ret_ref = 0;
29413 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29414 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29415 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29416 ret_ref = (uint64_t)ret_var.inner;
29417 if (ret_var.is_owned) {
29423 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
29424 LDKChannelTransactionParameters this_arg_conv;
29425 this_arg_conv.inner = (void*)(this_arg & (~1));
29426 this_arg_conv.is_owned = false;
29427 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29428 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
29429 uint64_t ret_ref = 0;
29430 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29431 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29432 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29433 ret_ref = (uint64_t)ret_var.inner;
29434 if (ret_var.is_owned) {
29440 int8_tArray __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
29441 LDKCounterpartyChannelTransactionParameters obj_conv;
29442 obj_conv.inner = (void*)(obj & (~1));
29443 obj_conv.is_owned = false;
29444 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29445 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
29446 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
29447 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
29448 CVec_u8Z_free(ret_var);
29452 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
29453 LDKu8slice ser_ref;
29454 ser_ref.datalen = *((uint32_t*)ser);
29455 ser_ref.data = (int8_t*)(ser + 4);
29456 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
29457 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
29458 return (uint64_t)ret_conv;
29461 int8_tArray __attribute__((visibility("default"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
29462 LDKChannelTransactionParameters obj_conv;
29463 obj_conv.inner = (void*)(obj & (~1));
29464 obj_conv.is_owned = false;
29465 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29466 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
29467 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
29468 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
29469 CVec_u8Z_free(ret_var);
29473 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
29474 LDKu8slice ser_ref;
29475 ser_ref.datalen = *((uint32_t*)ser);
29476 ser_ref.data = (int8_t*)(ser + 4);
29477 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
29478 *ret_conv = ChannelTransactionParameters_read(ser_ref);
29479 return (uint64_t)ret_conv;
29482 void __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_obj) {
29483 LDKDirectedChannelTransactionParameters this_obj_conv;
29484 this_obj_conv.inner = (void*)(this_obj & (~1));
29485 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29487 DirectedChannelTransactionParameters_free(this_obj_conv);
29490 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
29491 LDKDirectedChannelTransactionParameters this_arg_conv;
29492 this_arg_conv.inner = (void*)(this_arg & (~1));
29493 this_arg_conv.is_owned = false;
29494 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29495 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
29496 uint64_t ret_ref = 0;
29497 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29498 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29499 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29500 ret_ref = (uint64_t)ret_var.inner;
29501 if (ret_var.is_owned) {
29507 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
29508 LDKDirectedChannelTransactionParameters this_arg_conv;
29509 this_arg_conv.inner = (void*)(this_arg & (~1));
29510 this_arg_conv.is_owned = false;
29511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29512 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
29513 uint64_t ret_ref = 0;
29514 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29515 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29516 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29517 ret_ref = (uint64_t)ret_var.inner;
29518 if (ret_var.is_owned) {
29524 int16_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
29525 LDKDirectedChannelTransactionParameters this_arg_conv;
29526 this_arg_conv.inner = (void*)(this_arg & (~1));
29527 this_arg_conv.is_owned = false;
29528 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29529 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
29533 jboolean __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
29534 LDKDirectedChannelTransactionParameters this_arg_conv;
29535 this_arg_conv.inner = (void*)(this_arg & (~1));
29536 this_arg_conv.is_owned = false;
29537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29538 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
29542 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
29543 LDKDirectedChannelTransactionParameters this_arg_conv;
29544 this_arg_conv.inner = (void*)(this_arg & (~1));
29545 this_arg_conv.is_owned = false;
29546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29547 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
29548 uint64_t ret_ref = 0;
29549 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29550 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29551 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29552 ret_ref = (uint64_t)ret_var.inner;
29553 if (ret_var.is_owned) {
29559 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) {
29560 LDKHolderCommitmentTransaction this_obj_conv;
29561 this_obj_conv.inner = (void*)(this_obj & (~1));
29562 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29563 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29564 HolderCommitmentTransaction_free(this_obj_conv);
29567 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
29568 LDKHolderCommitmentTransaction this_ptr_conv;
29569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29570 this_ptr_conv.is_owned = false;
29571 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29572 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
29573 memcpy((uint8_t*)(ret_arr + 4), HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
29577 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
29578 LDKHolderCommitmentTransaction this_ptr_conv;
29579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29580 this_ptr_conv.is_owned = false;
29581 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29582 LDKSignature val_ref;
29583 CHECK(*((uint32_t*)val) == 64);
29584 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
29585 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
29588 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
29589 LDKHolderCommitmentTransaction this_ptr_conv;
29590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29591 this_ptr_conv.is_owned = false;
29592 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29593 LDKCVec_SignatureZ val_constr;
29594 val_constr.datalen = *((uint32_t*)val);
29595 if (val_constr.datalen > 0)
29596 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
29598 val_constr.data = NULL;
29599 int8_tArray* val_vals = (int8_tArray*)(val + 4);
29600 for (size_t m = 0; m < val_constr.datalen; m++) {
29601 int8_tArray val_conv_12 = val_vals[m];
29602 LDKSignature val_conv_12_ref;
29603 CHECK(*((uint32_t*)val_conv_12) == 64);
29604 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
29605 val_constr.data[m] = val_conv_12_ref;
29607 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
29610 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
29611 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
29612 uint64_t ret_ref = 0;
29613 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29614 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29615 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29616 ret_ref = (uint64_t)ret_var.inner;
29617 if (ret_var.is_owned) {
29622 int64_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_clone_ptr(uint32_t arg) {
29623 LDKHolderCommitmentTransaction arg_conv;
29624 arg_conv.inner = (void*)(arg & (~1));
29625 arg_conv.is_owned = false;
29626 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29627 int64_t ret_val = HolderCommitmentTransaction_clone_ptr(&arg_conv);
29631 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
29632 LDKHolderCommitmentTransaction orig_conv;
29633 orig_conv.inner = (void*)(orig & (~1));
29634 orig_conv.is_owned = false;
29635 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29636 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
29637 uint64_t ret_ref = 0;
29638 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29639 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29640 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29641 ret_ref = (uint64_t)ret_var.inner;
29642 if (ret_var.is_owned) {
29648 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
29649 LDKHolderCommitmentTransaction obj_conv;
29650 obj_conv.inner = (void*)(obj & (~1));
29651 obj_conv.is_owned = false;
29652 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29653 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
29654 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
29655 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
29656 CVec_u8Z_free(ret_var);
29660 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
29661 LDKu8slice ser_ref;
29662 ser_ref.datalen = *((uint32_t*)ser);
29663 ser_ref.data = (int8_t*)(ser + 4);
29664 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
29665 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
29666 return (uint64_t)ret_conv;
29669 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) {
29670 LDKCommitmentTransaction commitment_tx_conv;
29671 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
29672 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
29673 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
29674 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
29675 LDKSignature counterparty_sig_ref;
29676 CHECK(*((uint32_t*)counterparty_sig) == 64);
29677 memcpy(counterparty_sig_ref.compact_form, (uint8_t*)(counterparty_sig + 4), 64);
29678 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
29679 counterparty_htlc_sigs_constr.datalen = *((uint32_t*)counterparty_htlc_sigs);
29680 if (counterparty_htlc_sigs_constr.datalen > 0)
29681 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
29683 counterparty_htlc_sigs_constr.data = NULL;
29684 int8_tArray* counterparty_htlc_sigs_vals = (int8_tArray*)(counterparty_htlc_sigs + 4);
29685 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
29686 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
29687 LDKSignature counterparty_htlc_sigs_conv_12_ref;
29688 CHECK(*((uint32_t*)counterparty_htlc_sigs_conv_12) == 64);
29689 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, (uint8_t*)(counterparty_htlc_sigs_conv_12 + 4), 64);
29690 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
29692 LDKPublicKey holder_funding_key_ref;
29693 CHECK(*((uint32_t*)holder_funding_key) == 33);
29694 memcpy(holder_funding_key_ref.compressed_form, (uint8_t*)(holder_funding_key + 4), 33);
29695 LDKPublicKey counterparty_funding_key_ref;
29696 CHECK(*((uint32_t*)counterparty_funding_key) == 33);
29697 memcpy(counterparty_funding_key_ref.compressed_form, (uint8_t*)(counterparty_funding_key + 4), 33);
29698 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
29699 uint64_t ret_ref = 0;
29700 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29701 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29702 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29703 ret_ref = (uint64_t)ret_var.inner;
29704 if (ret_var.is_owned) {
29710 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_free(uint32_t this_obj) {
29711 LDKBuiltCommitmentTransaction this_obj_conv;
29712 this_obj_conv.inner = (void*)(this_obj & (~1));
29713 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29714 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29715 BuiltCommitmentTransaction_free(this_obj_conv);
29718 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
29719 LDKBuiltCommitmentTransaction this_ptr_conv;
29720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29721 this_ptr_conv.is_owned = false;
29722 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29723 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
29724 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
29725 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
29726 Transaction_free(ret_var);
29730 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
29731 LDKBuiltCommitmentTransaction this_ptr_conv;
29732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29733 this_ptr_conv.is_owned = false;
29734 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29735 LDKTransaction val_ref;
29736 val_ref.datalen = *((uint32_t*)val);
29737 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
29738 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
29739 val_ref.data_is_owned = true;
29740 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
29743 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
29744 LDKBuiltCommitmentTransaction this_ptr_conv;
29745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29746 this_ptr_conv.is_owned = false;
29747 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29748 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
29749 memcpy((uint8_t*)(ret_arr + 4), *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
29753 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
29754 LDKBuiltCommitmentTransaction this_ptr_conv;
29755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29756 this_ptr_conv.is_owned = false;
29757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29758 LDKThirtyTwoBytes val_ref;
29759 CHECK(*((uint32_t*)val) == 32);
29760 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
29761 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
29764 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
29765 LDKTransaction transaction_arg_ref;
29766 transaction_arg_ref.datalen = *((uint32_t*)transaction_arg);
29767 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
29768 memcpy(transaction_arg_ref.data, (uint8_t*)(transaction_arg + 4), transaction_arg_ref.datalen);
29769 transaction_arg_ref.data_is_owned = true;
29770 LDKThirtyTwoBytes txid_arg_ref;
29771 CHECK(*((uint32_t*)txid_arg) == 32);
29772 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
29773 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
29774 uint64_t ret_ref = 0;
29775 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29776 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29777 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29778 ret_ref = (uint64_t)ret_var.inner;
29779 if (ret_var.is_owned) {
29785 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
29786 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
29787 uint64_t ret_ref = 0;
29788 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29789 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29790 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29791 ret_ref = (uint64_t)ret_var.inner;
29792 if (ret_var.is_owned) {
29797 int64_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_clone_ptr(uint32_t arg) {
29798 LDKBuiltCommitmentTransaction arg_conv;
29799 arg_conv.inner = (void*)(arg & (~1));
29800 arg_conv.is_owned = false;
29801 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29802 int64_t ret_val = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
29806 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
29807 LDKBuiltCommitmentTransaction orig_conv;
29808 orig_conv.inner = (void*)(orig & (~1));
29809 orig_conv.is_owned = false;
29810 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29811 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
29812 uint64_t ret_ref = 0;
29813 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29814 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29815 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29816 ret_ref = (uint64_t)ret_var.inner;
29817 if (ret_var.is_owned) {
29823 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
29824 LDKBuiltCommitmentTransaction obj_conv;
29825 obj_conv.inner = (void*)(obj & (~1));
29826 obj_conv.is_owned = false;
29827 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29828 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
29829 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
29830 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
29831 CVec_u8Z_free(ret_var);
29835 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
29836 LDKu8slice ser_ref;
29837 ser_ref.datalen = *((uint32_t*)ser);
29838 ser_ref.data = (int8_t*)(ser + 4);
29839 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
29840 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
29841 return (uint64_t)ret_conv;
29844 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
29845 LDKBuiltCommitmentTransaction this_arg_conv;
29846 this_arg_conv.inner = (void*)(this_arg & (~1));
29847 this_arg_conv.is_owned = false;
29848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29849 LDKu8slice funding_redeemscript_ref;
29850 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
29851 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
29852 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
29853 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
29857 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) {
29858 LDKBuiltCommitmentTransaction this_arg_conv;
29859 this_arg_conv.inner = (void*)(this_arg & (~1));
29860 this_arg_conv.is_owned = false;
29861 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29862 unsigned char funding_key_arr[32];
29863 CHECK(*((uint32_t*)funding_key) == 32);
29864 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
29865 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
29866 LDKu8slice funding_redeemscript_ref;
29867 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
29868 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
29869 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
29870 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
29874 void __attribute__((visibility("default"))) TS_ClosingTransaction_free(uint32_t this_obj) {
29875 LDKClosingTransaction this_obj_conv;
29876 this_obj_conv.inner = (void*)(this_obj & (~1));
29877 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29878 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29879 ClosingTransaction_free(this_obj_conv);
29882 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
29883 LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
29884 uint64_t ret_ref = 0;
29885 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29886 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29887 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29888 ret_ref = (uint64_t)ret_var.inner;
29889 if (ret_var.is_owned) {
29894 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_clone_ptr(uint32_t arg) {
29895 LDKClosingTransaction arg_conv;
29896 arg_conv.inner = (void*)(arg & (~1));
29897 arg_conv.is_owned = false;
29898 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29899 int64_t ret_val = ClosingTransaction_clone_ptr(&arg_conv);
29903 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_clone(uint32_t orig) {
29904 LDKClosingTransaction orig_conv;
29905 orig_conv.inner = (void*)(orig & (~1));
29906 orig_conv.is_owned = false;
29907 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29908 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
29909 uint64_t ret_ref = 0;
29910 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29911 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29912 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29913 ret_ref = (uint64_t)ret_var.inner;
29914 if (ret_var.is_owned) {
29920 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_hash(uint32_t o) {
29921 LDKClosingTransaction o_conv;
29922 o_conv.inner = (void*)(o & (~1));
29923 o_conv.is_owned = false;
29924 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29925 int64_t ret_val = ClosingTransaction_hash(&o_conv);
29929 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) {
29930 LDKCVec_u8Z to_holder_script_ref;
29931 to_holder_script_ref.datalen = *((uint32_t*)to_holder_script);
29932 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
29933 memcpy(to_holder_script_ref.data, (uint8_t*)(to_holder_script + 4), to_holder_script_ref.datalen);
29934 LDKCVec_u8Z to_counterparty_script_ref;
29935 to_counterparty_script_ref.datalen = *((uint32_t*)to_counterparty_script);
29936 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
29937 memcpy(to_counterparty_script_ref.data, (uint8_t*)(to_counterparty_script + 4), to_counterparty_script_ref.datalen);
29938 LDKOutPoint funding_outpoint_conv;
29939 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
29940 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
29941 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
29942 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
29943 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
29944 uint64_t ret_ref = 0;
29945 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29946 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29947 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29948 ret_ref = (uint64_t)ret_var.inner;
29949 if (ret_var.is_owned) {
29955 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_trust(uint32_t this_arg) {
29956 LDKClosingTransaction this_arg_conv;
29957 this_arg_conv.inner = (void*)(this_arg & (~1));
29958 this_arg_conv.is_owned = false;
29959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29960 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
29961 uint64_t ret_ref = 0;
29962 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29963 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29964 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29965 ret_ref = (uint64_t)ret_var.inner;
29966 if (ret_var.is_owned) {
29972 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_verify(uint32_t this_arg, uint32_t funding_outpoint) {
29973 LDKClosingTransaction this_arg_conv;
29974 this_arg_conv.inner = (void*)(this_arg & (~1));
29975 this_arg_conv.is_owned = false;
29976 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29977 LDKOutPoint funding_outpoint_conv;
29978 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
29979 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
29980 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
29981 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
29982 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
29983 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
29984 return (uint64_t)ret_conv;
29987 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_value_sat(uint32_t this_arg) {
29988 LDKClosingTransaction this_arg_conv;
29989 this_arg_conv.inner = (void*)(this_arg & (~1));
29990 this_arg_conv.is_owned = false;
29991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29992 int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
29996 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_value_sat(uint32_t this_arg) {
29997 LDKClosingTransaction this_arg_conv;
29998 this_arg_conv.inner = (void*)(this_arg & (~1));
29999 this_arg_conv.is_owned = false;
30000 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30001 int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
30005 int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_script(uint32_t this_arg) {
30006 LDKClosingTransaction this_arg_conv;
30007 this_arg_conv.inner = (void*)(this_arg & (~1));
30008 this_arg_conv.is_owned = false;
30009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30010 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
30011 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30012 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30016 int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_script(uint32_t this_arg) {
30017 LDKClosingTransaction this_arg_conv;
30018 this_arg_conv.inner = (void*)(this_arg & (~1));
30019 this_arg_conv.is_owned = false;
30020 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30021 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
30022 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30023 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30027 void __attribute__((visibility("default"))) TS_TrustedClosingTransaction_free(uint32_t this_obj) {
30028 LDKTrustedClosingTransaction this_obj_conv;
30029 this_obj_conv.inner = (void*)(this_obj & (~1));
30030 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30031 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30032 TrustedClosingTransaction_free(this_obj_conv);
30035 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_built_transaction(uint32_t this_arg) {
30036 LDKTrustedClosingTransaction this_arg_conv;
30037 this_arg_conv.inner = (void*)(this_arg & (~1));
30038 this_arg_conv.is_owned = false;
30039 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30040 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
30041 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30042 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30043 Transaction_free(ret_var);
30047 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
30048 LDKTrustedClosingTransaction this_arg_conv;
30049 this_arg_conv.inner = (void*)(this_arg & (~1));
30050 this_arg_conv.is_owned = false;
30051 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30052 LDKu8slice funding_redeemscript_ref;
30053 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
30054 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
30055 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
30056 memcpy((uint8_t*)(ret_arr + 4), TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
30060 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) {
30061 LDKTrustedClosingTransaction this_arg_conv;
30062 this_arg_conv.inner = (void*)(this_arg & (~1));
30063 this_arg_conv.is_owned = false;
30064 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30065 unsigned char funding_key_arr[32];
30066 CHECK(*((uint32_t*)funding_key) == 32);
30067 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
30068 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
30069 LDKu8slice funding_redeemscript_ref;
30070 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
30071 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
30072 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
30073 memcpy((uint8_t*)(ret_arr + 4), TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
30077 void __attribute__((visibility("default"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
30078 LDKCommitmentTransaction this_obj_conv;
30079 this_obj_conv.inner = (void*)(this_obj & (~1));
30080 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30081 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30082 CommitmentTransaction_free(this_obj_conv);
30085 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
30086 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
30087 uint64_t ret_ref = 0;
30088 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30089 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30090 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30091 ret_ref = (uint64_t)ret_var.inner;
30092 if (ret_var.is_owned) {
30097 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_clone_ptr(uint32_t arg) {
30098 LDKCommitmentTransaction arg_conv;
30099 arg_conv.inner = (void*)(arg & (~1));
30100 arg_conv.is_owned = false;
30101 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30102 int64_t ret_val = CommitmentTransaction_clone_ptr(&arg_conv);
30106 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_clone(uint32_t orig) {
30107 LDKCommitmentTransaction orig_conv;
30108 orig_conv.inner = (void*)(orig & (~1));
30109 orig_conv.is_owned = false;
30110 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30111 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
30112 uint64_t ret_ref = 0;
30113 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30114 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30115 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30116 ret_ref = (uint64_t)ret_var.inner;
30117 if (ret_var.is_owned) {
30123 int8_tArray __attribute__((visibility("default"))) TS_CommitmentTransaction_write(uint32_t obj) {
30124 LDKCommitmentTransaction obj_conv;
30125 obj_conv.inner = (void*)(obj & (~1));
30126 obj_conv.is_owned = false;
30127 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30128 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
30129 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30130 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30131 CVec_u8Z_free(ret_var);
30135 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_read(int8_tArray ser) {
30136 LDKu8slice ser_ref;
30137 ser_ref.datalen = *((uint32_t*)ser);
30138 ser_ref.data = (int8_t*)(ser + 4);
30139 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
30140 *ret_conv = CommitmentTransaction_read(ser_ref);
30141 return (uint64_t)ret_conv;
30144 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
30145 LDKCommitmentTransaction this_arg_conv;
30146 this_arg_conv.inner = (void*)(this_arg & (~1));
30147 this_arg_conv.is_owned = false;
30148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30149 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
30153 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
30154 LDKCommitmentTransaction this_arg_conv;
30155 this_arg_conv.inner = (void*)(this_arg & (~1));
30156 this_arg_conv.is_owned = false;
30157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30158 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
30162 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
30163 LDKCommitmentTransaction this_arg_conv;
30164 this_arg_conv.inner = (void*)(this_arg & (~1));
30165 this_arg_conv.is_owned = false;
30166 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30167 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
30171 int32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
30172 LDKCommitmentTransaction this_arg_conv;
30173 this_arg_conv.inner = (void*)(this_arg & (~1));
30174 this_arg_conv.is_owned = false;
30175 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30176 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
30180 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
30181 LDKCommitmentTransaction this_arg_conv;
30182 this_arg_conv.inner = (void*)(this_arg & (~1));
30183 this_arg_conv.is_owned = false;
30184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30185 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
30186 uint64_t ret_ref = 0;
30187 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30188 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30189 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30190 ret_ref = (uint64_t)ret_var.inner;
30191 if (ret_var.is_owned) {
30197 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_verify(uint32_t this_arg, uint32_t channel_parameters, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
30198 LDKCommitmentTransaction this_arg_conv;
30199 this_arg_conv.inner = (void*)(this_arg & (~1));
30200 this_arg_conv.is_owned = false;
30201 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30202 LDKDirectedChannelTransactionParameters channel_parameters_conv;
30203 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
30204 channel_parameters_conv.is_owned = false;
30205 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
30206 LDKChannelPublicKeys broadcaster_keys_conv;
30207 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
30208 broadcaster_keys_conv.is_owned = false;
30209 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
30210 LDKChannelPublicKeys countersignatory_keys_conv;
30211 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
30212 countersignatory_keys_conv.is_owned = false;
30213 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
30214 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
30215 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
30216 return (uint64_t)ret_conv;
30219 void __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_free(uint32_t this_obj) {
30220 LDKTrustedCommitmentTransaction this_obj_conv;
30221 this_obj_conv.inner = (void*)(this_obj & (~1));
30222 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30223 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30224 TrustedCommitmentTransaction_free(this_obj_conv);
30227 int8_tArray __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
30228 LDKTrustedCommitmentTransaction this_arg_conv;
30229 this_arg_conv.inner = (void*)(this_arg & (~1));
30230 this_arg_conv.is_owned = false;
30231 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30232 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
30233 memcpy((uint8_t*)(ret_arr + 4), TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
30237 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
30238 LDKTrustedCommitmentTransaction this_arg_conv;
30239 this_arg_conv.inner = (void*)(this_arg & (~1));
30240 this_arg_conv.is_owned = false;
30241 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30242 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
30243 uint64_t ret_ref = 0;
30244 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30245 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30246 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30247 ret_ref = (uint64_t)ret_var.inner;
30248 if (ret_var.is_owned) {
30254 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
30255 LDKTrustedCommitmentTransaction this_arg_conv;
30256 this_arg_conv.inner = (void*)(this_arg & (~1));
30257 this_arg_conv.is_owned = false;
30258 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30259 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
30260 uint64_t ret_ref = 0;
30261 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30262 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30263 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30264 ret_ref = (uint64_t)ret_var.inner;
30265 if (ret_var.is_owned) {
30271 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) {
30272 LDKTrustedCommitmentTransaction this_arg_conv;
30273 this_arg_conv.inner = (void*)(this_arg & (~1));
30274 this_arg_conv.is_owned = false;
30275 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30276 unsigned char htlc_base_key_arr[32];
30277 CHECK(*((uint32_t*)htlc_base_key) == 32);
30278 memcpy(htlc_base_key_arr, (uint8_t*)(htlc_base_key + 4), 32);
30279 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
30280 LDKDirectedChannelTransactionParameters channel_parameters_conv;
30281 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
30282 channel_parameters_conv.is_owned = false;
30283 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
30284 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
30285 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
30286 return (uint64_t)ret_conv;
30289 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) {
30290 LDKPublicKey broadcaster_payment_basepoint_ref;
30291 CHECK(*((uint32_t*)broadcaster_payment_basepoint) == 33);
30292 memcpy(broadcaster_payment_basepoint_ref.compressed_form, (uint8_t*)(broadcaster_payment_basepoint + 4), 33);
30293 LDKPublicKey countersignatory_payment_basepoint_ref;
30294 CHECK(*((uint32_t*)countersignatory_payment_basepoint) == 33);
30295 memcpy(countersignatory_payment_basepoint_ref.compressed_form, (uint8_t*)(countersignatory_payment_basepoint + 4), 33);
30296 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
30300 jboolean __attribute__((visibility("default"))) TS_InitFeatures_eq(uint32_t a, uint32_t b) {
30301 LDKInitFeatures a_conv;
30302 a_conv.inner = (void*)(a & (~1));
30303 a_conv.is_owned = false;
30304 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30305 LDKInitFeatures b_conv;
30306 b_conv.inner = (void*)(b & (~1));
30307 b_conv.is_owned = false;
30308 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30309 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
30313 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_eq(uint32_t a, uint32_t b) {
30314 LDKNodeFeatures a_conv;
30315 a_conv.inner = (void*)(a & (~1));
30316 a_conv.is_owned = false;
30317 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30318 LDKNodeFeatures b_conv;
30319 b_conv.inner = (void*)(b & (~1));
30320 b_conv.is_owned = false;
30321 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30322 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
30326 jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_eq(uint32_t a, uint32_t b) {
30327 LDKChannelFeatures a_conv;
30328 a_conv.inner = (void*)(a & (~1));
30329 a_conv.is_owned = false;
30330 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30331 LDKChannelFeatures b_conv;
30332 b_conv.inner = (void*)(b & (~1));
30333 b_conv.is_owned = false;
30334 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30335 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
30339 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_eq(uint32_t a, uint32_t b) {
30340 LDKInvoiceFeatures a_conv;
30341 a_conv.inner = (void*)(a & (~1));
30342 a_conv.is_owned = false;
30343 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30344 LDKInvoiceFeatures b_conv;
30345 b_conv.inner = (void*)(b & (~1));
30346 b_conv.is_owned = false;
30347 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30348 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
30352 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
30353 LDKInitFeatures ret_var = InitFeatures_clone(arg);
30354 uint64_t ret_ref = 0;
30355 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30356 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30357 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30358 ret_ref = (uint64_t)ret_var.inner;
30359 if (ret_var.is_owned) {
30364 int64_t __attribute__((visibility("default"))) TS_InitFeatures_clone_ptr(uint32_t arg) {
30365 LDKInitFeatures arg_conv;
30366 arg_conv.inner = (void*)(arg & (~1));
30367 arg_conv.is_owned = false;
30368 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30369 int64_t ret_val = InitFeatures_clone_ptr(&arg_conv);
30373 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_clone(uint32_t orig) {
30374 LDKInitFeatures orig_conv;
30375 orig_conv.inner = (void*)(orig & (~1));
30376 orig_conv.is_owned = false;
30377 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30378 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
30379 uint64_t ret_ref = 0;
30380 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30381 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30382 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30383 ret_ref = (uint64_t)ret_var.inner;
30384 if (ret_var.is_owned) {
30390 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
30391 LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
30392 uint64_t ret_ref = 0;
30393 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30394 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30395 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30396 ret_ref = (uint64_t)ret_var.inner;
30397 if (ret_var.is_owned) {
30402 int64_t __attribute__((visibility("default"))) TS_NodeFeatures_clone_ptr(uint32_t arg) {
30403 LDKNodeFeatures arg_conv;
30404 arg_conv.inner = (void*)(arg & (~1));
30405 arg_conv.is_owned = false;
30406 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30407 int64_t ret_val = NodeFeatures_clone_ptr(&arg_conv);
30411 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_clone(uint32_t orig) {
30412 LDKNodeFeatures orig_conv;
30413 orig_conv.inner = (void*)(orig & (~1));
30414 orig_conv.is_owned = false;
30415 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30416 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
30417 uint64_t ret_ref = 0;
30418 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30419 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30420 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30421 ret_ref = (uint64_t)ret_var.inner;
30422 if (ret_var.is_owned) {
30428 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
30429 LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
30430 uint64_t ret_ref = 0;
30431 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30432 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30433 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30434 ret_ref = (uint64_t)ret_var.inner;
30435 if (ret_var.is_owned) {
30440 int64_t __attribute__((visibility("default"))) TS_ChannelFeatures_clone_ptr(uint32_t arg) {
30441 LDKChannelFeatures arg_conv;
30442 arg_conv.inner = (void*)(arg & (~1));
30443 arg_conv.is_owned = false;
30444 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30445 int64_t ret_val = ChannelFeatures_clone_ptr(&arg_conv);
30449 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_clone(uint32_t orig) {
30450 LDKChannelFeatures orig_conv;
30451 orig_conv.inner = (void*)(orig & (~1));
30452 orig_conv.is_owned = false;
30453 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30454 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
30455 uint64_t ret_ref = 0;
30456 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30457 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30458 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30459 ret_ref = (uint64_t)ret_var.inner;
30460 if (ret_var.is_owned) {
30466 static inline uint64_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
30467 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
30468 uint64_t ret_ref = 0;
30469 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30470 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30471 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30472 ret_ref = (uint64_t)ret_var.inner;
30473 if (ret_var.is_owned) {
30478 int64_t __attribute__((visibility("default"))) TS_InvoiceFeatures_clone_ptr(uint32_t arg) {
30479 LDKInvoiceFeatures arg_conv;
30480 arg_conv.inner = (void*)(arg & (~1));
30481 arg_conv.is_owned = false;
30482 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30483 int64_t ret_val = InvoiceFeatures_clone_ptr(&arg_conv);
30487 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_clone(uint32_t orig) {
30488 LDKInvoiceFeatures orig_conv;
30489 orig_conv.inner = (void*)(orig & (~1));
30490 orig_conv.is_owned = false;
30491 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30492 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
30493 uint64_t ret_ref = 0;
30494 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30495 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30496 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30497 ret_ref = (uint64_t)ret_var.inner;
30498 if (ret_var.is_owned) {
30504 void __attribute__((visibility("default"))) TS_InitFeatures_free(uint32_t this_obj) {
30505 LDKInitFeatures this_obj_conv;
30506 this_obj_conv.inner = (void*)(this_obj & (~1));
30507 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30509 InitFeatures_free(this_obj_conv);
30512 void __attribute__((visibility("default"))) TS_NodeFeatures_free(uint32_t this_obj) {
30513 LDKNodeFeatures this_obj_conv;
30514 this_obj_conv.inner = (void*)(this_obj & (~1));
30515 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30516 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30517 NodeFeatures_free(this_obj_conv);
30520 void __attribute__((visibility("default"))) TS_ChannelFeatures_free(uint32_t this_obj) {
30521 LDKChannelFeatures this_obj_conv;
30522 this_obj_conv.inner = (void*)(this_obj & (~1));
30523 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30525 ChannelFeatures_free(this_obj_conv);
30528 void __attribute__((visibility("default"))) TS_InvoiceFeatures_free(uint32_t this_obj) {
30529 LDKInvoiceFeatures this_obj_conv;
30530 this_obj_conv.inner = (void*)(this_obj & (~1));
30531 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30532 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30533 InvoiceFeatures_free(this_obj_conv);
30536 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_empty() {
30537 LDKInitFeatures ret_var = InitFeatures_empty();
30538 uint64_t ret_ref = 0;
30539 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30540 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30541 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30542 ret_ref = (uint64_t)ret_var.inner;
30543 if (ret_var.is_owned) {
30549 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_known() {
30550 LDKInitFeatures ret_var = InitFeatures_known();
30551 uint64_t ret_ref = 0;
30552 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30553 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30554 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30555 ret_ref = (uint64_t)ret_var.inner;
30556 if (ret_var.is_owned) {
30562 jboolean __attribute__((visibility("default"))) TS_InitFeatures_requires_unknown_bits(uint32_t this_arg) {
30563 LDKInitFeatures this_arg_conv;
30564 this_arg_conv.inner = (void*)(this_arg & (~1));
30565 this_arg_conv.is_owned = false;
30566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30567 jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
30571 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_empty() {
30572 LDKNodeFeatures ret_var = NodeFeatures_empty();
30573 uint64_t ret_ref = 0;
30574 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30575 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30576 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30577 ret_ref = (uint64_t)ret_var.inner;
30578 if (ret_var.is_owned) {
30584 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_known() {
30585 LDKNodeFeatures ret_var = NodeFeatures_known();
30586 uint64_t ret_ref = 0;
30587 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30588 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30589 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30590 ret_ref = (uint64_t)ret_var.inner;
30591 if (ret_var.is_owned) {
30597 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_requires_unknown_bits(uint32_t this_arg) {
30598 LDKNodeFeatures this_arg_conv;
30599 this_arg_conv.inner = (void*)(this_arg & (~1));
30600 this_arg_conv.is_owned = false;
30601 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30602 jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
30606 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_empty() {
30607 LDKChannelFeatures ret_var = ChannelFeatures_empty();
30608 uint64_t ret_ref = 0;
30609 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30610 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30611 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30612 ret_ref = (uint64_t)ret_var.inner;
30613 if (ret_var.is_owned) {
30619 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_known() {
30620 LDKChannelFeatures ret_var = ChannelFeatures_known();
30621 uint64_t ret_ref = 0;
30622 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30623 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30624 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30625 ret_ref = (uint64_t)ret_var.inner;
30626 if (ret_var.is_owned) {
30632 jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_requires_unknown_bits(uint32_t this_arg) {
30633 LDKChannelFeatures this_arg_conv;
30634 this_arg_conv.inner = (void*)(this_arg & (~1));
30635 this_arg_conv.is_owned = false;
30636 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30637 jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
30641 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_empty() {
30642 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
30643 uint64_t ret_ref = 0;
30644 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30645 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30646 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30647 ret_ref = (uint64_t)ret_var.inner;
30648 if (ret_var.is_owned) {
30654 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_known() {
30655 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
30656 uint64_t ret_ref = 0;
30657 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30658 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30659 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30660 ret_ref = (uint64_t)ret_var.inner;
30661 if (ret_var.is_owned) {
30667 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_requires_unknown_bits(uint32_t this_arg) {
30668 LDKInvoiceFeatures this_arg_conv;
30669 this_arg_conv.inner = (void*)(this_arg & (~1));
30670 this_arg_conv.is_owned = false;
30671 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30672 jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
30676 jboolean __attribute__((visibility("default"))) TS_InitFeatures_supports_payment_secret(uint32_t this_arg) {
30677 LDKInitFeatures this_arg_conv;
30678 this_arg_conv.inner = (void*)(this_arg & (~1));
30679 this_arg_conv.is_owned = false;
30680 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30681 jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv);
30685 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_supports_payment_secret(uint32_t this_arg) {
30686 LDKNodeFeatures this_arg_conv;
30687 this_arg_conv.inner = (void*)(this_arg & (~1));
30688 this_arg_conv.is_owned = false;
30689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30690 jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv);
30694 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_supports_payment_secret(uint32_t this_arg) {
30695 LDKInvoiceFeatures this_arg_conv;
30696 this_arg_conv.inner = (void*)(this_arg & (~1));
30697 this_arg_conv.is_owned = false;
30698 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30699 jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
30703 int8_tArray __attribute__((visibility("default"))) TS_InitFeatures_write(uint32_t obj) {
30704 LDKInitFeatures obj_conv;
30705 obj_conv.inner = (void*)(obj & (~1));
30706 obj_conv.is_owned = false;
30707 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30708 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
30709 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30710 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30711 CVec_u8Z_free(ret_var);
30715 int8_tArray __attribute__((visibility("default"))) TS_NodeFeatures_write(uint32_t obj) {
30716 LDKNodeFeatures obj_conv;
30717 obj_conv.inner = (void*)(obj & (~1));
30718 obj_conv.is_owned = false;
30719 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30720 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
30721 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30722 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30723 CVec_u8Z_free(ret_var);
30727 int8_tArray __attribute__((visibility("default"))) TS_ChannelFeatures_write(uint32_t obj) {
30728 LDKChannelFeatures obj_conv;
30729 obj_conv.inner = (void*)(obj & (~1));
30730 obj_conv.is_owned = false;
30731 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30732 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
30733 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30734 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30735 CVec_u8Z_free(ret_var);
30739 int8_tArray __attribute__((visibility("default"))) TS_InvoiceFeatures_write(uint32_t obj) {
30740 LDKInvoiceFeatures obj_conv;
30741 obj_conv.inner = (void*)(obj & (~1));
30742 obj_conv.is_owned = false;
30743 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30744 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
30745 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30746 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30747 CVec_u8Z_free(ret_var);
30751 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_read(int8_tArray ser) {
30752 LDKu8slice ser_ref;
30753 ser_ref.datalen = *((uint32_t*)ser);
30754 ser_ref.data = (int8_t*)(ser + 4);
30755 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
30756 *ret_conv = InitFeatures_read(ser_ref);
30757 return (uint64_t)ret_conv;
30760 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_read(int8_tArray ser) {
30761 LDKu8slice ser_ref;
30762 ser_ref.datalen = *((uint32_t*)ser);
30763 ser_ref.data = (int8_t*)(ser + 4);
30764 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
30765 *ret_conv = NodeFeatures_read(ser_ref);
30766 return (uint64_t)ret_conv;
30769 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_read(int8_tArray ser) {
30770 LDKu8slice ser_ref;
30771 ser_ref.datalen = *((uint32_t*)ser);
30772 ser_ref.data = (int8_t*)(ser + 4);
30773 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
30774 *ret_conv = ChannelFeatures_read(ser_ref);
30775 return (uint64_t)ret_conv;
30778 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_read(int8_tArray ser) {
30779 LDKu8slice ser_ref;
30780 ser_ref.datalen = *((uint32_t*)ser);
30781 ser_ref.data = (int8_t*)(ser + 4);
30782 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
30783 *ret_conv = InvoiceFeatures_read(ser_ref);
30784 return (uint64_t)ret_conv;
30787 void __attribute__((visibility("default"))) TS_ShutdownScript_free(uint32_t this_obj) {
30788 LDKShutdownScript this_obj_conv;
30789 this_obj_conv.inner = (void*)(this_obj & (~1));
30790 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30791 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30792 ShutdownScript_free(this_obj_conv);
30795 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
30796 LDKShutdownScript ret_var = ShutdownScript_clone(arg);
30797 uint64_t ret_ref = 0;
30798 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30799 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30800 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30801 ret_ref = (uint64_t)ret_var.inner;
30802 if (ret_var.is_owned) {
30807 int64_t __attribute__((visibility("default"))) TS_ShutdownScript_clone_ptr(uint32_t arg) {
30808 LDKShutdownScript arg_conv;
30809 arg_conv.inner = (void*)(arg & (~1));
30810 arg_conv.is_owned = false;
30811 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30812 int64_t ret_val = ShutdownScript_clone_ptr(&arg_conv);
30816 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_clone(uint32_t orig) {
30817 LDKShutdownScript orig_conv;
30818 orig_conv.inner = (void*)(orig & (~1));
30819 orig_conv.is_owned = false;
30820 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30821 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
30822 uint64_t ret_ref = 0;
30823 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30824 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30825 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30826 ret_ref = (uint64_t)ret_var.inner;
30827 if (ret_var.is_owned) {
30833 void __attribute__((visibility("default"))) TS_InvalidShutdownScript_free(uint32_t this_obj) {
30834 LDKInvalidShutdownScript this_obj_conv;
30835 this_obj_conv.inner = (void*)(this_obj & (~1));
30836 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30837 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30838 InvalidShutdownScript_free(this_obj_conv);
30841 int8_tArray __attribute__((visibility("default"))) TS_InvalidShutdownScript_get_script(uint32_t this_ptr) {
30842 LDKInvalidShutdownScript this_ptr_conv;
30843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30844 this_ptr_conv.is_owned = false;
30845 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30846 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
30847 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30848 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30852 void __attribute__((visibility("default"))) TS_InvalidShutdownScript_set_script(uint32_t this_ptr, int8_tArray val) {
30853 LDKInvalidShutdownScript this_ptr_conv;
30854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30855 this_ptr_conv.is_owned = false;
30856 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30857 LDKCVec_u8Z val_ref;
30858 val_ref.datalen = *((uint32_t*)val);
30859 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
30860 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
30861 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
30864 uint32_t __attribute__((visibility("default"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
30865 LDKCVec_u8Z script_arg_ref;
30866 script_arg_ref.datalen = *((uint32_t*)script_arg);
30867 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
30868 memcpy(script_arg_ref.data, (uint8_t*)(script_arg + 4), script_arg_ref.datalen);
30869 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
30870 uint64_t ret_ref = 0;
30871 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30872 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30873 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30874 ret_ref = (uint64_t)ret_var.inner;
30875 if (ret_var.is_owned) {
30881 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
30882 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
30883 uint64_t ret_ref = 0;
30884 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30885 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30886 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30887 ret_ref = (uint64_t)ret_var.inner;
30888 if (ret_var.is_owned) {
30893 int64_t __attribute__((visibility("default"))) TS_InvalidShutdownScript_clone_ptr(uint32_t arg) {
30894 LDKInvalidShutdownScript arg_conv;
30895 arg_conv.inner = (void*)(arg & (~1));
30896 arg_conv.is_owned = false;
30897 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30898 int64_t ret_val = InvalidShutdownScript_clone_ptr(&arg_conv);
30902 uint32_t __attribute__((visibility("default"))) TS_InvalidShutdownScript_clone(uint32_t orig) {
30903 LDKInvalidShutdownScript orig_conv;
30904 orig_conv.inner = (void*)(orig & (~1));
30905 orig_conv.is_owned = false;
30906 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30907 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
30908 uint64_t ret_ref = 0;
30909 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30910 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30911 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30912 ret_ref = (uint64_t)ret_var.inner;
30913 if (ret_var.is_owned) {
30919 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_write(uint32_t obj) {
30920 LDKShutdownScript obj_conv;
30921 obj_conv.inner = (void*)(obj & (~1));
30922 obj_conv.is_owned = false;
30923 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30924 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
30925 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30926 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30927 CVec_u8Z_free(ret_var);
30931 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_read(int8_tArray ser) {
30932 LDKu8slice ser_ref;
30933 ser_ref.datalen = *((uint32_t*)ser);
30934 ser_ref.data = (int8_t*)(ser + 4);
30935 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
30936 *ret_conv = ShutdownScript_read(ser_ref);
30937 return (uint64_t)ret_conv;
30940 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
30941 unsigned char pubkey_hash_arr[20];
30942 CHECK(*((uint32_t*)pubkey_hash) == 20);
30943 memcpy(pubkey_hash_arr, (uint8_t*)(pubkey_hash + 4), 20);
30944 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
30945 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
30946 uint64_t ret_ref = 0;
30947 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30948 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30949 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30950 ret_ref = (uint64_t)ret_var.inner;
30951 if (ret_var.is_owned) {
30957 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
30958 unsigned char script_hash_arr[32];
30959 CHECK(*((uint32_t*)script_hash) == 32);
30960 memcpy(script_hash_arr, (uint8_t*)(script_hash + 4), 32);
30961 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
30962 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
30963 uint64_t ret_ref = 0;
30964 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30965 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30966 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30967 ret_ref = (uint64_t)ret_var.inner;
30968 if (ret_var.is_owned) {
30974 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
30975 LDKu8slice program_ref;
30976 program_ref.datalen = *((uint32_t*)program);
30977 program_ref.data = (int8_t*)(program + 4);
30978 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
30979 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
30980 return (uint64_t)ret_conv;
30983 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_into_inner(uint32_t this_arg) {
30984 LDKShutdownScript this_arg_conv;
30985 this_arg_conv.inner = (void*)(this_arg & (~1));
30986 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
30987 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30988 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
30989 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
30990 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
30991 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
30992 CVec_u8Z_free(ret_var);
30996 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_as_legacy_pubkey(uint32_t this_arg) {
30997 LDKShutdownScript this_arg_conv;
30998 this_arg_conv.inner = (void*)(this_arg & (~1));
30999 this_arg_conv.is_owned = false;
31000 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31001 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
31002 memcpy((uint8_t*)(ret_arr + 4), ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
31006 jboolean __attribute__((visibility("default"))) TS_ShutdownScript_is_compatible(uint32_t this_arg, uint32_t features) {
31007 LDKShutdownScript this_arg_conv;
31008 this_arg_conv.inner = (void*)(this_arg & (~1));
31009 this_arg_conv.is_owned = false;
31010 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31011 LDKInitFeatures features_conv;
31012 features_conv.inner = (void*)(features & (~1));
31013 features_conv.is_owned = false;
31014 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
31015 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
31019 void __attribute__((visibility("default"))) TS_CustomMessageReader_free(uint32_t this_ptr) {
31020 if ((this_ptr & 1) != 0) return;
31021 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
31022 CHECK_ACCESS(this_ptr_ptr);
31023 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
31024 FREE((void*)this_ptr);
31025 CustomMessageReader_free(this_ptr_conv);
31028 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
31029 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
31030 *ret_ret = Type_clone(arg);
31031 return (uint64_t)ret_ret;
31033 int64_t __attribute__((visibility("default"))) TS_Type_clone_ptr(uint32_t arg) {
31034 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
31035 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
31036 LDKType* arg_conv = (LDKType*)arg_ptr;
31037 int64_t ret_val = Type_clone_ptr(arg_conv);
31041 uint32_t __attribute__((visibility("default"))) TS_Type_clone(uint32_t orig) {
31042 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
31043 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
31044 LDKType* orig_conv = (LDKType*)orig_ptr;
31045 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
31046 *ret_ret = Type_clone(orig_conv);
31047 return (uint64_t)ret_ret;
31050 void __attribute__((visibility("default"))) TS_Type_free(uint32_t this_ptr) {
31051 if ((this_ptr & 1) != 0) return;
31052 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
31053 CHECK_ACCESS(this_ptr_ptr);
31054 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
31055 FREE((void*)this_ptr);
31056 Type_free(this_ptr_conv);
31059 void __attribute__((visibility("default"))) TS_Score_free(uint32_t this_ptr) {
31060 if ((this_ptr & 1) != 0) return;
31061 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
31062 CHECK_ACCESS(this_ptr_ptr);
31063 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
31064 FREE((void*)this_ptr);
31065 Score_free(this_ptr_conv);
31068 void __attribute__((visibility("default"))) TS_LockableScore_free(uint32_t this_obj) {
31069 LDKLockableScore this_obj_conv;
31070 this_obj_conv.inner = (void*)(this_obj & (~1));
31071 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31072 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31073 LockableScore_free(this_obj_conv);
31076 uint32_t __attribute__((visibility("default"))) TS_LockableScore_new(uint32_t score) {
31077 void* score_ptr = (void*)(((uint64_t)score) & ~1);
31078 CHECK_ACCESS(score_ptr);
31079 LDKScore score_conv = *(LDKScore*)(score_ptr);
31080 LDKLockableScore ret_var = LockableScore_new(score_conv);
31081 uint64_t ret_ref = 0;
31082 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31083 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31084 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31085 ret_ref = (uint64_t)ret_var.inner;
31086 if (ret_var.is_owned) {
31092 int8_tArray __attribute__((visibility("default"))) TS_LockableScore_write(uint32_t obj) {
31093 LDKLockableScore obj_conv;
31094 obj_conv.inner = (void*)(obj & (~1));
31095 obj_conv.is_owned = false;
31096 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31097 LDKCVec_u8Z ret_var = LockableScore_write(&obj_conv);
31098 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
31099 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
31100 CVec_u8Z_free(ret_var);
31104 void __attribute__((visibility("default"))) TS_NodeId_free(uint32_t this_obj) {
31105 LDKNodeId this_obj_conv;
31106 this_obj_conv.inner = (void*)(this_obj & (~1));
31107 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31108 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31109 NodeId_free(this_obj_conv);
31112 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
31113 LDKNodeId ret_var = NodeId_clone(arg);
31114 uint64_t ret_ref = 0;
31115 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31116 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31117 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31118 ret_ref = (uint64_t)ret_var.inner;
31119 if (ret_var.is_owned) {
31124 int64_t __attribute__((visibility("default"))) TS_NodeId_clone_ptr(uint32_t arg) {
31125 LDKNodeId arg_conv;
31126 arg_conv.inner = (void*)(arg & (~1));
31127 arg_conv.is_owned = false;
31128 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31129 int64_t ret_val = NodeId_clone_ptr(&arg_conv);
31133 uint32_t __attribute__((visibility("default"))) TS_NodeId_clone(uint32_t orig) {
31134 LDKNodeId orig_conv;
31135 orig_conv.inner = (void*)(orig & (~1));
31136 orig_conv.is_owned = false;
31137 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31138 LDKNodeId ret_var = NodeId_clone(&orig_conv);
31139 uint64_t ret_ref = 0;
31140 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31141 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31142 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31143 ret_ref = (uint64_t)ret_var.inner;
31144 if (ret_var.is_owned) {
31150 uint32_t __attribute__((visibility("default"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
31151 LDKPublicKey pubkey_ref;
31152 CHECK(*((uint32_t*)pubkey) == 33);
31153 memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33);
31154 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
31155 uint64_t ret_ref = 0;
31156 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31157 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31158 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31159 ret_ref = (uint64_t)ret_var.inner;
31160 if (ret_var.is_owned) {
31166 int8_tArray __attribute__((visibility("default"))) TS_NodeId_as_slice(uint32_t this_arg) {
31167 LDKNodeId this_arg_conv;
31168 this_arg_conv.inner = (void*)(this_arg & (~1));
31169 this_arg_conv.is_owned = false;
31170 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31171 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
31172 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
31173 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
31177 int64_t __attribute__((visibility("default"))) TS_NodeId_hash(uint32_t o) {
31179 o_conv.inner = (void*)(o & (~1));
31180 o_conv.is_owned = false;
31181 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31182 int64_t ret_val = NodeId_hash(&o_conv);
31186 int8_tArray __attribute__((visibility("default"))) TS_NodeId_write(uint32_t obj) {
31187 LDKNodeId obj_conv;
31188 obj_conv.inner = (void*)(obj & (~1));
31189 obj_conv.is_owned = false;
31190 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31191 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
31192 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
31193 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
31194 CVec_u8Z_free(ret_var);
31198 uint32_t __attribute__((visibility("default"))) TS_NodeId_read(int8_tArray ser) {
31199 LDKu8slice ser_ref;
31200 ser_ref.datalen = *((uint32_t*)ser);
31201 ser_ref.data = (int8_t*)(ser + 4);
31202 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
31203 *ret_conv = NodeId_read(ser_ref);
31204 return (uint64_t)ret_conv;
31207 void __attribute__((visibility("default"))) TS_NetworkGraph_free(uint32_t this_obj) {
31208 LDKNetworkGraph this_obj_conv;
31209 this_obj_conv.inner = (void*)(this_obj & (~1));
31210 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31211 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31212 NetworkGraph_free(this_obj_conv);
31215 static inline uint64_t NetworkGraph_clone_ptr(LDKNetworkGraph *NONNULL_PTR arg) {
31216 LDKNetworkGraph ret_var = NetworkGraph_clone(arg);
31217 uint64_t ret_ref = 0;
31218 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31219 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31220 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31221 ret_ref = (uint64_t)ret_var.inner;
31222 if (ret_var.is_owned) {
31227 int64_t __attribute__((visibility("default"))) TS_NetworkGraph_clone_ptr(uint32_t arg) {
31228 LDKNetworkGraph arg_conv;
31229 arg_conv.inner = (void*)(arg & (~1));
31230 arg_conv.is_owned = false;
31231 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31232 int64_t ret_val = NetworkGraph_clone_ptr(&arg_conv);
31236 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_clone(uint32_t orig) {
31237 LDKNetworkGraph orig_conv;
31238 orig_conv.inner = (void*)(orig & (~1));
31239 orig_conv.is_owned = false;
31240 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31241 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
31242 uint64_t ret_ref = 0;
31243 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31244 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31245 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31246 ret_ref = (uint64_t)ret_var.inner;
31247 if (ret_var.is_owned) {
31253 void __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_free(uint32_t this_obj) {
31254 LDKReadOnlyNetworkGraph this_obj_conv;
31255 this_obj_conv.inner = (void*)(this_obj & (~1));
31256 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31257 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31258 ReadOnlyNetworkGraph_free(this_obj_conv);
31261 void __attribute__((visibility("default"))) TS_NetworkUpdate_free(uint32_t this_ptr) {
31262 if ((this_ptr & 1) != 0) return;
31263 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
31264 CHECK_ACCESS(this_ptr_ptr);
31265 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
31266 FREE((void*)this_ptr);
31267 NetworkUpdate_free(this_ptr_conv);
31270 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
31271 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31272 *ret_copy = NetworkUpdate_clone(arg);
31273 uint64_t ret_ref = (uint64_t)ret_copy;
31276 int64_t __attribute__((visibility("default"))) TS_NetworkUpdate_clone_ptr(uint32_t arg) {
31277 LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)arg;
31278 int64_t ret_val = NetworkUpdate_clone_ptr(arg_conv);
31282 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_clone(uint32_t orig) {
31283 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
31284 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31285 *ret_copy = NetworkUpdate_clone(orig_conv);
31286 uint64_t ret_ref = (uint64_t)ret_copy;
31290 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_update_message(uint32_t msg) {
31291 LDKChannelUpdate msg_conv;
31292 msg_conv.inner = (void*)(msg & (~1));
31293 msg_conv.is_owned = (msg & 1) || (msg == 0);
31294 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
31295 msg_conv = ChannelUpdate_clone(&msg_conv);
31296 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31297 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
31298 uint64_t ret_ref = (uint64_t)ret_copy;
31302 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_closed(int64_t short_channel_id, jboolean is_permanent) {
31303 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31304 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
31305 uint64_t ret_ref = (uint64_t)ret_copy;
31309 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
31310 LDKPublicKey node_id_ref;
31311 CHECK(*((uint32_t*)node_id) == 33);
31312 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
31313 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31314 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
31315 uint64_t ret_ref = (uint64_t)ret_copy;
31319 int8_tArray __attribute__((visibility("default"))) TS_NetworkUpdate_write(uint32_t obj) {
31320 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
31321 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
31322 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
31323 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
31324 CVec_u8Z_free(ret_var);
31328 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_read(int8_tArray ser) {
31329 LDKu8slice ser_ref;
31330 ser_ref.datalen = *((uint32_t*)ser);
31331 ser_ref.data = (int8_t*)(ser + 4);
31332 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
31333 *ret_conv = NetworkUpdate_read(ser_ref);
31334 return (uint64_t)ret_conv;
31337 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_EventHandler(uint32_t this_arg) {
31338 LDKNetGraphMsgHandler this_arg_conv;
31339 this_arg_conv.inner = (void*)(this_arg & (~1));
31340 this_arg_conv.is_owned = false;
31341 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31342 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
31343 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
31344 return (uint64_t)ret_ret;
31347 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) {
31348 LDKNetGraphMsgHandler this_obj_conv;
31349 this_obj_conv.inner = (void*)(this_obj & (~1));
31350 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31351 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31352 NetGraphMsgHandler_free(this_obj_conv);
31355 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(uint32_t network_graph, uint32_t chain_access, uint32_t logger) {
31356 LDKNetworkGraph network_graph_conv;
31357 network_graph_conv.inner = (void*)(network_graph & (~1));
31358 network_graph_conv.is_owned = false;
31359 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
31360 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
31361 CHECK_ACCESS(chain_access_ptr);
31362 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
31363 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
31364 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
31365 // Manually implement clone for Java trait instances
31367 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
31368 CHECK_ACCESS(logger_ptr);
31369 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
31370 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(&network_graph_conv, chain_access_conv, logger_conv);
31371 uint64_t ret_ref = 0;
31372 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31373 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31374 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31375 ret_ref = (uint64_t)ret_var.inner;
31376 if (ret_var.is_owned) {
31382 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
31383 LDKNetGraphMsgHandler this_arg_conv;
31384 this_arg_conv.inner = (void*)(this_arg & (~1));
31385 this_arg_conv.is_owned = false;
31386 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31387 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
31388 CHECK_ACCESS(chain_access_ptr);
31389 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
31390 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
31391 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
31392 // Manually implement clone for Java trait instances
31394 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
31397 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
31398 LDKNetGraphMsgHandler this_arg_conv;
31399 this_arg_conv.inner = (void*)(this_arg & (~1));
31400 this_arg_conv.is_owned = false;
31401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31402 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
31403 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
31404 return (uint64_t)ret_ret;
31407 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
31408 LDKNetGraphMsgHandler this_arg_conv;
31409 this_arg_conv.inner = (void*)(this_arg & (~1));
31410 this_arg_conv.is_owned = false;
31411 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31412 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
31413 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
31414 return (uint64_t)ret_ret;
31417 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_obj) {
31418 LDKDirectionalChannelInfo this_obj_conv;
31419 this_obj_conv.inner = (void*)(this_obj & (~1));
31420 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31421 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31422 DirectionalChannelInfo_free(this_obj_conv);
31425 int32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) {
31426 LDKDirectionalChannelInfo this_ptr_conv;
31427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31428 this_ptr_conv.is_owned = false;
31429 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31430 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
31434 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) {
31435 LDKDirectionalChannelInfo this_ptr_conv;
31436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31437 this_ptr_conv.is_owned = false;
31438 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31439 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
31442 jboolean __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) {
31443 LDKDirectionalChannelInfo this_ptr_conv;
31444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31445 this_ptr_conv.is_owned = false;
31446 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31447 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
31451 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) {
31452 LDKDirectionalChannelInfo this_ptr_conv;
31453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31454 this_ptr_conv.is_owned = false;
31455 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31456 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
31459 int16_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
31460 LDKDirectionalChannelInfo this_ptr_conv;
31461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31462 this_ptr_conv.is_owned = false;
31463 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31464 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
31468 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
31469 LDKDirectionalChannelInfo this_ptr_conv;
31470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31471 this_ptr_conv.is_owned = false;
31472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31473 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
31476 int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
31477 LDKDirectionalChannelInfo this_ptr_conv;
31478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31479 this_ptr_conv.is_owned = false;
31480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31481 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
31485 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
31486 LDKDirectionalChannelInfo this_ptr_conv;
31487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31488 this_ptr_conv.is_owned = false;
31489 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31490 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
31493 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_maximum_msat(uint32_t this_ptr) {
31494 LDKDirectionalChannelInfo this_ptr_conv;
31495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31496 this_ptr_conv.is_owned = false;
31497 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31498 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31499 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
31500 uint64_t ret_ref = (uint64_t)ret_copy;
31504 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
31505 LDKDirectionalChannelInfo this_ptr_conv;
31506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31507 this_ptr_conv.is_owned = false;
31508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31509 void* val_ptr = (void*)(((uint64_t)val) & ~1);
31510 CHECK_ACCESS(val_ptr);
31511 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31512 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
31513 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
31516 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) {
31517 LDKDirectionalChannelInfo this_ptr_conv;
31518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31519 this_ptr_conv.is_owned = false;
31520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31521 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
31522 uint64_t ret_ref = 0;
31523 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31524 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31525 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31526 ret_ref = (uint64_t)ret_var.inner;
31527 if (ret_var.is_owned) {
31533 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) {
31534 LDKDirectionalChannelInfo this_ptr_conv;
31535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31536 this_ptr_conv.is_owned = false;
31537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31538 LDKRoutingFees val_conv;
31539 val_conv.inner = (void*)(val & (~1));
31540 val_conv.is_owned = (val & 1) || (val == 0);
31541 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31542 val_conv = RoutingFees_clone(&val_conv);
31543 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
31546 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) {
31547 LDKDirectionalChannelInfo this_ptr_conv;
31548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31549 this_ptr_conv.is_owned = false;
31550 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31551 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
31552 uint64_t ret_ref = 0;
31553 if ((uint64_t)ret_var.inner > 4096) {
31554 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31555 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31556 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31557 ret_ref = (uint64_t)ret_var.inner;
31558 if (ret_var.is_owned) {
31565 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
31566 LDKDirectionalChannelInfo this_ptr_conv;
31567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31568 this_ptr_conv.is_owned = false;
31569 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31570 LDKChannelUpdate val_conv;
31571 val_conv.inner = (void*)(val & (~1));
31572 val_conv.is_owned = (val & 1) || (val == 0);
31573 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31574 val_conv = ChannelUpdate_clone(&val_conv);
31575 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
31578 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) {
31579 void* htlc_maximum_msat_arg_ptr = (void*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
31580 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
31581 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
31582 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
31583 LDKRoutingFees fees_arg_conv;
31584 fees_arg_conv.inner = (void*)(fees_arg & (~1));
31585 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
31586 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
31587 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
31588 LDKChannelUpdate last_update_message_arg_conv;
31589 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
31590 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
31591 CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
31592 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
31593 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);
31594 uint64_t ret_ref = 0;
31595 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31596 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31597 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31598 ret_ref = (uint64_t)ret_var.inner;
31599 if (ret_var.is_owned) {
31605 static inline uint64_t DirectionalChannelInfo_clone_ptr(LDKDirectionalChannelInfo *NONNULL_PTR arg) {
31606 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(arg);
31607 uint64_t ret_ref = 0;
31608 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31609 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31610 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31611 ret_ref = (uint64_t)ret_var.inner;
31612 if (ret_var.is_owned) {
31617 int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone_ptr(uint32_t arg) {
31618 LDKDirectionalChannelInfo arg_conv;
31619 arg_conv.inner = (void*)(arg & (~1));
31620 arg_conv.is_owned = false;
31621 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31622 int64_t ret_val = DirectionalChannelInfo_clone_ptr(&arg_conv);
31626 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone(uint32_t orig) {
31627 LDKDirectionalChannelInfo orig_conv;
31628 orig_conv.inner = (void*)(orig & (~1));
31629 orig_conv.is_owned = false;
31630 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31631 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
31632 uint64_t ret_ref = 0;
31633 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31634 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31635 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31636 ret_ref = (uint64_t)ret_var.inner;
31637 if (ret_var.is_owned) {
31643 int8_tArray __attribute__((visibility("default"))) TS_DirectionalChannelInfo_write(uint32_t obj) {
31644 LDKDirectionalChannelInfo obj_conv;
31645 obj_conv.inner = (void*)(obj & (~1));
31646 obj_conv.is_owned = false;
31647 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31648 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
31649 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
31650 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
31651 CVec_u8Z_free(ret_var);
31655 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_read(int8_tArray ser) {
31656 LDKu8slice ser_ref;
31657 ser_ref.datalen = *((uint32_t*)ser);
31658 ser_ref.data = (int8_t*)(ser + 4);
31659 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
31660 *ret_conv = DirectionalChannelInfo_read(ser_ref);
31661 return (uint64_t)ret_conv;
31664 void __attribute__((visibility("default"))) TS_ChannelInfo_free(uint32_t this_obj) {
31665 LDKChannelInfo this_obj_conv;
31666 this_obj_conv.inner = (void*)(this_obj & (~1));
31667 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31668 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31669 ChannelInfo_free(this_obj_conv);
31672 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
31673 LDKChannelInfo this_ptr_conv;
31674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31675 this_ptr_conv.is_owned = false;
31676 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31677 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
31678 uint64_t ret_ref = 0;
31679 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31680 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31681 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31682 ret_ref = (uint64_t)ret_var.inner;
31683 if (ret_var.is_owned) {
31689 void __attribute__((visibility("default"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
31690 LDKChannelInfo this_ptr_conv;
31691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31692 this_ptr_conv.is_owned = false;
31693 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31694 LDKChannelFeatures val_conv;
31695 val_conv.inner = (void*)(val & (~1));
31696 val_conv.is_owned = (val & 1) || (val == 0);
31697 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31698 val_conv = ChannelFeatures_clone(&val_conv);
31699 ChannelInfo_set_features(&this_ptr_conv, val_conv);
31702 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
31703 LDKChannelInfo this_ptr_conv;
31704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31705 this_ptr_conv.is_owned = false;
31706 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31707 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
31708 uint64_t ret_ref = 0;
31709 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31710 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31711 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31712 ret_ref = (uint64_t)ret_var.inner;
31713 if (ret_var.is_owned) {
31719 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, uint32_t val) {
31720 LDKChannelInfo this_ptr_conv;
31721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31722 this_ptr_conv.is_owned = false;
31723 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31724 LDKNodeId val_conv;
31725 val_conv.inner = (void*)(val & (~1));
31726 val_conv.is_owned = (val & 1) || (val == 0);
31727 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31728 val_conv = NodeId_clone(&val_conv);
31729 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
31732 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
31733 LDKChannelInfo this_ptr_conv;
31734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31735 this_ptr_conv.is_owned = false;
31736 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31737 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
31738 uint64_t ret_ref = 0;
31739 if ((uint64_t)ret_var.inner > 4096) {
31740 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31741 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31742 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31743 ret_ref = (uint64_t)ret_var.inner;
31744 if (ret_var.is_owned) {
31751 void __attribute__((visibility("default"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
31752 LDKChannelInfo this_ptr_conv;
31753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31754 this_ptr_conv.is_owned = false;
31755 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31756 LDKDirectionalChannelInfo val_conv;
31757 val_conv.inner = (void*)(val & (~1));
31758 val_conv.is_owned = (val & 1) || (val == 0);
31759 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31760 val_conv = DirectionalChannelInfo_clone(&val_conv);
31761 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
31764 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
31765 LDKChannelInfo this_ptr_conv;
31766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31767 this_ptr_conv.is_owned = false;
31768 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31769 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
31770 uint64_t ret_ref = 0;
31771 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31772 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31773 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31774 ret_ref = (uint64_t)ret_var.inner;
31775 if (ret_var.is_owned) {
31781 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, uint32_t val) {
31782 LDKChannelInfo this_ptr_conv;
31783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31784 this_ptr_conv.is_owned = false;
31785 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31786 LDKNodeId val_conv;
31787 val_conv.inner = (void*)(val & (~1));
31788 val_conv.is_owned = (val & 1) || (val == 0);
31789 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31790 val_conv = NodeId_clone(&val_conv);
31791 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
31794 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
31795 LDKChannelInfo this_ptr_conv;
31796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31797 this_ptr_conv.is_owned = false;
31798 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31799 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
31800 uint64_t ret_ref = 0;
31801 if ((uint64_t)ret_var.inner > 4096) {
31802 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31803 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31804 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31805 ret_ref = (uint64_t)ret_var.inner;
31806 if (ret_var.is_owned) {
31813 void __attribute__((visibility("default"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
31814 LDKChannelInfo this_ptr_conv;
31815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31816 this_ptr_conv.is_owned = false;
31817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31818 LDKDirectionalChannelInfo val_conv;
31819 val_conv.inner = (void*)(val & (~1));
31820 val_conv.is_owned = (val & 1) || (val == 0);
31821 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31822 val_conv = DirectionalChannelInfo_clone(&val_conv);
31823 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
31826 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) {
31827 LDKChannelInfo this_ptr_conv;
31828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31829 this_ptr_conv.is_owned = false;
31830 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31831 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31832 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
31833 uint64_t ret_ref = (uint64_t)ret_copy;
31837 void __attribute__((visibility("default"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) {
31838 LDKChannelInfo this_ptr_conv;
31839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31840 this_ptr_conv.is_owned = false;
31841 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31842 void* val_ptr = (void*)(((uint64_t)val) & ~1);
31843 CHECK_ACCESS(val_ptr);
31844 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31845 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
31846 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
31849 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
31850 LDKChannelInfo this_ptr_conv;
31851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31852 this_ptr_conv.is_owned = false;
31853 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31854 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
31855 uint64_t ret_ref = 0;
31856 if ((uint64_t)ret_var.inner > 4096) {
31857 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31858 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31859 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31860 ret_ref = (uint64_t)ret_var.inner;
31861 if (ret_var.is_owned) {
31868 void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
31869 LDKChannelInfo this_ptr_conv;
31870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31871 this_ptr_conv.is_owned = false;
31872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31873 LDKChannelAnnouncement val_conv;
31874 val_conv.inner = (void*)(val & (~1));
31875 val_conv.is_owned = (val & 1) || (val == 0);
31876 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31877 val_conv = ChannelAnnouncement_clone(&val_conv);
31878 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
31881 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) {
31882 LDKChannelFeatures features_arg_conv;
31883 features_arg_conv.inner = (void*)(features_arg & (~1));
31884 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
31885 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
31886 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
31887 LDKNodeId node_one_arg_conv;
31888 node_one_arg_conv.inner = (void*)(node_one_arg & (~1));
31889 node_one_arg_conv.is_owned = (node_one_arg & 1) || (node_one_arg == 0);
31890 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_one_arg_conv);
31891 node_one_arg_conv = NodeId_clone(&node_one_arg_conv);
31892 LDKDirectionalChannelInfo one_to_two_arg_conv;
31893 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
31894 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
31895 CHECK_INNER_FIELD_ACCESS_OR_NULL(one_to_two_arg_conv);
31896 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
31897 LDKNodeId node_two_arg_conv;
31898 node_two_arg_conv.inner = (void*)(node_two_arg & (~1));
31899 node_two_arg_conv.is_owned = (node_two_arg & 1) || (node_two_arg == 0);
31900 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_two_arg_conv);
31901 node_two_arg_conv = NodeId_clone(&node_two_arg_conv);
31902 LDKDirectionalChannelInfo two_to_one_arg_conv;
31903 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
31904 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
31905 CHECK_INNER_FIELD_ACCESS_OR_NULL(two_to_one_arg_conv);
31906 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
31907 void* capacity_sats_arg_ptr = (void*)(((uint64_t)capacity_sats_arg) & ~1);
31908 CHECK_ACCESS(capacity_sats_arg_ptr);
31909 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(capacity_sats_arg_ptr);
31910 capacity_sats_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1));
31911 LDKChannelAnnouncement announcement_message_arg_conv;
31912 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
31913 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
31914 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
31915 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
31916 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);
31917 uint64_t ret_ref = 0;
31918 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31919 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31920 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31921 ret_ref = (uint64_t)ret_var.inner;
31922 if (ret_var.is_owned) {
31928 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
31929 LDKChannelInfo ret_var = ChannelInfo_clone(arg);
31930 uint64_t ret_ref = 0;
31931 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31932 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31933 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31934 ret_ref = (uint64_t)ret_var.inner;
31935 if (ret_var.is_owned) {
31940 int64_t __attribute__((visibility("default"))) TS_ChannelInfo_clone_ptr(uint32_t arg) {
31941 LDKChannelInfo arg_conv;
31942 arg_conv.inner = (void*)(arg & (~1));
31943 arg_conv.is_owned = false;
31944 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31945 int64_t ret_val = ChannelInfo_clone_ptr(&arg_conv);
31949 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_clone(uint32_t orig) {
31950 LDKChannelInfo orig_conv;
31951 orig_conv.inner = (void*)(orig & (~1));
31952 orig_conv.is_owned = false;
31953 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31954 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
31955 uint64_t ret_ref = 0;
31956 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31957 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31958 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31959 ret_ref = (uint64_t)ret_var.inner;
31960 if (ret_var.is_owned) {
31966 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_write(uint32_t obj) {
31967 LDKChannelInfo obj_conv;
31968 obj_conv.inner = (void*)(obj & (~1));
31969 obj_conv.is_owned = false;
31970 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31971 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
31972 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
31973 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
31974 CVec_u8Z_free(ret_var);
31978 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_read(int8_tArray ser) {
31979 LDKu8slice ser_ref;
31980 ser_ref.datalen = *((uint32_t*)ser);
31981 ser_ref.data = (int8_t*)(ser + 4);
31982 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
31983 *ret_conv = ChannelInfo_read(ser_ref);
31984 return (uint64_t)ret_conv;
31987 void __attribute__((visibility("default"))) TS_RoutingFees_free(uint32_t this_obj) {
31988 LDKRoutingFees this_obj_conv;
31989 this_obj_conv.inner = (void*)(this_obj & (~1));
31990 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31992 RoutingFees_free(this_obj_conv);
31995 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
31996 LDKRoutingFees this_ptr_conv;
31997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31998 this_ptr_conv.is_owned = false;
31999 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32000 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
32004 void __attribute__((visibility("default"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
32005 LDKRoutingFees this_ptr_conv;
32006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32007 this_ptr_conv.is_owned = false;
32008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32009 RoutingFees_set_base_msat(&this_ptr_conv, val);
32012 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
32013 LDKRoutingFees this_ptr_conv;
32014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32015 this_ptr_conv.is_owned = false;
32016 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32017 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
32021 void __attribute__((visibility("default"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
32022 LDKRoutingFees this_ptr_conv;
32023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32024 this_ptr_conv.is_owned = false;
32025 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32026 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
32029 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
32030 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
32031 uint64_t ret_ref = 0;
32032 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32033 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32034 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32035 ret_ref = (uint64_t)ret_var.inner;
32036 if (ret_var.is_owned) {
32042 jboolean __attribute__((visibility("default"))) TS_RoutingFees_eq(uint32_t a, uint32_t b) {
32043 LDKRoutingFees a_conv;
32044 a_conv.inner = (void*)(a & (~1));
32045 a_conv.is_owned = false;
32046 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32047 LDKRoutingFees b_conv;
32048 b_conv.inner = (void*)(b & (~1));
32049 b_conv.is_owned = false;
32050 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32051 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
32055 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
32056 LDKRoutingFees ret_var = RoutingFees_clone(arg);
32057 uint64_t ret_ref = 0;
32058 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32059 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32060 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32061 ret_ref = (uint64_t)ret_var.inner;
32062 if (ret_var.is_owned) {
32067 int64_t __attribute__((visibility("default"))) TS_RoutingFees_clone_ptr(uint32_t arg) {
32068 LDKRoutingFees arg_conv;
32069 arg_conv.inner = (void*)(arg & (~1));
32070 arg_conv.is_owned = false;
32071 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32072 int64_t ret_val = RoutingFees_clone_ptr(&arg_conv);
32076 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t orig) {
32077 LDKRoutingFees orig_conv;
32078 orig_conv.inner = (void*)(orig & (~1));
32079 orig_conv.is_owned = false;
32080 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32081 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
32082 uint64_t ret_ref = 0;
32083 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32084 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32085 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32086 ret_ref = (uint64_t)ret_var.inner;
32087 if (ret_var.is_owned) {
32093 int64_t __attribute__((visibility("default"))) TS_RoutingFees_hash(uint32_t o) {
32094 LDKRoutingFees o_conv;
32095 o_conv.inner = (void*)(o & (~1));
32096 o_conv.is_owned = false;
32097 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32098 int64_t ret_val = RoutingFees_hash(&o_conv);
32102 int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) {
32103 LDKRoutingFees obj_conv;
32104 obj_conv.inner = (void*)(obj & (~1));
32105 obj_conv.is_owned = false;
32106 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32107 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
32108 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
32109 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
32110 CVec_u8Z_free(ret_var);
32114 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_read(int8_tArray ser) {
32115 LDKu8slice ser_ref;
32116 ser_ref.datalen = *((uint32_t*)ser);
32117 ser_ref.data = (int8_t*)(ser + 4);
32118 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
32119 *ret_conv = RoutingFees_read(ser_ref);
32120 return (uint64_t)ret_conv;
32123 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) {
32124 LDKNodeAnnouncementInfo this_obj_conv;
32125 this_obj_conv.inner = (void*)(this_obj & (~1));
32126 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32127 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32128 NodeAnnouncementInfo_free(this_obj_conv);
32131 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
32132 LDKNodeAnnouncementInfo this_ptr_conv;
32133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32134 this_ptr_conv.is_owned = false;
32135 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32136 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
32137 uint64_t ret_ref = 0;
32138 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32139 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32140 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32141 ret_ref = (uint64_t)ret_var.inner;
32142 if (ret_var.is_owned) {
32148 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
32149 LDKNodeAnnouncementInfo this_ptr_conv;
32150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32151 this_ptr_conv.is_owned = false;
32152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32153 LDKNodeFeatures val_conv;
32154 val_conv.inner = (void*)(val & (~1));
32155 val_conv.is_owned = (val & 1) || (val == 0);
32156 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32157 val_conv = NodeFeatures_clone(&val_conv);
32158 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
32161 int32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
32162 LDKNodeAnnouncementInfo this_ptr_conv;
32163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32164 this_ptr_conv.is_owned = false;
32165 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32166 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
32170 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
32171 LDKNodeAnnouncementInfo this_ptr_conv;
32172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32173 this_ptr_conv.is_owned = false;
32174 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32175 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
32178 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
32179 LDKNodeAnnouncementInfo this_ptr_conv;
32180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32181 this_ptr_conv.is_owned = false;
32182 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32183 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
32184 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
32188 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
32189 LDKNodeAnnouncementInfo this_ptr_conv;
32190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32191 this_ptr_conv.is_owned = false;
32192 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32193 LDKThreeBytes val_ref;
32194 CHECK(*((uint32_t*)val) == 3);
32195 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
32196 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
32199 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
32200 LDKNodeAnnouncementInfo this_ptr_conv;
32201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32202 this_ptr_conv.is_owned = false;
32203 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32204 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
32205 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
32209 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
32210 LDKNodeAnnouncementInfo this_ptr_conv;
32211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32212 this_ptr_conv.is_owned = false;
32213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32214 LDKThirtyTwoBytes val_ref;
32215 CHECK(*((uint32_t*)val) == 32);
32216 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
32217 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
32220 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
32221 LDKNodeAnnouncementInfo this_ptr_conv;
32222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32223 this_ptr_conv.is_owned = false;
32224 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32225 LDKCVec_NetAddressZ val_constr;
32226 val_constr.datalen = *((uint32_t*)val);
32227 if (val_constr.datalen > 0)
32228 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
32230 val_constr.data = NULL;
32231 uint32_t* val_vals = (uint32_t*)(val + 4);
32232 for (size_t m = 0; m < val_constr.datalen; m++) {
32233 uint32_t val_conv_12 = val_vals[m];
32234 void* val_conv_12_ptr = (void*)(((uint64_t)val_conv_12) & ~1);
32235 CHECK_ACCESS(val_conv_12_ptr);
32236 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
32237 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
32238 val_constr.data[m] = val_conv_12_conv;
32240 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
32243 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
32244 LDKNodeAnnouncementInfo this_ptr_conv;
32245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32246 this_ptr_conv.is_owned = false;
32247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32248 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
32249 uint64_t ret_ref = 0;
32250 if ((uint64_t)ret_var.inner > 4096) {
32251 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32252 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32253 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32254 ret_ref = (uint64_t)ret_var.inner;
32255 if (ret_var.is_owned) {
32262 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
32263 LDKNodeAnnouncementInfo this_ptr_conv;
32264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32265 this_ptr_conv.is_owned = false;
32266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32267 LDKNodeAnnouncement val_conv;
32268 val_conv.inner = (void*)(val & (~1));
32269 val_conv.is_owned = (val & 1) || (val == 0);
32270 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32271 val_conv = NodeAnnouncement_clone(&val_conv);
32272 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
32275 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) {
32276 LDKNodeFeatures features_arg_conv;
32277 features_arg_conv.inner = (void*)(features_arg & (~1));
32278 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
32279 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
32280 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
32281 LDKThreeBytes rgb_arg_ref;
32282 CHECK(*((uint32_t*)rgb_arg) == 3);
32283 memcpy(rgb_arg_ref.data, (uint8_t*)(rgb_arg + 4), 3);
32284 LDKThirtyTwoBytes alias_arg_ref;
32285 CHECK(*((uint32_t*)alias_arg) == 32);
32286 memcpy(alias_arg_ref.data, (uint8_t*)(alias_arg + 4), 32);
32287 LDKCVec_NetAddressZ addresses_arg_constr;
32288 addresses_arg_constr.datalen = *((uint32_t*)addresses_arg);
32289 if (addresses_arg_constr.datalen > 0)
32290 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
32292 addresses_arg_constr.data = NULL;
32293 uint32_t* addresses_arg_vals = (uint32_t*)(addresses_arg + 4);
32294 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
32295 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
32296 void* addresses_arg_conv_12_ptr = (void*)(((uint64_t)addresses_arg_conv_12) & ~1);
32297 CHECK_ACCESS(addresses_arg_conv_12_ptr);
32298 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
32299 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
32301 LDKNodeAnnouncement announcement_message_arg_conv;
32302 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
32303 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
32304 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
32305 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
32306 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
32307 uint64_t ret_ref = 0;
32308 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32309 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32310 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32311 ret_ref = (uint64_t)ret_var.inner;
32312 if (ret_var.is_owned) {
32318 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
32319 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
32320 uint64_t ret_ref = 0;
32321 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32322 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32323 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32324 ret_ref = (uint64_t)ret_var.inner;
32325 if (ret_var.is_owned) {
32330 int64_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone_ptr(uint32_t arg) {
32331 LDKNodeAnnouncementInfo arg_conv;
32332 arg_conv.inner = (void*)(arg & (~1));
32333 arg_conv.is_owned = false;
32334 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32335 int64_t ret_val = NodeAnnouncementInfo_clone_ptr(&arg_conv);
32339 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
32340 LDKNodeAnnouncementInfo orig_conv;
32341 orig_conv.inner = (void*)(orig & (~1));
32342 orig_conv.is_owned = false;
32343 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32344 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
32345 uint64_t ret_ref = 0;
32346 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32347 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32348 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32349 ret_ref = (uint64_t)ret_var.inner;
32350 if (ret_var.is_owned) {
32356 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
32357 LDKNodeAnnouncementInfo obj_conv;
32358 obj_conv.inner = (void*)(obj & (~1));
32359 obj_conv.is_owned = false;
32360 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32361 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
32362 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
32363 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
32364 CVec_u8Z_free(ret_var);
32368 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
32369 LDKu8slice ser_ref;
32370 ser_ref.datalen = *((uint32_t*)ser);
32371 ser_ref.data = (int8_t*)(ser + 4);
32372 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
32373 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
32374 return (uint64_t)ret_conv;
32377 void __attribute__((visibility("default"))) TS_NodeInfo_free(uint32_t this_obj) {
32378 LDKNodeInfo this_obj_conv;
32379 this_obj_conv.inner = (void*)(this_obj & (~1));
32380 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32382 NodeInfo_free(this_obj_conv);
32385 void __attribute__((visibility("default"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
32386 LDKNodeInfo this_ptr_conv;
32387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32388 this_ptr_conv.is_owned = false;
32389 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32390 LDKCVec_u64Z val_constr;
32391 val_constr.datalen = *((uint32_t*)val);
32392 if (val_constr.datalen > 0)
32393 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
32395 val_constr.data = NULL;
32396 int64_t* val_vals = (int64_t*)(val + 4);
32397 for (size_t i = 0; i < val_constr.datalen; i++) {
32398 int64_t val_conv_8 = val_vals[i];
32399 val_constr.data[i] = val_conv_8;
32401 NodeInfo_set_channels(&this_ptr_conv, val_constr);
32404 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
32405 LDKNodeInfo this_ptr_conv;
32406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32407 this_ptr_conv.is_owned = false;
32408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32409 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
32410 uint64_t ret_ref = 0;
32411 if ((uint64_t)ret_var.inner > 4096) {
32412 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32413 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32414 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32415 ret_ref = (uint64_t)ret_var.inner;
32416 if (ret_var.is_owned) {
32423 void __attribute__((visibility("default"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) {
32424 LDKNodeInfo this_ptr_conv;
32425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32426 this_ptr_conv.is_owned = false;
32427 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32428 LDKRoutingFees val_conv;
32429 val_conv.inner = (void*)(val & (~1));
32430 val_conv.is_owned = (val & 1) || (val == 0);
32431 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32432 val_conv = RoutingFees_clone(&val_conv);
32433 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
32436 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
32437 LDKNodeInfo this_ptr_conv;
32438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32439 this_ptr_conv.is_owned = false;
32440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32441 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
32442 uint64_t ret_ref = 0;
32443 if ((uint64_t)ret_var.inner > 4096) {
32444 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32445 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32446 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32447 ret_ref = (uint64_t)ret_var.inner;
32448 if (ret_var.is_owned) {
32455 void __attribute__((visibility("default"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
32456 LDKNodeInfo this_ptr_conv;
32457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32458 this_ptr_conv.is_owned = false;
32459 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32460 LDKNodeAnnouncementInfo val_conv;
32461 val_conv.inner = (void*)(val & (~1));
32462 val_conv.is_owned = (val & 1) || (val == 0);
32463 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32464 val_conv = NodeAnnouncementInfo_clone(&val_conv);
32465 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
32468 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
32469 LDKCVec_u64Z channels_arg_constr;
32470 channels_arg_constr.datalen = *((uint32_t*)channels_arg);
32471 if (channels_arg_constr.datalen > 0)
32472 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
32474 channels_arg_constr.data = NULL;
32475 int64_t* channels_arg_vals = (int64_t*)(channels_arg + 4);
32476 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
32477 int64_t channels_arg_conv_8 = channels_arg_vals[i];
32478 channels_arg_constr.data[i] = channels_arg_conv_8;
32480 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
32481 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
32482 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
32483 CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
32484 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
32485 LDKNodeAnnouncementInfo announcement_info_arg_conv;
32486 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
32487 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
32488 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
32489 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
32490 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
32491 uint64_t ret_ref = 0;
32492 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32493 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32494 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32495 ret_ref = (uint64_t)ret_var.inner;
32496 if (ret_var.is_owned) {
32502 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
32503 LDKNodeInfo ret_var = NodeInfo_clone(arg);
32504 uint64_t ret_ref = 0;
32505 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32506 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32507 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32508 ret_ref = (uint64_t)ret_var.inner;
32509 if (ret_var.is_owned) {
32514 int64_t __attribute__((visibility("default"))) TS_NodeInfo_clone_ptr(uint32_t arg) {
32515 LDKNodeInfo arg_conv;
32516 arg_conv.inner = (void*)(arg & (~1));
32517 arg_conv.is_owned = false;
32518 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32519 int64_t ret_val = NodeInfo_clone_ptr(&arg_conv);
32523 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig) {
32524 LDKNodeInfo orig_conv;
32525 orig_conv.inner = (void*)(orig & (~1));
32526 orig_conv.is_owned = false;
32527 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32528 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
32529 uint64_t ret_ref = 0;
32530 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32531 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32532 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32533 ret_ref = (uint64_t)ret_var.inner;
32534 if (ret_var.is_owned) {
32540 int8_tArray __attribute__((visibility("default"))) TS_NodeInfo_write(uint32_t obj) {
32541 LDKNodeInfo obj_conv;
32542 obj_conv.inner = (void*)(obj & (~1));
32543 obj_conv.is_owned = false;
32544 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32545 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
32546 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
32547 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
32548 CVec_u8Z_free(ret_var);
32552 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_read(int8_tArray ser) {
32553 LDKu8slice ser_ref;
32554 ser_ref.datalen = *((uint32_t*)ser);
32555 ser_ref.data = (int8_t*)(ser + 4);
32556 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
32557 *ret_conv = NodeInfo_read(ser_ref);
32558 return (uint64_t)ret_conv;
32561 int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32_t obj) {
32562 LDKNetworkGraph obj_conv;
32563 obj_conv.inner = (void*)(obj & (~1));
32564 obj_conv.is_owned = false;
32565 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32566 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
32567 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
32568 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
32569 CVec_u8Z_free(ret_var);
32573 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read(int8_tArray ser) {
32574 LDKu8slice ser_ref;
32575 ser_ref.datalen = *((uint32_t*)ser);
32576 ser_ref.data = (int8_t*)(ser + 4);
32577 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
32578 *ret_conv = NetworkGraph_read(ser_ref);
32579 return (uint64_t)ret_conv;
32582 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray genesis_hash) {
32583 LDKThirtyTwoBytes genesis_hash_ref;
32584 CHECK(*((uint32_t*)genesis_hash) == 32);
32585 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
32586 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
32587 uint64_t ret_ref = 0;
32588 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32589 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32590 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32591 ret_ref = (uint64_t)ret_var.inner;
32592 if (ret_var.is_owned) {
32598 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read_only(uint32_t this_arg) {
32599 LDKNetworkGraph this_arg_conv;
32600 this_arg_conv.inner = (void*)(this_arg & (~1));
32601 this_arg_conv.is_owned = false;
32602 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32603 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
32604 uint64_t ret_ref = 0;
32605 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32606 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32607 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32608 ret_ref = (uint64_t)ret_var.inner;
32609 if (ret_var.is_owned) {
32615 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
32616 LDKNetworkGraph this_arg_conv;
32617 this_arg_conv.inner = (void*)(this_arg & (~1));
32618 this_arg_conv.is_owned = false;
32619 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32620 LDKNodeAnnouncement msg_conv;
32621 msg_conv.inner = (void*)(msg & (~1));
32622 msg_conv.is_owned = false;
32623 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32624 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
32625 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
32626 return (uint64_t)ret_conv;
32629 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) {
32630 LDKNetworkGraph this_arg_conv;
32631 this_arg_conv.inner = (void*)(this_arg & (~1));
32632 this_arg_conv.is_owned = false;
32633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32634 LDKUnsignedNodeAnnouncement msg_conv;
32635 msg_conv.inner = (void*)(msg & (~1));
32636 msg_conv.is_owned = false;
32637 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32638 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
32639 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
32640 return (uint64_t)ret_conv;
32643 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
32644 LDKNetworkGraph this_arg_conv;
32645 this_arg_conv.inner = (void*)(this_arg & (~1));
32646 this_arg_conv.is_owned = false;
32647 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32648 LDKChannelAnnouncement msg_conv;
32649 msg_conv.inner = (void*)(msg & (~1));
32650 msg_conv.is_owned = false;
32651 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32652 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
32653 CHECK_ACCESS(chain_access_ptr);
32654 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
32655 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
32656 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
32657 // Manually implement clone for Java trait instances
32659 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
32660 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
32661 return (uint64_t)ret_conv;
32664 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
32665 LDKNetworkGraph this_arg_conv;
32666 this_arg_conv.inner = (void*)(this_arg & (~1));
32667 this_arg_conv.is_owned = false;
32668 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32669 LDKUnsignedChannelAnnouncement msg_conv;
32670 msg_conv.inner = (void*)(msg & (~1));
32671 msg_conv.is_owned = false;
32672 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32673 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
32674 CHECK_ACCESS(chain_access_ptr);
32675 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
32676 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
32677 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
32678 // Manually implement clone for Java trait instances
32680 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
32681 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
32682 return (uint64_t)ret_conv;
32685 void __attribute__((visibility("default"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
32686 LDKNetworkGraph this_arg_conv;
32687 this_arg_conv.inner = (void*)(this_arg & (~1));
32688 this_arg_conv.is_owned = false;
32689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32690 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
32693 void __attribute__((visibility("default"))) TS_NetworkGraph_fail_node(uint32_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
32694 LDKNetworkGraph this_arg_conv;
32695 this_arg_conv.inner = (void*)(this_arg & (~1));
32696 this_arg_conv.is_owned = false;
32697 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32698 LDKPublicKey _node_id_ref;
32699 CHECK(*((uint32_t*)_node_id) == 33);
32700 memcpy(_node_id_ref.compressed_form, (uint8_t*)(_node_id + 4), 33);
32701 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
32704 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
32705 LDKNetworkGraph this_arg_conv;
32706 this_arg_conv.inner = (void*)(this_arg & (~1));
32707 this_arg_conv.is_owned = false;
32708 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32709 LDKChannelUpdate msg_conv;
32710 msg_conv.inner = (void*)(msg & (~1));
32711 msg_conv.is_owned = false;
32712 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32713 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
32714 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
32715 return (uint64_t)ret_conv;
32718 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
32719 LDKNetworkGraph this_arg_conv;
32720 this_arg_conv.inner = (void*)(this_arg & (~1));
32721 this_arg_conv.is_owned = false;
32722 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32723 LDKUnsignedChannelUpdate msg_conv;
32724 msg_conv.inner = (void*)(msg & (~1));
32725 msg_conv.is_owned = false;
32726 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32727 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
32728 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
32729 return (uint64_t)ret_conv;
32732 uint32_t __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_get_addresses(uint32_t this_arg, int8_tArray pubkey) {
32733 LDKReadOnlyNetworkGraph this_arg_conv;
32734 this_arg_conv.inner = (void*)(this_arg & (~1));
32735 this_arg_conv.is_owned = false;
32736 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32737 LDKPublicKey pubkey_ref;
32738 CHECK(*((uint32_t*)pubkey) == 33);
32739 memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33);
32740 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
32741 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
32742 uint64_t ret_ref = (uint64_t)ret_copy;
32746 void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) {
32747 LDKRouteHop this_obj_conv;
32748 this_obj_conv.inner = (void*)(this_obj & (~1));
32749 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32751 RouteHop_free(this_obj_conv);
32754 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
32755 LDKRouteHop this_ptr_conv;
32756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32757 this_ptr_conv.is_owned = false;
32758 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32759 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
32760 memcpy((uint8_t*)(ret_arr + 4), RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
32764 void __attribute__((visibility("default"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
32765 LDKRouteHop this_ptr_conv;
32766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32767 this_ptr_conv.is_owned = false;
32768 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32769 LDKPublicKey val_ref;
32770 CHECK(*((uint32_t*)val) == 33);
32771 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
32772 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
32775 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
32776 LDKRouteHop this_ptr_conv;
32777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32778 this_ptr_conv.is_owned = false;
32779 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32780 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
32781 uint64_t ret_ref = 0;
32782 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32783 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32784 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32785 ret_ref = (uint64_t)ret_var.inner;
32786 if (ret_var.is_owned) {
32792 void __attribute__((visibility("default"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
32793 LDKRouteHop this_ptr_conv;
32794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32795 this_ptr_conv.is_owned = false;
32796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32797 LDKNodeFeatures val_conv;
32798 val_conv.inner = (void*)(val & (~1));
32799 val_conv.is_owned = (val & 1) || (val == 0);
32800 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32801 val_conv = NodeFeatures_clone(&val_conv);
32802 RouteHop_set_node_features(&this_ptr_conv, val_conv);
32805 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
32806 LDKRouteHop this_ptr_conv;
32807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32808 this_ptr_conv.is_owned = false;
32809 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32810 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
32814 void __attribute__((visibility("default"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
32815 LDKRouteHop this_ptr_conv;
32816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32817 this_ptr_conv.is_owned = false;
32818 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32819 RouteHop_set_short_channel_id(&this_ptr_conv, val);
32822 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
32823 LDKRouteHop this_ptr_conv;
32824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32825 this_ptr_conv.is_owned = false;
32826 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32827 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
32828 uint64_t ret_ref = 0;
32829 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32830 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32831 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32832 ret_ref = (uint64_t)ret_var.inner;
32833 if (ret_var.is_owned) {
32839 void __attribute__((visibility("default"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
32840 LDKRouteHop this_ptr_conv;
32841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32842 this_ptr_conv.is_owned = false;
32843 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32844 LDKChannelFeatures val_conv;
32845 val_conv.inner = (void*)(val & (~1));
32846 val_conv.is_owned = (val & 1) || (val == 0);
32847 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32848 val_conv = ChannelFeatures_clone(&val_conv);
32849 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
32852 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
32853 LDKRouteHop this_ptr_conv;
32854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32855 this_ptr_conv.is_owned = false;
32856 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32857 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
32861 void __attribute__((visibility("default"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
32862 LDKRouteHop this_ptr_conv;
32863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32864 this_ptr_conv.is_owned = false;
32865 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32866 RouteHop_set_fee_msat(&this_ptr_conv, val);
32869 int32_t __attribute__((visibility("default"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
32870 LDKRouteHop this_ptr_conv;
32871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32872 this_ptr_conv.is_owned = false;
32873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32874 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
32878 void __attribute__((visibility("default"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
32879 LDKRouteHop this_ptr_conv;
32880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32881 this_ptr_conv.is_owned = false;
32882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32883 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
32886 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) {
32887 LDKPublicKey pubkey_arg_ref;
32888 CHECK(*((uint32_t*)pubkey_arg) == 33);
32889 memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33);
32890 LDKNodeFeatures node_features_arg_conv;
32891 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
32892 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
32893 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
32894 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
32895 LDKChannelFeatures channel_features_arg_conv;
32896 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
32897 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
32898 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
32899 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
32900 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);
32901 uint64_t ret_ref = 0;
32902 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32903 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32904 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32905 ret_ref = (uint64_t)ret_var.inner;
32906 if (ret_var.is_owned) {
32912 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
32913 LDKRouteHop ret_var = RouteHop_clone(arg);
32914 uint64_t ret_ref = 0;
32915 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32916 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32917 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32918 ret_ref = (uint64_t)ret_var.inner;
32919 if (ret_var.is_owned) {
32924 int64_t __attribute__((visibility("default"))) TS_RouteHop_clone_ptr(uint32_t arg) {
32925 LDKRouteHop arg_conv;
32926 arg_conv.inner = (void*)(arg & (~1));
32927 arg_conv.is_owned = false;
32928 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32929 int64_t ret_val = RouteHop_clone_ptr(&arg_conv);
32933 uint32_t __attribute__((visibility("default"))) TS_RouteHop_clone(uint32_t orig) {
32934 LDKRouteHop orig_conv;
32935 orig_conv.inner = (void*)(orig & (~1));
32936 orig_conv.is_owned = false;
32937 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32938 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
32939 uint64_t ret_ref = 0;
32940 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32941 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32942 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32943 ret_ref = (uint64_t)ret_var.inner;
32944 if (ret_var.is_owned) {
32950 int64_t __attribute__((visibility("default"))) TS_RouteHop_hash(uint32_t o) {
32951 LDKRouteHop o_conv;
32952 o_conv.inner = (void*)(o & (~1));
32953 o_conv.is_owned = false;
32954 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32955 int64_t ret_val = RouteHop_hash(&o_conv);
32959 jboolean __attribute__((visibility("default"))) TS_RouteHop_eq(uint32_t a, uint32_t b) {
32960 LDKRouteHop a_conv;
32961 a_conv.inner = (void*)(a & (~1));
32962 a_conv.is_owned = false;
32963 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32964 LDKRouteHop b_conv;
32965 b_conv.inner = (void*)(b & (~1));
32966 b_conv.is_owned = false;
32967 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32968 jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
32972 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_write(uint32_t obj) {
32973 LDKRouteHop obj_conv;
32974 obj_conv.inner = (void*)(obj & (~1));
32975 obj_conv.is_owned = false;
32976 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32977 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
32978 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
32979 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
32980 CVec_u8Z_free(ret_var);
32984 uint32_t __attribute__((visibility("default"))) TS_RouteHop_read(int8_tArray ser) {
32985 LDKu8slice ser_ref;
32986 ser_ref.datalen = *((uint32_t*)ser);
32987 ser_ref.data = (int8_t*)(ser + 4);
32988 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
32989 *ret_conv = RouteHop_read(ser_ref);
32990 return (uint64_t)ret_conv;
32993 void __attribute__((visibility("default"))) TS_Route_free(uint32_t this_obj) {
32994 LDKRoute this_obj_conv;
32995 this_obj_conv.inner = (void*)(this_obj & (~1));
32996 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32997 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32998 Route_free(this_obj_conv);
33001 ptrArray __attribute__((visibility("default"))) TS_Route_get_paths(uint32_t this_ptr) {
33002 LDKRoute this_ptr_conv;
33003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33004 this_ptr_conv.is_owned = false;
33005 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33006 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
33007 ptrArray ret_arr = NULL;
33008 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
33009 uint32_tArray *ret_arr_ptr = (uint32_tArray*)(ret_arr + 4);
33010 for (size_t m = 0; m < ret_var.datalen; m++) {
33011 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
33012 uint32_tArray ret_conv_12_arr = NULL;
33013 ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
33014 uint32_t *ret_conv_12_arr_ptr = (uint32_t*)(ret_conv_12_arr + 4);
33015 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
33016 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
33017 uint64_t ret_conv_12_conv_10_ref = 0;
33018 CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33019 CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33020 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
33021 ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner;
33022 if (ret_conv_12_conv_10_var.is_owned) {
33023 ret_conv_12_conv_10_ref |= 1;
33025 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
33028 FREE(ret_conv_12_var.data);
33029 ret_arr_ptr[m] = ret_conv_12_arr;
33032 FREE(ret_var.data);
33036 void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
33037 LDKRoute this_ptr_conv;
33038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33039 this_ptr_conv.is_owned = false;
33040 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33041 LDKCVec_CVec_RouteHopZZ val_constr;
33042 val_constr.datalen = *((uint32_t*)val);
33043 if (val_constr.datalen > 0)
33044 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
33046 val_constr.data = NULL;
33047 uint32_tArray* val_vals = (uint32_tArray*)(val + 4);
33048 for (size_t m = 0; m < val_constr.datalen; m++) {
33049 uint32_tArray val_conv_12 = val_vals[m];
33050 LDKCVec_RouteHopZ val_conv_12_constr;
33051 val_conv_12_constr.datalen = *((uint32_t*)val_conv_12);
33052 if (val_conv_12_constr.datalen > 0)
33053 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
33055 val_conv_12_constr.data = NULL;
33056 uint32_t* val_conv_12_vals = (uint32_t*)(val_conv_12 + 4);
33057 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
33058 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
33059 LDKRouteHop val_conv_12_conv_10_conv;
33060 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
33061 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
33062 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
33063 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
33064 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
33066 val_constr.data[m] = val_conv_12_constr;
33068 Route_set_paths(&this_ptr_conv, val_constr);
33071 uint32_t __attribute__((visibility("default"))) TS_Route_get_payee(uint32_t this_ptr) {
33072 LDKRoute this_ptr_conv;
33073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33074 this_ptr_conv.is_owned = false;
33075 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33076 LDKPayee ret_var = Route_get_payee(&this_ptr_conv);
33077 uint64_t ret_ref = 0;
33078 if ((uint64_t)ret_var.inner > 4096) {
33079 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33080 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33081 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33082 ret_ref = (uint64_t)ret_var.inner;
33083 if (ret_var.is_owned) {
33090 void __attribute__((visibility("default"))) TS_Route_set_payee(uint32_t this_ptr, uint32_t val) {
33091 LDKRoute this_ptr_conv;
33092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33093 this_ptr_conv.is_owned = false;
33094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33096 val_conv.inner = (void*)(val & (~1));
33097 val_conv.is_owned = (val & 1) || (val == 0);
33098 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33099 val_conv = Payee_clone(&val_conv);
33100 Route_set_payee(&this_ptr_conv, val_conv);
33103 uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg, uint32_t payee_arg) {
33104 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
33105 paths_arg_constr.datalen = *((uint32_t*)paths_arg);
33106 if (paths_arg_constr.datalen > 0)
33107 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
33109 paths_arg_constr.data = NULL;
33110 uint32_tArray* paths_arg_vals = (uint32_tArray*)(paths_arg + 4);
33111 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
33112 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
33113 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
33114 paths_arg_conv_12_constr.datalen = *((uint32_t*)paths_arg_conv_12);
33115 if (paths_arg_conv_12_constr.datalen > 0)
33116 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
33118 paths_arg_conv_12_constr.data = NULL;
33119 uint32_t* paths_arg_conv_12_vals = (uint32_t*)(paths_arg_conv_12 + 4);
33120 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
33121 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
33122 LDKRouteHop paths_arg_conv_12_conv_10_conv;
33123 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
33124 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
33125 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
33126 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
33127 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
33129 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
33131 LDKPayee payee_arg_conv;
33132 payee_arg_conv.inner = (void*)(payee_arg & (~1));
33133 payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0);
33134 CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_arg_conv);
33135 payee_arg_conv = Payee_clone(&payee_arg_conv);
33136 LDKRoute ret_var = Route_new(paths_arg_constr, payee_arg_conv);
33137 uint64_t ret_ref = 0;
33138 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33139 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33140 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33141 ret_ref = (uint64_t)ret_var.inner;
33142 if (ret_var.is_owned) {
33148 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
33149 LDKRoute ret_var = Route_clone(arg);
33150 uint64_t ret_ref = 0;
33151 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33152 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33153 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33154 ret_ref = (uint64_t)ret_var.inner;
33155 if (ret_var.is_owned) {
33160 int64_t __attribute__((visibility("default"))) TS_Route_clone_ptr(uint32_t arg) {
33162 arg_conv.inner = (void*)(arg & (~1));
33163 arg_conv.is_owned = false;
33164 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33165 int64_t ret_val = Route_clone_ptr(&arg_conv);
33169 uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) {
33170 LDKRoute orig_conv;
33171 orig_conv.inner = (void*)(orig & (~1));
33172 orig_conv.is_owned = false;
33173 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33174 LDKRoute ret_var = Route_clone(&orig_conv);
33175 uint64_t ret_ref = 0;
33176 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33177 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33178 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33179 ret_ref = (uint64_t)ret_var.inner;
33180 if (ret_var.is_owned) {
33186 int64_t __attribute__((visibility("default"))) TS_Route_hash(uint32_t o) {
33188 o_conv.inner = (void*)(o & (~1));
33189 o_conv.is_owned = false;
33190 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33191 int64_t ret_val = Route_hash(&o_conv);
33195 jboolean __attribute__((visibility("default"))) TS_Route_eq(uint32_t a, uint32_t b) {
33197 a_conv.inner = (void*)(a & (~1));
33198 a_conv.is_owned = false;
33199 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33201 b_conv.inner = (void*)(b & (~1));
33202 b_conv.is_owned = false;
33203 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33204 jboolean ret_val = Route_eq(&a_conv, &b_conv);
33208 int64_t __attribute__((visibility("default"))) TS_Route_get_total_fees(uint32_t this_arg) {
33209 LDKRoute this_arg_conv;
33210 this_arg_conv.inner = (void*)(this_arg & (~1));
33211 this_arg_conv.is_owned = false;
33212 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33213 int64_t ret_val = Route_get_total_fees(&this_arg_conv);
33217 int64_t __attribute__((visibility("default"))) TS_Route_get_total_amount(uint32_t this_arg) {
33218 LDKRoute this_arg_conv;
33219 this_arg_conv.inner = (void*)(this_arg & (~1));
33220 this_arg_conv.is_owned = false;
33221 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33222 int64_t ret_val = Route_get_total_amount(&this_arg_conv);
33226 int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) {
33228 obj_conv.inner = (void*)(obj & (~1));
33229 obj_conv.is_owned = false;
33230 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33231 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
33232 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
33233 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
33234 CVec_u8Z_free(ret_var);
33238 uint32_t __attribute__((visibility("default"))) TS_Route_read(int8_tArray ser) {
33239 LDKu8slice ser_ref;
33240 ser_ref.datalen = *((uint32_t*)ser);
33241 ser_ref.data = (int8_t*)(ser + 4);
33242 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
33243 *ret_conv = Route_read(ser_ref);
33244 return (uint64_t)ret_conv;
33247 void __attribute__((visibility("default"))) TS_RouteParameters_free(uint32_t this_obj) {
33248 LDKRouteParameters this_obj_conv;
33249 this_obj_conv.inner = (void*)(this_obj & (~1));
33250 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33251 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33252 RouteParameters_free(this_obj_conv);
33255 uint32_t __attribute__((visibility("default"))) TS_RouteParameters_get_payee(uint32_t this_ptr) {
33256 LDKRouteParameters this_ptr_conv;
33257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33258 this_ptr_conv.is_owned = false;
33259 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33260 LDKPayee ret_var = RouteParameters_get_payee(&this_ptr_conv);
33261 uint64_t ret_ref = 0;
33262 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33263 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33264 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33265 ret_ref = (uint64_t)ret_var.inner;
33266 if (ret_var.is_owned) {
33272 void __attribute__((visibility("default"))) TS_RouteParameters_set_payee(uint32_t this_ptr, uint32_t val) {
33273 LDKRouteParameters this_ptr_conv;
33274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33275 this_ptr_conv.is_owned = false;
33276 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33278 val_conv.inner = (void*)(val & (~1));
33279 val_conv.is_owned = (val & 1) || (val == 0);
33280 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33281 val_conv = Payee_clone(&val_conv);
33282 RouteParameters_set_payee(&this_ptr_conv, val_conv);
33285 int64_t __attribute__((visibility("default"))) TS_RouteParameters_get_final_value_msat(uint32_t this_ptr) {
33286 LDKRouteParameters this_ptr_conv;
33287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33288 this_ptr_conv.is_owned = false;
33289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33290 int64_t ret_val = RouteParameters_get_final_value_msat(&this_ptr_conv);
33294 void __attribute__((visibility("default"))) TS_RouteParameters_set_final_value_msat(uint32_t this_ptr, int64_t val) {
33295 LDKRouteParameters this_ptr_conv;
33296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33297 this_ptr_conv.is_owned = false;
33298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33299 RouteParameters_set_final_value_msat(&this_ptr_conv, val);
33302 int32_t __attribute__((visibility("default"))) TS_RouteParameters_get_final_cltv_expiry_delta(uint32_t this_ptr) {
33303 LDKRouteParameters this_ptr_conv;
33304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33305 this_ptr_conv.is_owned = false;
33306 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33307 int32_t ret_val = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
33311 void __attribute__((visibility("default"))) TS_RouteParameters_set_final_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
33312 LDKRouteParameters this_ptr_conv;
33313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33314 this_ptr_conv.is_owned = false;
33315 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33316 RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
33319 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) {
33320 LDKPayee payee_arg_conv;
33321 payee_arg_conv.inner = (void*)(payee_arg & (~1));
33322 payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0);
33323 CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_arg_conv);
33324 payee_arg_conv = Payee_clone(&payee_arg_conv);
33325 LDKRouteParameters ret_var = RouteParameters_new(payee_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
33326 uint64_t ret_ref = 0;
33327 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33328 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33329 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33330 ret_ref = (uint64_t)ret_var.inner;
33331 if (ret_var.is_owned) {
33337 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
33338 LDKRouteParameters ret_var = RouteParameters_clone(arg);
33339 uint64_t ret_ref = 0;
33340 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33341 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33342 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33343 ret_ref = (uint64_t)ret_var.inner;
33344 if (ret_var.is_owned) {
33349 int64_t __attribute__((visibility("default"))) TS_RouteParameters_clone_ptr(uint32_t arg) {
33350 LDKRouteParameters arg_conv;
33351 arg_conv.inner = (void*)(arg & (~1));
33352 arg_conv.is_owned = false;
33353 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33354 int64_t ret_val = RouteParameters_clone_ptr(&arg_conv);
33358 uint32_t __attribute__((visibility("default"))) TS_RouteParameters_clone(uint32_t orig) {
33359 LDKRouteParameters orig_conv;
33360 orig_conv.inner = (void*)(orig & (~1));
33361 orig_conv.is_owned = false;
33362 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33363 LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
33364 uint64_t ret_ref = 0;
33365 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33366 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33367 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33368 ret_ref = (uint64_t)ret_var.inner;
33369 if (ret_var.is_owned) {
33375 int8_tArray __attribute__((visibility("default"))) TS_RouteParameters_write(uint32_t obj) {
33376 LDKRouteParameters obj_conv;
33377 obj_conv.inner = (void*)(obj & (~1));
33378 obj_conv.is_owned = false;
33379 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33380 LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
33381 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
33382 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
33383 CVec_u8Z_free(ret_var);
33387 uint32_t __attribute__((visibility("default"))) TS_RouteParameters_read(int8_tArray ser) {
33388 LDKu8slice ser_ref;
33389 ser_ref.datalen = *((uint32_t*)ser);
33390 ser_ref.data = (int8_t*)(ser + 4);
33391 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
33392 *ret_conv = RouteParameters_read(ser_ref);
33393 return (uint64_t)ret_conv;
33396 void __attribute__((visibility("default"))) TS_Payee_free(uint32_t this_obj) {
33397 LDKPayee this_obj_conv;
33398 this_obj_conv.inner = (void*)(this_obj & (~1));
33399 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33400 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33401 Payee_free(this_obj_conv);
33404 int8_tArray __attribute__((visibility("default"))) TS_Payee_get_pubkey(uint32_t this_ptr) {
33405 LDKPayee this_ptr_conv;
33406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33407 this_ptr_conv.is_owned = false;
33408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33409 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
33410 memcpy((uint8_t*)(ret_arr + 4), Payee_get_pubkey(&this_ptr_conv).compressed_form, 33);
33414 void __attribute__((visibility("default"))) TS_Payee_set_pubkey(uint32_t this_ptr, int8_tArray val) {
33415 LDKPayee this_ptr_conv;
33416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33417 this_ptr_conv.is_owned = false;
33418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33419 LDKPublicKey val_ref;
33420 CHECK(*((uint32_t*)val) == 33);
33421 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
33422 Payee_set_pubkey(&this_ptr_conv, val_ref);
33425 uint32_t __attribute__((visibility("default"))) TS_Payee_get_features(uint32_t this_ptr) {
33426 LDKPayee this_ptr_conv;
33427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33428 this_ptr_conv.is_owned = false;
33429 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33430 LDKInvoiceFeatures ret_var = Payee_get_features(&this_ptr_conv);
33431 uint64_t ret_ref = 0;
33432 if ((uint64_t)ret_var.inner > 4096) {
33433 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33434 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33435 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33436 ret_ref = (uint64_t)ret_var.inner;
33437 if (ret_var.is_owned) {
33444 void __attribute__((visibility("default"))) TS_Payee_set_features(uint32_t this_ptr, uint32_t val) {
33445 LDKPayee this_ptr_conv;
33446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33447 this_ptr_conv.is_owned = false;
33448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33449 LDKInvoiceFeatures val_conv;
33450 val_conv.inner = (void*)(val & (~1));
33451 val_conv.is_owned = (val & 1) || (val == 0);
33452 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33453 val_conv = InvoiceFeatures_clone(&val_conv);
33454 Payee_set_features(&this_ptr_conv, val_conv);
33457 uint32_tArray __attribute__((visibility("default"))) TS_Payee_get_route_hints(uint32_t this_ptr) {
33458 LDKPayee this_ptr_conv;
33459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33460 this_ptr_conv.is_owned = false;
33461 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33462 LDKCVec_RouteHintZ ret_var = Payee_get_route_hints(&this_ptr_conv);
33463 uint32_tArray ret_arr = NULL;
33464 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
33465 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
33466 for (size_t l = 0; l < ret_var.datalen; l++) {
33467 LDKRouteHint ret_conv_11_var = ret_var.data[l];
33468 uint64_t ret_conv_11_ref = 0;
33469 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33470 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33471 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
33472 ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
33473 if (ret_conv_11_var.is_owned) {
33474 ret_conv_11_ref |= 1;
33476 ret_arr_ptr[l] = ret_conv_11_ref;
33479 FREE(ret_var.data);
33483 void __attribute__((visibility("default"))) TS_Payee_set_route_hints(uint32_t this_ptr, uint32_tArray val) {
33484 LDKPayee this_ptr_conv;
33485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33486 this_ptr_conv.is_owned = false;
33487 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33488 LDKCVec_RouteHintZ val_constr;
33489 val_constr.datalen = *((uint32_t*)val);
33490 if (val_constr.datalen > 0)
33491 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
33493 val_constr.data = NULL;
33494 uint32_t* val_vals = (uint32_t*)(val + 4);
33495 for (size_t l = 0; l < val_constr.datalen; l++) {
33496 uint32_t val_conv_11 = val_vals[l];
33497 LDKRouteHint val_conv_11_conv;
33498 val_conv_11_conv.inner = (void*)(val_conv_11 & (~1));
33499 val_conv_11_conv.is_owned = (val_conv_11 & 1) || (val_conv_11 == 0);
33500 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
33501 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
33502 val_constr.data[l] = val_conv_11_conv;
33504 Payee_set_route_hints(&this_ptr_conv, val_constr);
33507 uint32_t __attribute__((visibility("default"))) TS_Payee_get_expiry_time(uint32_t this_ptr) {
33508 LDKPayee this_ptr_conv;
33509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33510 this_ptr_conv.is_owned = false;
33511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33512 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
33513 *ret_copy = Payee_get_expiry_time(&this_ptr_conv);
33514 uint64_t ret_ref = (uint64_t)ret_copy;
33518 void __attribute__((visibility("default"))) TS_Payee_set_expiry_time(uint32_t this_ptr, uint32_t val) {
33519 LDKPayee this_ptr_conv;
33520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33521 this_ptr_conv.is_owned = false;
33522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33523 void* val_ptr = (void*)(((uint64_t)val) & ~1);
33524 CHECK_ACCESS(val_ptr);
33525 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
33526 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
33527 Payee_set_expiry_time(&this_ptr_conv, val_conv);
33530 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) {
33531 LDKPublicKey pubkey_arg_ref;
33532 CHECK(*((uint32_t*)pubkey_arg) == 33);
33533 memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33);
33534 LDKInvoiceFeatures features_arg_conv;
33535 features_arg_conv.inner = (void*)(features_arg & (~1));
33536 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
33537 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
33538 features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
33539 LDKCVec_RouteHintZ route_hints_arg_constr;
33540 route_hints_arg_constr.datalen = *((uint32_t*)route_hints_arg);
33541 if (route_hints_arg_constr.datalen > 0)
33542 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
33544 route_hints_arg_constr.data = NULL;
33545 uint32_t* route_hints_arg_vals = (uint32_t*)(route_hints_arg + 4);
33546 for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
33547 uint32_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
33548 LDKRouteHint route_hints_arg_conv_11_conv;
33549 route_hints_arg_conv_11_conv.inner = (void*)(route_hints_arg_conv_11 & (~1));
33550 route_hints_arg_conv_11_conv.is_owned = (route_hints_arg_conv_11 & 1) || (route_hints_arg_conv_11 == 0);
33551 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
33552 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
33553 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
33555 void* expiry_time_arg_ptr = (void*)(((uint64_t)expiry_time_arg) & ~1);
33556 CHECK_ACCESS(expiry_time_arg_ptr);
33557 LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
33558 expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)expiry_time_arg) & ~1));
33559 LDKPayee ret_var = Payee_new(pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, expiry_time_arg_conv);
33560 uint64_t ret_ref = 0;
33561 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33562 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33563 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33564 ret_ref = (uint64_t)ret_var.inner;
33565 if (ret_var.is_owned) {
33571 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
33572 LDKPayee ret_var = Payee_clone(arg);
33573 uint64_t ret_ref = 0;
33574 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33575 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33576 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33577 ret_ref = (uint64_t)ret_var.inner;
33578 if (ret_var.is_owned) {
33583 int64_t __attribute__((visibility("default"))) TS_Payee_clone_ptr(uint32_t arg) {
33585 arg_conv.inner = (void*)(arg & (~1));
33586 arg_conv.is_owned = false;
33587 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33588 int64_t ret_val = Payee_clone_ptr(&arg_conv);
33592 uint32_t __attribute__((visibility("default"))) TS_Payee_clone(uint32_t orig) {
33593 LDKPayee orig_conv;
33594 orig_conv.inner = (void*)(orig & (~1));
33595 orig_conv.is_owned = false;
33596 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33597 LDKPayee ret_var = Payee_clone(&orig_conv);
33598 uint64_t ret_ref = 0;
33599 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33600 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33601 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33602 ret_ref = (uint64_t)ret_var.inner;
33603 if (ret_var.is_owned) {
33609 int64_t __attribute__((visibility("default"))) TS_Payee_hash(uint32_t o) {
33611 o_conv.inner = (void*)(o & (~1));
33612 o_conv.is_owned = false;
33613 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33614 int64_t ret_val = Payee_hash(&o_conv);
33618 jboolean __attribute__((visibility("default"))) TS_Payee_eq(uint32_t a, uint32_t b) {
33620 a_conv.inner = (void*)(a & (~1));
33621 a_conv.is_owned = false;
33622 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33624 b_conv.inner = (void*)(b & (~1));
33625 b_conv.is_owned = false;
33626 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33627 jboolean ret_val = Payee_eq(&a_conv, &b_conv);
33631 int8_tArray __attribute__((visibility("default"))) TS_Payee_write(uint32_t obj) {
33633 obj_conv.inner = (void*)(obj & (~1));
33634 obj_conv.is_owned = false;
33635 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33636 LDKCVec_u8Z ret_var = Payee_write(&obj_conv);
33637 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
33638 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
33639 CVec_u8Z_free(ret_var);
33643 uint32_t __attribute__((visibility("default"))) TS_Payee_read(int8_tArray ser) {
33644 LDKu8slice ser_ref;
33645 ser_ref.datalen = *((uint32_t*)ser);
33646 ser_ref.data = (int8_t*)(ser + 4);
33647 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
33648 *ret_conv = Payee_read(ser_ref);
33649 return (uint64_t)ret_conv;
33652 uint32_t __attribute__((visibility("default"))) TS_Payee_from_node_id(int8_tArray pubkey) {
33653 LDKPublicKey pubkey_ref;
33654 CHECK(*((uint32_t*)pubkey) == 33);
33655 memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33);
33656 LDKPayee ret_var = Payee_from_node_id(pubkey_ref);
33657 uint64_t ret_ref = 0;
33658 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33659 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33660 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33661 ret_ref = (uint64_t)ret_var.inner;
33662 if (ret_var.is_owned) {
33668 uint32_t __attribute__((visibility("default"))) TS_Payee_for_keysend(int8_tArray pubkey) {
33669 LDKPublicKey pubkey_ref;
33670 CHECK(*((uint32_t*)pubkey) == 33);
33671 memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33);
33672 LDKPayee ret_var = Payee_for_keysend(pubkey_ref);
33673 uint64_t ret_ref = 0;
33674 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33675 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33676 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33677 ret_ref = (uint64_t)ret_var.inner;
33678 if (ret_var.is_owned) {
33684 void __attribute__((visibility("default"))) TS_RouteHint_free(uint32_t this_obj) {
33685 LDKRouteHint this_obj_conv;
33686 this_obj_conv.inner = (void*)(this_obj & (~1));
33687 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33688 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33689 RouteHint_free(this_obj_conv);
33692 uint32_tArray __attribute__((visibility("default"))) TS_RouteHint_get_a(uint32_t this_ptr) {
33693 LDKRouteHint this_ptr_conv;
33694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33695 this_ptr_conv.is_owned = false;
33696 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33697 LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
33698 uint32_tArray ret_arr = NULL;
33699 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
33700 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
33701 for (size_t o = 0; o < ret_var.datalen; o++) {
33702 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
33703 uint64_t ret_conv_14_ref = 0;
33704 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33705 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33706 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
33707 ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
33708 if (ret_conv_14_var.is_owned) {
33709 ret_conv_14_ref |= 1;
33711 ret_arr_ptr[o] = ret_conv_14_ref;
33714 FREE(ret_var.data);
33718 void __attribute__((visibility("default"))) TS_RouteHint_set_a(uint32_t this_ptr, uint32_tArray val) {
33719 LDKRouteHint this_ptr_conv;
33720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33721 this_ptr_conv.is_owned = false;
33722 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33723 LDKCVec_RouteHintHopZ val_constr;
33724 val_constr.datalen = *((uint32_t*)val);
33725 if (val_constr.datalen > 0)
33726 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
33728 val_constr.data = NULL;
33729 uint32_t* val_vals = (uint32_t*)(val + 4);
33730 for (size_t o = 0; o < val_constr.datalen; o++) {
33731 uint32_t val_conv_14 = val_vals[o];
33732 LDKRouteHintHop val_conv_14_conv;
33733 val_conv_14_conv.inner = (void*)(val_conv_14 & (~1));
33734 val_conv_14_conv.is_owned = (val_conv_14 & 1) || (val_conv_14 == 0);
33735 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
33736 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
33737 val_constr.data[o] = val_conv_14_conv;
33739 RouteHint_set_a(&this_ptr_conv, val_constr);
33742 uint32_t __attribute__((visibility("default"))) TS_RouteHint_new(uint32_tArray a_arg) {
33743 LDKCVec_RouteHintHopZ a_arg_constr;
33744 a_arg_constr.datalen = *((uint32_t*)a_arg);
33745 if (a_arg_constr.datalen > 0)
33746 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
33748 a_arg_constr.data = NULL;
33749 uint32_t* a_arg_vals = (uint32_t*)(a_arg + 4);
33750 for (size_t o = 0; o < a_arg_constr.datalen; o++) {
33751 uint32_t a_arg_conv_14 = a_arg_vals[o];
33752 LDKRouteHintHop a_arg_conv_14_conv;
33753 a_arg_conv_14_conv.inner = (void*)(a_arg_conv_14 & (~1));
33754 a_arg_conv_14_conv.is_owned = (a_arg_conv_14 & 1) || (a_arg_conv_14 == 0);
33755 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
33756 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
33757 a_arg_constr.data[o] = a_arg_conv_14_conv;
33759 LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
33760 uint64_t ret_ref = 0;
33761 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33762 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33763 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33764 ret_ref = (uint64_t)ret_var.inner;
33765 if (ret_var.is_owned) {
33771 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
33772 LDKRouteHint ret_var = RouteHint_clone(arg);
33773 uint64_t ret_ref = 0;
33774 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33775 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33776 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33777 ret_ref = (uint64_t)ret_var.inner;
33778 if (ret_var.is_owned) {
33783 int64_t __attribute__((visibility("default"))) TS_RouteHint_clone_ptr(uint32_t arg) {
33784 LDKRouteHint arg_conv;
33785 arg_conv.inner = (void*)(arg & (~1));
33786 arg_conv.is_owned = false;
33787 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33788 int64_t ret_val = RouteHint_clone_ptr(&arg_conv);
33792 uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) {
33793 LDKRouteHint orig_conv;
33794 orig_conv.inner = (void*)(orig & (~1));
33795 orig_conv.is_owned = false;
33796 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33797 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
33798 uint64_t ret_ref = 0;
33799 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33800 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33801 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33802 ret_ref = (uint64_t)ret_var.inner;
33803 if (ret_var.is_owned) {
33809 int64_t __attribute__((visibility("default"))) TS_RouteHint_hash(uint32_t o) {
33810 LDKRouteHint o_conv;
33811 o_conv.inner = (void*)(o & (~1));
33812 o_conv.is_owned = false;
33813 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33814 int64_t ret_val = RouteHint_hash(&o_conv);
33818 jboolean __attribute__((visibility("default"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
33819 LDKRouteHint a_conv;
33820 a_conv.inner = (void*)(a & (~1));
33821 a_conv.is_owned = false;
33822 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33823 LDKRouteHint b_conv;
33824 b_conv.inner = (void*)(b & (~1));
33825 b_conv.is_owned = false;
33826 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33827 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
33831 int8_tArray __attribute__((visibility("default"))) TS_RouteHint_write(uint32_t obj) {
33832 LDKRouteHint obj_conv;
33833 obj_conv.inner = (void*)(obj & (~1));
33834 obj_conv.is_owned = false;
33835 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33836 LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
33837 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
33838 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
33839 CVec_u8Z_free(ret_var);
33843 uint32_t __attribute__((visibility("default"))) TS_RouteHint_read(int8_tArray ser) {
33844 LDKu8slice ser_ref;
33845 ser_ref.datalen = *((uint32_t*)ser);
33846 ser_ref.data = (int8_t*)(ser + 4);
33847 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
33848 *ret_conv = RouteHint_read(ser_ref);
33849 return (uint64_t)ret_conv;
33852 void __attribute__((visibility("default"))) TS_RouteHintHop_free(uint32_t this_obj) {
33853 LDKRouteHintHop this_obj_conv;
33854 this_obj_conv.inner = (void*)(this_obj & (~1));
33855 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33856 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33857 RouteHintHop_free(this_obj_conv);
33860 int8_tArray __attribute__((visibility("default"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) {
33861 LDKRouteHintHop this_ptr_conv;
33862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33863 this_ptr_conv.is_owned = false;
33864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33865 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
33866 memcpy((uint8_t*)(ret_arr + 4), RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
33870 void __attribute__((visibility("default"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
33871 LDKRouteHintHop this_ptr_conv;
33872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33873 this_ptr_conv.is_owned = false;
33874 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33875 LDKPublicKey val_ref;
33876 CHECK(*((uint32_t*)val) == 33);
33877 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
33878 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
33881 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) {
33882 LDKRouteHintHop this_ptr_conv;
33883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33884 this_ptr_conv.is_owned = false;
33885 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33886 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
33890 void __attribute__((visibility("default"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
33891 LDKRouteHintHop this_ptr_conv;
33892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33893 this_ptr_conv.is_owned = false;
33894 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33895 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
33898 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) {
33899 LDKRouteHintHop this_ptr_conv;
33900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33901 this_ptr_conv.is_owned = false;
33902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33903 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
33904 uint64_t ret_ref = 0;
33905 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33906 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33907 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33908 ret_ref = (uint64_t)ret_var.inner;
33909 if (ret_var.is_owned) {
33915 void __attribute__((visibility("default"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) {
33916 LDKRouteHintHop this_ptr_conv;
33917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33918 this_ptr_conv.is_owned = false;
33919 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33920 LDKRoutingFees val_conv;
33921 val_conv.inner = (void*)(val & (~1));
33922 val_conv.is_owned = (val & 1) || (val == 0);
33923 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33924 val_conv = RoutingFees_clone(&val_conv);
33925 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
33928 int16_t __attribute__((visibility("default"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) {
33929 LDKRouteHintHop this_ptr_conv;
33930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33931 this_ptr_conv.is_owned = false;
33932 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33933 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
33937 void __attribute__((visibility("default"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
33938 LDKRouteHintHop this_ptr_conv;
33939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33940 this_ptr_conv.is_owned = false;
33941 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33942 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
33945 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) {
33946 LDKRouteHintHop this_ptr_conv;
33947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33948 this_ptr_conv.is_owned = false;
33949 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33950 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
33951 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
33952 uint64_t ret_ref = (uint64_t)ret_copy;
33956 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
33957 LDKRouteHintHop this_ptr_conv;
33958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33959 this_ptr_conv.is_owned = false;
33960 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33961 void* val_ptr = (void*)(((uint64_t)val) & ~1);
33962 CHECK_ACCESS(val_ptr);
33963 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
33964 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
33965 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
33968 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) {
33969 LDKRouteHintHop this_ptr_conv;
33970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33971 this_ptr_conv.is_owned = false;
33972 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33973 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
33974 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
33975 uint64_t ret_ref = (uint64_t)ret_copy;
33979 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
33980 LDKRouteHintHop this_ptr_conv;
33981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33982 this_ptr_conv.is_owned = false;
33983 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33984 void* val_ptr = (void*)(((uint64_t)val) & ~1);
33985 CHECK_ACCESS(val_ptr);
33986 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
33987 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
33988 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
33991 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) {
33992 LDKPublicKey src_node_id_arg_ref;
33993 CHECK(*((uint32_t*)src_node_id_arg) == 33);
33994 memcpy(src_node_id_arg_ref.compressed_form, (uint8_t*)(src_node_id_arg + 4), 33);
33995 LDKRoutingFees fees_arg_conv;
33996 fees_arg_conv.inner = (void*)(fees_arg & (~1));
33997 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
33998 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
33999 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
34000 void* htlc_minimum_msat_arg_ptr = (void*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
34001 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
34002 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
34003 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1));
34004 void* htlc_maximum_msat_arg_ptr = (void*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
34005 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
34006 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
34007 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
34008 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);
34009 uint64_t ret_ref = 0;
34010 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34011 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34012 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34013 ret_ref = (uint64_t)ret_var.inner;
34014 if (ret_var.is_owned) {
34020 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
34021 LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
34022 uint64_t ret_ref = 0;
34023 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34024 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34025 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34026 ret_ref = (uint64_t)ret_var.inner;
34027 if (ret_var.is_owned) {
34032 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_clone_ptr(uint32_t arg) {
34033 LDKRouteHintHop arg_conv;
34034 arg_conv.inner = (void*)(arg & (~1));
34035 arg_conv.is_owned = false;
34036 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34037 int64_t ret_val = RouteHintHop_clone_ptr(&arg_conv);
34041 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_clone(uint32_t orig) {
34042 LDKRouteHintHop orig_conv;
34043 orig_conv.inner = (void*)(orig & (~1));
34044 orig_conv.is_owned = false;
34045 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34046 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
34047 uint64_t ret_ref = 0;
34048 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34049 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34050 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34051 ret_ref = (uint64_t)ret_var.inner;
34052 if (ret_var.is_owned) {
34058 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_hash(uint32_t o) {
34059 LDKRouteHintHop o_conv;
34060 o_conv.inner = (void*)(o & (~1));
34061 o_conv.is_owned = false;
34062 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34063 int64_t ret_val = RouteHintHop_hash(&o_conv);
34067 jboolean __attribute__((visibility("default"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
34068 LDKRouteHintHop a_conv;
34069 a_conv.inner = (void*)(a & (~1));
34070 a_conv.is_owned = false;
34071 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34072 LDKRouteHintHop b_conv;
34073 b_conv.inner = (void*)(b & (~1));
34074 b_conv.is_owned = false;
34075 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34076 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
34080 int8_tArray __attribute__((visibility("default"))) TS_RouteHintHop_write(uint32_t obj) {
34081 LDKRouteHintHop obj_conv;
34082 obj_conv.inner = (void*)(obj & (~1));
34083 obj_conv.is_owned = false;
34084 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34085 LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
34086 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
34087 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
34088 CVec_u8Z_free(ret_var);
34092 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_read(int8_tArray ser) {
34093 LDKu8slice ser_ref;
34094 ser_ref.datalen = *((uint32_t*)ser);
34095 ser_ref.data = (int8_t*)(ser + 4);
34096 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
34097 *ret_conv = RouteHintHop_read(ser_ref);
34098 return (uint64_t)ret_conv;
34101 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) {
34102 LDKPublicKey our_node_pubkey_ref;
34103 CHECK(*((uint32_t*)our_node_pubkey) == 33);
34104 memcpy(our_node_pubkey_ref.compressed_form, (uint8_t*)(our_node_pubkey + 4), 33);
34105 LDKRouteParameters params_conv;
34106 params_conv.inner = (void*)(params & (~1));
34107 params_conv.is_owned = false;
34108 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
34109 LDKNetworkGraph network_conv;
34110 network_conv.inner = (void*)(network & (~1));
34111 network_conv.is_owned = false;
34112 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_conv);
34113 LDKCVec_ChannelDetailsZ first_hops_constr;
34114 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
34115 if (first_hops != 0) {
34116 first_hops_constr.datalen = *((uint32_t*)first_hops);
34117 if (first_hops_constr.datalen > 0)
34118 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
34120 first_hops_constr.data = NULL;
34121 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
34122 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
34123 uint32_t first_hops_conv_16 = first_hops_vals[q];
34124 LDKChannelDetails first_hops_conv_16_conv;
34125 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
34126 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
34127 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
34128 first_hops_constr.data[q] = first_hops_conv_16_conv;
34130 first_hops_ptr = &first_hops_constr;
34132 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
34133 CHECK_ACCESS(logger_ptr);
34134 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
34135 void* scorer_ptr = (void*)(((uint64_t)scorer) & ~1);
34136 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
34137 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
34138 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
34139 *ret_conv = find_route(our_node_pubkey_ref, ¶ms_conv, &network_conv, first_hops_ptr, logger_conv, scorer_conv);
34140 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
34141 return (uint64_t)ret_conv;
34144 void __attribute__((visibility("default"))) TS_Scorer_free(uint32_t this_obj) {
34145 LDKScorer this_obj_conv;
34146 this_obj_conv.inner = (void*)(this_obj & (~1));
34147 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34149 Scorer_free(this_obj_conv);
34152 void __attribute__((visibility("default"))) TS_ScoringParameters_free(uint32_t this_obj) {
34153 LDKScoringParameters this_obj_conv;
34154 this_obj_conv.inner = (void*)(this_obj & (~1));
34155 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34157 ScoringParameters_free(this_obj_conv);
34160 int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_base_penalty_msat(uint32_t this_ptr) {
34161 LDKScoringParameters this_ptr_conv;
34162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34163 this_ptr_conv.is_owned = false;
34164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34165 int64_t ret_val = ScoringParameters_get_base_penalty_msat(&this_ptr_conv);
34169 void __attribute__((visibility("default"))) TS_ScoringParameters_set_base_penalty_msat(uint32_t this_ptr, int64_t val) {
34170 LDKScoringParameters this_ptr_conv;
34171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34172 this_ptr_conv.is_owned = false;
34173 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34174 ScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
34177 int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_failure_penalty_msat(uint32_t this_ptr) {
34178 LDKScoringParameters this_ptr_conv;
34179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34180 this_ptr_conv.is_owned = false;
34181 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34182 int64_t ret_val = ScoringParameters_get_failure_penalty_msat(&this_ptr_conv);
34186 void __attribute__((visibility("default"))) TS_ScoringParameters_set_failure_penalty_msat(uint32_t this_ptr, int64_t val) {
34187 LDKScoringParameters this_ptr_conv;
34188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34189 this_ptr_conv.is_owned = false;
34190 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34191 ScoringParameters_set_failure_penalty_msat(&this_ptr_conv, val);
34194 int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_failure_penalty_half_life(uint32_t this_ptr) {
34195 LDKScoringParameters this_ptr_conv;
34196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34197 this_ptr_conv.is_owned = false;
34198 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34199 int64_t ret_val = ScoringParameters_get_failure_penalty_half_life(&this_ptr_conv);
34203 void __attribute__((visibility("default"))) TS_ScoringParameters_set_failure_penalty_half_life(uint32_t this_ptr, int64_t val) {
34204 LDKScoringParameters this_ptr_conv;
34205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34206 this_ptr_conv.is_owned = false;
34207 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34208 ScoringParameters_set_failure_penalty_half_life(&this_ptr_conv, val);
34211 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) {
34212 LDKScoringParameters ret_var = ScoringParameters_new(base_penalty_msat_arg, failure_penalty_msat_arg, failure_penalty_half_life_arg);
34213 uint64_t ret_ref = 0;
34214 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34215 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34216 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34217 ret_ref = (uint64_t)ret_var.inner;
34218 if (ret_var.is_owned) {
34224 int8_tArray __attribute__((visibility("default"))) TS_ScoringParameters_write(uint32_t obj) {
34225 LDKScoringParameters obj_conv;
34226 obj_conv.inner = (void*)(obj & (~1));
34227 obj_conv.is_owned = false;
34228 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34229 LDKCVec_u8Z ret_var = ScoringParameters_write(&obj_conv);
34230 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
34231 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
34232 CVec_u8Z_free(ret_var);
34236 uint32_t __attribute__((visibility("default"))) TS_ScoringParameters_read(int8_tArray ser) {
34237 LDKu8slice ser_ref;
34238 ser_ref.datalen = *((uint32_t*)ser);
34239 ser_ref.data = (int8_t*)(ser + 4);
34240 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
34241 *ret_conv = ScoringParameters_read(ser_ref);
34242 return (uint64_t)ret_conv;
34245 uint32_t __attribute__((visibility("default"))) TS_Scorer_new(uint32_t params) {
34246 LDKScoringParameters params_conv;
34247 params_conv.inner = (void*)(params & (~1));
34248 params_conv.is_owned = (params & 1) || (params == 0);
34249 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
34250 // Warning: we need a move here but no clone is available for LDKScoringParameters
34251 LDKScorer ret_var = Scorer_new(params_conv);
34252 uint64_t ret_ref = 0;
34253 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34254 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34255 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34256 ret_ref = (uint64_t)ret_var.inner;
34257 if (ret_var.is_owned) {
34263 uint32_t __attribute__((visibility("default"))) TS_Scorer_default() {
34264 LDKScorer ret_var = Scorer_default();
34265 uint64_t ret_ref = 0;
34266 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34267 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34268 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34269 ret_ref = (uint64_t)ret_var.inner;
34270 if (ret_var.is_owned) {
34276 uint32_t __attribute__((visibility("default"))) TS_ScoringParameters_default() {
34277 LDKScoringParameters ret_var = ScoringParameters_default();
34278 uint64_t ret_ref = 0;
34279 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34280 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34281 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34282 ret_ref = (uint64_t)ret_var.inner;
34283 if (ret_var.is_owned) {
34289 uint32_t __attribute__((visibility("default"))) TS_Scorer_as_Score(uint32_t this_arg) {
34290 LDKScorer this_arg_conv;
34291 this_arg_conv.inner = (void*)(this_arg & (~1));
34292 this_arg_conv.is_owned = false;
34293 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34294 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
34295 *ret_ret = Scorer_as_Score(&this_arg_conv);
34296 return (uint64_t)ret_ret;
34299 int8_tArray __attribute__((visibility("default"))) TS_Scorer_write(uint32_t obj) {
34300 LDKScorer obj_conv;
34301 obj_conv.inner = (void*)(obj & (~1));
34302 obj_conv.is_owned = false;
34303 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34304 LDKCVec_u8Z ret_var = Scorer_write(&obj_conv);
34305 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
34306 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
34307 CVec_u8Z_free(ret_var);
34311 uint32_t __attribute__((visibility("default"))) TS_Scorer_read(int8_tArray ser) {
34312 LDKu8slice ser_ref;
34313 ser_ref.datalen = *((uint32_t*)ser);
34314 ser_ref.data = (int8_t*)(ser + 4);
34315 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
34316 *ret_conv = Scorer_read(ser_ref);
34317 return (uint64_t)ret_conv;
34320 void __attribute__((visibility("default"))) TS_FilesystemPersister_free(uint32_t this_obj) {
34321 LDKFilesystemPersister this_obj_conv;
34322 this_obj_conv.inner = (void*)(this_obj & (~1));
34323 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34325 FilesystemPersister_free(this_obj_conv);
34328 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_new(jstring path_to_channel_data) {
34329 LDKStr path_to_channel_data_conv = str_ref_to_owned_c(path_to_channel_data);
34330 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
34331 uint64_t ret_ref = 0;
34332 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34333 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34334 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34335 ret_ref = (uint64_t)ret_var.inner;
34336 if (ret_var.is_owned) {
34342 jstring __attribute__((visibility("default"))) TS_FilesystemPersister_get_data_dir(uint32_t this_arg) {
34343 LDKFilesystemPersister this_arg_conv;
34344 this_arg_conv.inner = (void*)(this_arg & (~1));
34345 this_arg_conv.is_owned = false;
34346 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34347 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
34348 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
34353 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_persist_manager(jstring data_dir, uint32_t manager) {
34354 LDKStr data_dir_conv = str_ref_to_owned_c(data_dir);
34355 LDKChannelManager manager_conv;
34356 manager_conv.inner = (void*)(manager & (~1));
34357 manager_conv.is_owned = false;
34358 CHECK_INNER_FIELD_ACCESS_OR_NULL(manager_conv);
34359 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
34360 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
34361 return (uint64_t)ret_conv;
34364 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_read_channelmonitors(uint32_t this_arg, uint32_t keys_manager) {
34365 LDKFilesystemPersister this_arg_conv;
34366 this_arg_conv.inner = (void*)(this_arg & (~1));
34367 this_arg_conv.is_owned = false;
34368 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34369 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
34370 CHECK_ACCESS(keys_manager_ptr);
34371 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
34372 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
34373 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
34374 return (uint64_t)ret_conv;
34377 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_as_Persist(uint32_t this_arg) {
34378 LDKFilesystemPersister this_arg_conv;
34379 this_arg_conv.inner = (void*)(this_arg & (~1));
34380 this_arg_conv.is_owned = false;
34381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34382 LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
34383 *ret_ret = FilesystemPersister_as_Persist(&this_arg_conv);
34384 return (uint64_t)ret_ret;
34387 void __attribute__((visibility("default"))) TS_BackgroundProcessor_free(uint32_t this_obj) {
34388 LDKBackgroundProcessor this_obj_conv;
34389 this_obj_conv.inner = (void*)(this_obj & (~1));
34390 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34391 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34392 BackgroundProcessor_free(this_obj_conv);
34395 void __attribute__((visibility("default"))) TS_ChannelManagerPersister_free(uint32_t this_ptr) {
34396 if ((this_ptr & 1) != 0) return;
34397 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
34398 CHECK_ACCESS(this_ptr_ptr);
34399 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(this_ptr_ptr);
34400 FREE((void*)this_ptr);
34401 ChannelManagerPersister_free(this_ptr_conv);
34404 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) {
34405 void* persister_ptr = (void*)(((uint64_t)persister) & ~1);
34406 CHECK_ACCESS(persister_ptr);
34407 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(persister_ptr);
34408 void* event_handler_ptr = (void*)(((uint64_t)event_handler) & ~1);
34409 CHECK_ACCESS(event_handler_ptr);
34410 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
34411 LDKChainMonitor chain_monitor_conv;
34412 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
34413 chain_monitor_conv.is_owned = false;
34414 CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
34415 LDKChannelManager channel_manager_conv;
34416 channel_manager_conv.inner = (void*)(channel_manager & (~1));
34417 channel_manager_conv.is_owned = false;
34418 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
34419 LDKNetGraphMsgHandler net_graph_msg_handler_conv;
34420 net_graph_msg_handler_conv.inner = (void*)(net_graph_msg_handler & (~1));
34421 net_graph_msg_handler_conv.is_owned = (net_graph_msg_handler & 1) || (net_graph_msg_handler == 0);
34422 CHECK_INNER_FIELD_ACCESS_OR_NULL(net_graph_msg_handler_conv);
34423 LDKPeerManager peer_manager_conv;
34424 peer_manager_conv.inner = (void*)(peer_manager & (~1));
34425 peer_manager_conv.is_owned = false;
34426 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
34427 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
34428 CHECK_ACCESS(logger_ptr);
34429 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
34430 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);
34431 uint64_t ret_ref = 0;
34432 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34433 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34434 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34435 ret_ref = (uint64_t)ret_var.inner;
34436 if (ret_var.is_owned) {
34442 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_join(uint32_t this_arg) {
34443 LDKBackgroundProcessor this_arg_conv;
34444 this_arg_conv.inner = (void*)(this_arg & (~1));
34445 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
34446 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34447 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
34448 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
34449 *ret_conv = BackgroundProcessor_join(this_arg_conv);
34450 return (uint64_t)ret_conv;
34453 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_stop(uint32_t this_arg) {
34454 LDKBackgroundProcessor this_arg_conv;
34455 this_arg_conv.inner = (void*)(this_arg & (~1));
34456 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
34457 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34458 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
34459 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
34460 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
34461 return (uint64_t)ret_conv;
34464 void __attribute__((visibility("default"))) TS_check_platform() {
34468 void __attribute__((visibility("default"))) TS_Invoice_free(uint32_t this_obj) {
34469 LDKInvoice this_obj_conv;
34470 this_obj_conv.inner = (void*)(this_obj & (~1));
34471 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34473 Invoice_free(this_obj_conv);
34476 jboolean __attribute__((visibility("default"))) TS_Invoice_eq(uint32_t a, uint32_t b) {
34478 a_conv.inner = (void*)(a & (~1));
34479 a_conv.is_owned = false;
34480 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34482 b_conv.inner = (void*)(b & (~1));
34483 b_conv.is_owned = false;
34484 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34485 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
34489 static inline uint64_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
34490 LDKInvoice ret_var = Invoice_clone(arg);
34491 uint64_t ret_ref = 0;
34492 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34493 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34494 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34495 ret_ref = (uint64_t)ret_var.inner;
34496 if (ret_var.is_owned) {
34501 int64_t __attribute__((visibility("default"))) TS_Invoice_clone_ptr(uint32_t arg) {
34502 LDKInvoice arg_conv;
34503 arg_conv.inner = (void*)(arg & (~1));
34504 arg_conv.is_owned = false;
34505 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34506 int64_t ret_val = Invoice_clone_ptr(&arg_conv);
34510 uint32_t __attribute__((visibility("default"))) TS_Invoice_clone(uint32_t orig) {
34511 LDKInvoice orig_conv;
34512 orig_conv.inner = (void*)(orig & (~1));
34513 orig_conv.is_owned = false;
34514 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34515 LDKInvoice ret_var = Invoice_clone(&orig_conv);
34516 uint64_t ret_ref = 0;
34517 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34518 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34519 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34520 ret_ref = (uint64_t)ret_var.inner;
34521 if (ret_var.is_owned) {
34527 void __attribute__((visibility("default"))) TS_SignedRawInvoice_free(uint32_t this_obj) {
34528 LDKSignedRawInvoice this_obj_conv;
34529 this_obj_conv.inner = (void*)(this_obj & (~1));
34530 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34531 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34532 SignedRawInvoice_free(this_obj_conv);
34535 jboolean __attribute__((visibility("default"))) TS_SignedRawInvoice_eq(uint32_t a, uint32_t b) {
34536 LDKSignedRawInvoice a_conv;
34537 a_conv.inner = (void*)(a & (~1));
34538 a_conv.is_owned = false;
34539 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34540 LDKSignedRawInvoice b_conv;
34541 b_conv.inner = (void*)(b & (~1));
34542 b_conv.is_owned = false;
34543 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34544 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
34548 static inline uint64_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
34549 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
34550 uint64_t ret_ref = 0;
34551 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34552 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34553 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34554 ret_ref = (uint64_t)ret_var.inner;
34555 if (ret_var.is_owned) {
34560 int64_t __attribute__((visibility("default"))) TS_SignedRawInvoice_clone_ptr(uint32_t arg) {
34561 LDKSignedRawInvoice arg_conv;
34562 arg_conv.inner = (void*)(arg & (~1));
34563 arg_conv.is_owned = false;
34564 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34565 int64_t ret_val = SignedRawInvoice_clone_ptr(&arg_conv);
34569 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_clone(uint32_t orig) {
34570 LDKSignedRawInvoice orig_conv;
34571 orig_conv.inner = (void*)(orig & (~1));
34572 orig_conv.is_owned = false;
34573 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34574 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
34575 uint64_t ret_ref = 0;
34576 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34577 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34578 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34579 ret_ref = (uint64_t)ret_var.inner;
34580 if (ret_var.is_owned) {
34586 void __attribute__((visibility("default"))) TS_RawInvoice_free(uint32_t this_obj) {
34587 LDKRawInvoice this_obj_conv;
34588 this_obj_conv.inner = (void*)(this_obj & (~1));
34589 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34590 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34591 RawInvoice_free(this_obj_conv);
34594 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_get_data(uint32_t this_ptr) {
34595 LDKRawInvoice this_ptr_conv;
34596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34597 this_ptr_conv.is_owned = false;
34598 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34599 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
34600 uint64_t ret_ref = 0;
34601 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34602 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34603 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34604 ret_ref = (uint64_t)ret_var.inner;
34605 if (ret_var.is_owned) {
34611 void __attribute__((visibility("default"))) TS_RawInvoice_set_data(uint32_t this_ptr, uint32_t val) {
34612 LDKRawInvoice this_ptr_conv;
34613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34614 this_ptr_conv.is_owned = false;
34615 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34616 LDKRawDataPart val_conv;
34617 val_conv.inner = (void*)(val & (~1));
34618 val_conv.is_owned = (val & 1) || (val == 0);
34619 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34620 val_conv = RawDataPart_clone(&val_conv);
34621 RawInvoice_set_data(&this_ptr_conv, val_conv);
34624 jboolean __attribute__((visibility("default"))) TS_RawInvoice_eq(uint32_t a, uint32_t b) {
34625 LDKRawInvoice a_conv;
34626 a_conv.inner = (void*)(a & (~1));
34627 a_conv.is_owned = false;
34628 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34629 LDKRawInvoice b_conv;
34630 b_conv.inner = (void*)(b & (~1));
34631 b_conv.is_owned = false;
34632 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34633 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
34637 static inline uint64_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
34638 LDKRawInvoice ret_var = RawInvoice_clone(arg);
34639 uint64_t ret_ref = 0;
34640 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34641 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34642 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34643 ret_ref = (uint64_t)ret_var.inner;
34644 if (ret_var.is_owned) {
34649 int64_t __attribute__((visibility("default"))) TS_RawInvoice_clone_ptr(uint32_t arg) {
34650 LDKRawInvoice arg_conv;
34651 arg_conv.inner = (void*)(arg & (~1));
34652 arg_conv.is_owned = false;
34653 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34654 int64_t ret_val = RawInvoice_clone_ptr(&arg_conv);
34658 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_clone(uint32_t orig) {
34659 LDKRawInvoice orig_conv;
34660 orig_conv.inner = (void*)(orig & (~1));
34661 orig_conv.is_owned = false;
34662 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34663 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
34664 uint64_t ret_ref = 0;
34665 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34666 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34667 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34668 ret_ref = (uint64_t)ret_var.inner;
34669 if (ret_var.is_owned) {
34675 void __attribute__((visibility("default"))) TS_RawDataPart_free(uint32_t this_obj) {
34676 LDKRawDataPart this_obj_conv;
34677 this_obj_conv.inner = (void*)(this_obj & (~1));
34678 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34679 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34680 RawDataPart_free(this_obj_conv);
34683 uint32_t __attribute__((visibility("default"))) TS_RawDataPart_get_timestamp(uint32_t this_ptr) {
34684 LDKRawDataPart this_ptr_conv;
34685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34686 this_ptr_conv.is_owned = false;
34687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34688 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
34689 uint64_t ret_ref = 0;
34690 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34691 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34692 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34693 ret_ref = (uint64_t)ret_var.inner;
34694 if (ret_var.is_owned) {
34700 void __attribute__((visibility("default"))) TS_RawDataPart_set_timestamp(uint32_t this_ptr, uint32_t val) {
34701 LDKRawDataPart this_ptr_conv;
34702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34703 this_ptr_conv.is_owned = false;
34704 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34705 LDKPositiveTimestamp val_conv;
34706 val_conv.inner = (void*)(val & (~1));
34707 val_conv.is_owned = (val & 1) || (val == 0);
34708 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34709 val_conv = PositiveTimestamp_clone(&val_conv);
34710 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
34713 jboolean __attribute__((visibility("default"))) TS_RawDataPart_eq(uint32_t a, uint32_t b) {
34714 LDKRawDataPart a_conv;
34715 a_conv.inner = (void*)(a & (~1));
34716 a_conv.is_owned = false;
34717 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34718 LDKRawDataPart b_conv;
34719 b_conv.inner = (void*)(b & (~1));
34720 b_conv.is_owned = false;
34721 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34722 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
34726 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
34727 LDKRawDataPart ret_var = RawDataPart_clone(arg);
34728 uint64_t ret_ref = 0;
34729 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34730 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34731 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34732 ret_ref = (uint64_t)ret_var.inner;
34733 if (ret_var.is_owned) {
34738 int64_t __attribute__((visibility("default"))) TS_RawDataPart_clone_ptr(uint32_t arg) {
34739 LDKRawDataPart arg_conv;
34740 arg_conv.inner = (void*)(arg & (~1));
34741 arg_conv.is_owned = false;
34742 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34743 int64_t ret_val = RawDataPart_clone_ptr(&arg_conv);
34747 uint32_t __attribute__((visibility("default"))) TS_RawDataPart_clone(uint32_t orig) {
34748 LDKRawDataPart orig_conv;
34749 orig_conv.inner = (void*)(orig & (~1));
34750 orig_conv.is_owned = false;
34751 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34752 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
34753 uint64_t ret_ref = 0;
34754 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34755 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34756 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34757 ret_ref = (uint64_t)ret_var.inner;
34758 if (ret_var.is_owned) {
34764 void __attribute__((visibility("default"))) TS_PositiveTimestamp_free(uint32_t this_obj) {
34765 LDKPositiveTimestamp this_obj_conv;
34766 this_obj_conv.inner = (void*)(this_obj & (~1));
34767 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34768 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34769 PositiveTimestamp_free(this_obj_conv);
34772 jboolean __attribute__((visibility("default"))) TS_PositiveTimestamp_eq(uint32_t a, uint32_t b) {
34773 LDKPositiveTimestamp a_conv;
34774 a_conv.inner = (void*)(a & (~1));
34775 a_conv.is_owned = false;
34776 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34777 LDKPositiveTimestamp b_conv;
34778 b_conv.inner = (void*)(b & (~1));
34779 b_conv.is_owned = false;
34780 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34781 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
34785 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
34786 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
34787 uint64_t ret_ref = 0;
34788 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34789 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34790 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34791 ret_ref = (uint64_t)ret_var.inner;
34792 if (ret_var.is_owned) {
34797 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_clone_ptr(uint32_t arg) {
34798 LDKPositiveTimestamp arg_conv;
34799 arg_conv.inner = (void*)(arg & (~1));
34800 arg_conv.is_owned = false;
34801 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34802 int64_t ret_val = PositiveTimestamp_clone_ptr(&arg_conv);
34806 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_clone(uint32_t orig) {
34807 LDKPositiveTimestamp orig_conv;
34808 orig_conv.inner = (void*)(orig & (~1));
34809 orig_conv.is_owned = false;
34810 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34811 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
34812 uint64_t ret_ref = 0;
34813 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34814 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34815 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34816 ret_ref = (uint64_t)ret_var.inner;
34817 if (ret_var.is_owned) {
34823 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_clone(uint32_t orig) {
34824 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
34825 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
34829 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_milli() {
34830 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
34834 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_micro() {
34835 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
34839 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_nano() {
34840 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
34844 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_pico() {
34845 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
34849 jboolean __attribute__((visibility("default"))) TS_SiPrefix_eq(uint32_t a, uint32_t b) {
34850 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
34851 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
34852 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
34856 int64_t __attribute__((visibility("default"))) TS_SiPrefix_multiplier(uint32_t this_arg) {
34857 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
34858 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
34862 uint32_t __attribute__((visibility("default"))) TS_Currency_clone(uint32_t orig) {
34863 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
34864 uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
34868 uint32_t __attribute__((visibility("default"))) TS_Currency_bitcoin() {
34869 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
34873 uint32_t __attribute__((visibility("default"))) TS_Currency_bitcoin_testnet() {
34874 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
34878 uint32_t __attribute__((visibility("default"))) TS_Currency_regtest() {
34879 uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
34883 uint32_t __attribute__((visibility("default"))) TS_Currency_simnet() {
34884 uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
34888 uint32_t __attribute__((visibility("default"))) TS_Currency_signet() {
34889 uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
34893 int64_t __attribute__((visibility("default"))) TS_Currency_hash(uint32_t o) {
34894 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
34895 int64_t ret_val = Currency_hash(o_conv);
34899 jboolean __attribute__((visibility("default"))) TS_Currency_eq(uint32_t a, uint32_t b) {
34900 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
34901 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
34902 jboolean ret_val = Currency_eq(a_conv, b_conv);
34906 void __attribute__((visibility("default"))) TS_Sha256_free(uint32_t this_obj) {
34907 LDKSha256 this_obj_conv;
34908 this_obj_conv.inner = (void*)(this_obj & (~1));
34909 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34911 Sha256_free(this_obj_conv);
34914 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
34915 LDKSha256 ret_var = Sha256_clone(arg);
34916 uint64_t ret_ref = 0;
34917 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34918 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34919 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34920 ret_ref = (uint64_t)ret_var.inner;
34921 if (ret_var.is_owned) {
34926 int64_t __attribute__((visibility("default"))) TS_Sha256_clone_ptr(uint32_t arg) {
34927 LDKSha256 arg_conv;
34928 arg_conv.inner = (void*)(arg & (~1));
34929 arg_conv.is_owned = false;
34930 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34931 int64_t ret_val = Sha256_clone_ptr(&arg_conv);
34935 uint32_t __attribute__((visibility("default"))) TS_Sha256_clone(uint32_t orig) {
34936 LDKSha256 orig_conv;
34937 orig_conv.inner = (void*)(orig & (~1));
34938 orig_conv.is_owned = false;
34939 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34940 LDKSha256 ret_var = Sha256_clone(&orig_conv);
34941 uint64_t ret_ref = 0;
34942 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34943 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34944 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34945 ret_ref = (uint64_t)ret_var.inner;
34946 if (ret_var.is_owned) {
34952 int64_t __attribute__((visibility("default"))) TS_Sha256_hash(uint32_t o) {
34954 o_conv.inner = (void*)(o & (~1));
34955 o_conv.is_owned = false;
34956 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34957 int64_t ret_val = Sha256_hash(&o_conv);
34961 jboolean __attribute__((visibility("default"))) TS_Sha256_eq(uint32_t a, uint32_t b) {
34963 a_conv.inner = (void*)(a & (~1));
34964 a_conv.is_owned = false;
34965 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34967 b_conv.inner = (void*)(b & (~1));
34968 b_conv.is_owned = false;
34969 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34970 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
34974 void __attribute__((visibility("default"))) TS_Description_free(uint32_t this_obj) {
34975 LDKDescription this_obj_conv;
34976 this_obj_conv.inner = (void*)(this_obj & (~1));
34977 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34979 Description_free(this_obj_conv);
34982 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
34983 LDKDescription ret_var = Description_clone(arg);
34984 uint64_t ret_ref = 0;
34985 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34986 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34987 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34988 ret_ref = (uint64_t)ret_var.inner;
34989 if (ret_var.is_owned) {
34994 int64_t __attribute__((visibility("default"))) TS_Description_clone_ptr(uint32_t arg) {
34995 LDKDescription arg_conv;
34996 arg_conv.inner = (void*)(arg & (~1));
34997 arg_conv.is_owned = false;
34998 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34999 int64_t ret_val = Description_clone_ptr(&arg_conv);
35003 uint32_t __attribute__((visibility("default"))) TS_Description_clone(uint32_t orig) {
35004 LDKDescription orig_conv;
35005 orig_conv.inner = (void*)(orig & (~1));
35006 orig_conv.is_owned = false;
35007 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35008 LDKDescription ret_var = Description_clone(&orig_conv);
35009 uint64_t ret_ref = 0;
35010 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35011 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35012 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35013 ret_ref = (uint64_t)ret_var.inner;
35014 if (ret_var.is_owned) {
35020 int64_t __attribute__((visibility("default"))) TS_Description_hash(uint32_t o) {
35021 LDKDescription o_conv;
35022 o_conv.inner = (void*)(o & (~1));
35023 o_conv.is_owned = false;
35024 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35025 int64_t ret_val = Description_hash(&o_conv);
35029 jboolean __attribute__((visibility("default"))) TS_Description_eq(uint32_t a, uint32_t b) {
35030 LDKDescription a_conv;
35031 a_conv.inner = (void*)(a & (~1));
35032 a_conv.is_owned = false;
35033 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35034 LDKDescription b_conv;
35035 b_conv.inner = (void*)(b & (~1));
35036 b_conv.is_owned = false;
35037 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35038 jboolean ret_val = Description_eq(&a_conv, &b_conv);
35042 void __attribute__((visibility("default"))) TS_PayeePubKey_free(uint32_t this_obj) {
35043 LDKPayeePubKey this_obj_conv;
35044 this_obj_conv.inner = (void*)(this_obj & (~1));
35045 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35046 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35047 PayeePubKey_free(this_obj_conv);
35050 int8_tArray __attribute__((visibility("default"))) TS_PayeePubKey_get_a(uint32_t this_ptr) {
35051 LDKPayeePubKey this_ptr_conv;
35052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35053 this_ptr_conv.is_owned = false;
35054 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35055 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
35056 memcpy((uint8_t*)(ret_arr + 4), PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
35060 void __attribute__((visibility("default"))) TS_PayeePubKey_set_a(uint32_t this_ptr, int8_tArray val) {
35061 LDKPayeePubKey this_ptr_conv;
35062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35063 this_ptr_conv.is_owned = false;
35064 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35065 LDKPublicKey val_ref;
35066 CHECK(*((uint32_t*)val) == 33);
35067 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
35068 PayeePubKey_set_a(&this_ptr_conv, val_ref);
35071 uint32_t __attribute__((visibility("default"))) TS_PayeePubKey_new(int8_tArray a_arg) {
35072 LDKPublicKey a_arg_ref;
35073 CHECK(*((uint32_t*)a_arg) == 33);
35074 memcpy(a_arg_ref.compressed_form, (uint8_t*)(a_arg + 4), 33);
35075 LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
35076 uint64_t ret_ref = 0;
35077 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35078 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35079 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35080 ret_ref = (uint64_t)ret_var.inner;
35081 if (ret_var.is_owned) {
35087 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
35088 LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
35089 uint64_t ret_ref = 0;
35090 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35091 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35092 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35093 ret_ref = (uint64_t)ret_var.inner;
35094 if (ret_var.is_owned) {
35099 int64_t __attribute__((visibility("default"))) TS_PayeePubKey_clone_ptr(uint32_t arg) {
35100 LDKPayeePubKey arg_conv;
35101 arg_conv.inner = (void*)(arg & (~1));
35102 arg_conv.is_owned = false;
35103 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35104 int64_t ret_val = PayeePubKey_clone_ptr(&arg_conv);
35108 uint32_t __attribute__((visibility("default"))) TS_PayeePubKey_clone(uint32_t orig) {
35109 LDKPayeePubKey orig_conv;
35110 orig_conv.inner = (void*)(orig & (~1));
35111 orig_conv.is_owned = false;
35112 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35113 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
35114 uint64_t ret_ref = 0;
35115 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35116 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35117 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35118 ret_ref = (uint64_t)ret_var.inner;
35119 if (ret_var.is_owned) {
35125 int64_t __attribute__((visibility("default"))) TS_PayeePubKey_hash(uint32_t o) {
35126 LDKPayeePubKey o_conv;
35127 o_conv.inner = (void*)(o & (~1));
35128 o_conv.is_owned = false;
35129 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35130 int64_t ret_val = PayeePubKey_hash(&o_conv);
35134 jboolean __attribute__((visibility("default"))) TS_PayeePubKey_eq(uint32_t a, uint32_t b) {
35135 LDKPayeePubKey a_conv;
35136 a_conv.inner = (void*)(a & (~1));
35137 a_conv.is_owned = false;
35138 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35139 LDKPayeePubKey b_conv;
35140 b_conv.inner = (void*)(b & (~1));
35141 b_conv.is_owned = false;
35142 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35143 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
35147 void __attribute__((visibility("default"))) TS_ExpiryTime_free(uint32_t this_obj) {
35148 LDKExpiryTime this_obj_conv;
35149 this_obj_conv.inner = (void*)(this_obj & (~1));
35150 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35151 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35152 ExpiryTime_free(this_obj_conv);
35155 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
35156 LDKExpiryTime ret_var = ExpiryTime_clone(arg);
35157 uint64_t ret_ref = 0;
35158 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35159 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35160 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35161 ret_ref = (uint64_t)ret_var.inner;
35162 if (ret_var.is_owned) {
35167 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_clone_ptr(uint32_t arg) {
35168 LDKExpiryTime arg_conv;
35169 arg_conv.inner = (void*)(arg & (~1));
35170 arg_conv.is_owned = false;
35171 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35172 int64_t ret_val = ExpiryTime_clone_ptr(&arg_conv);
35176 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_clone(uint32_t orig) {
35177 LDKExpiryTime orig_conv;
35178 orig_conv.inner = (void*)(orig & (~1));
35179 orig_conv.is_owned = false;
35180 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35181 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
35182 uint64_t ret_ref = 0;
35183 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35184 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35185 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35186 ret_ref = (uint64_t)ret_var.inner;
35187 if (ret_var.is_owned) {
35193 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_hash(uint32_t o) {
35194 LDKExpiryTime o_conv;
35195 o_conv.inner = (void*)(o & (~1));
35196 o_conv.is_owned = false;
35197 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35198 int64_t ret_val = ExpiryTime_hash(&o_conv);
35202 jboolean __attribute__((visibility("default"))) TS_ExpiryTime_eq(uint32_t a, uint32_t b) {
35203 LDKExpiryTime a_conv;
35204 a_conv.inner = (void*)(a & (~1));
35205 a_conv.is_owned = false;
35206 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35207 LDKExpiryTime b_conv;
35208 b_conv.inner = (void*)(b & (~1));
35209 b_conv.is_owned = false;
35210 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35211 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
35215 void __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_free(uint32_t this_obj) {
35216 LDKMinFinalCltvExpiry this_obj_conv;
35217 this_obj_conv.inner = (void*)(this_obj & (~1));
35218 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35219 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35220 MinFinalCltvExpiry_free(this_obj_conv);
35223 int64_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_get_a(uint32_t this_ptr) {
35224 LDKMinFinalCltvExpiry this_ptr_conv;
35225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35226 this_ptr_conv.is_owned = false;
35227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35228 int64_t ret_val = MinFinalCltvExpiry_get_a(&this_ptr_conv);
35232 void __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_set_a(uint32_t this_ptr, int64_t val) {
35233 LDKMinFinalCltvExpiry this_ptr_conv;
35234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35235 this_ptr_conv.is_owned = false;
35236 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35237 MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
35240 uint32_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_new(int64_t a_arg) {
35241 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
35242 uint64_t ret_ref = 0;
35243 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35244 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35245 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35246 ret_ref = (uint64_t)ret_var.inner;
35247 if (ret_var.is_owned) {
35253 static inline uint64_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
35254 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
35255 uint64_t ret_ref = 0;
35256 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35257 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35258 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35259 ret_ref = (uint64_t)ret_var.inner;
35260 if (ret_var.is_owned) {
35265 int64_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_clone_ptr(uint32_t arg) {
35266 LDKMinFinalCltvExpiry arg_conv;
35267 arg_conv.inner = (void*)(arg & (~1));
35268 arg_conv.is_owned = false;
35269 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35270 int64_t ret_val = MinFinalCltvExpiry_clone_ptr(&arg_conv);
35274 uint32_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_clone(uint32_t orig) {
35275 LDKMinFinalCltvExpiry orig_conv;
35276 orig_conv.inner = (void*)(orig & (~1));
35277 orig_conv.is_owned = false;
35278 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35279 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
35280 uint64_t ret_ref = 0;
35281 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35282 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35283 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35284 ret_ref = (uint64_t)ret_var.inner;
35285 if (ret_var.is_owned) {
35291 int64_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_hash(uint32_t o) {
35292 LDKMinFinalCltvExpiry o_conv;
35293 o_conv.inner = (void*)(o & (~1));
35294 o_conv.is_owned = false;
35295 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35296 int64_t ret_val = MinFinalCltvExpiry_hash(&o_conv);
35300 jboolean __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_eq(uint32_t a, uint32_t b) {
35301 LDKMinFinalCltvExpiry a_conv;
35302 a_conv.inner = (void*)(a & (~1));
35303 a_conv.is_owned = false;
35304 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35305 LDKMinFinalCltvExpiry b_conv;
35306 b_conv.inner = (void*)(b & (~1));
35307 b_conv.is_owned = false;
35308 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35309 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
35313 void __attribute__((visibility("default"))) TS_Fallback_free(uint32_t this_ptr) {
35314 if ((this_ptr & 1) != 0) return;
35315 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
35316 CHECK_ACCESS(this_ptr_ptr);
35317 LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
35318 FREE((void*)this_ptr);
35319 Fallback_free(this_ptr_conv);
35322 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
35323 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
35324 *ret_copy = Fallback_clone(arg);
35325 uint64_t ret_ref = (uint64_t)ret_copy;
35328 int64_t __attribute__((visibility("default"))) TS_Fallback_clone_ptr(uint32_t arg) {
35329 LDKFallback* arg_conv = (LDKFallback*)arg;
35330 int64_t ret_val = Fallback_clone_ptr(arg_conv);
35334 uint32_t __attribute__((visibility("default"))) TS_Fallback_clone(uint32_t orig) {
35335 LDKFallback* orig_conv = (LDKFallback*)orig;
35336 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
35337 *ret_copy = Fallback_clone(orig_conv);
35338 uint64_t ret_ref = (uint64_t)ret_copy;
35342 uint32_t __attribute__((visibility("default"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
35344 LDKCVec_u8Z program_ref;
35345 program_ref.datalen = *((uint32_t*)program);
35346 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
35347 memcpy(program_ref.data, (uint8_t*)(program + 4), program_ref.datalen);
35348 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
35349 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
35350 uint64_t ret_ref = (uint64_t)ret_copy;
35354 uint32_t __attribute__((visibility("default"))) TS_Fallback_pub_key_hash(int8_tArray a) {
35355 LDKTwentyBytes a_ref;
35356 CHECK(*((uint32_t*)a) == 20);
35357 memcpy(a_ref.data, (uint8_t*)(a + 4), 20);
35358 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
35359 *ret_copy = Fallback_pub_key_hash(a_ref);
35360 uint64_t ret_ref = (uint64_t)ret_copy;
35364 uint32_t __attribute__((visibility("default"))) TS_Fallback_script_hash(int8_tArray a) {
35365 LDKTwentyBytes a_ref;
35366 CHECK(*((uint32_t*)a) == 20);
35367 memcpy(a_ref.data, (uint8_t*)(a + 4), 20);
35368 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
35369 *ret_copy = Fallback_script_hash(a_ref);
35370 uint64_t ret_ref = (uint64_t)ret_copy;
35374 int64_t __attribute__((visibility("default"))) TS_Fallback_hash(uint32_t o) {
35375 LDKFallback* o_conv = (LDKFallback*)o;
35376 int64_t ret_val = Fallback_hash(o_conv);
35380 jboolean __attribute__((visibility("default"))) TS_Fallback_eq(uint32_t a, uint32_t b) {
35381 LDKFallback* a_conv = (LDKFallback*)a;
35382 LDKFallback* b_conv = (LDKFallback*)b;
35383 jboolean ret_val = Fallback_eq(a_conv, b_conv);
35387 void __attribute__((visibility("default"))) TS_InvoiceSignature_free(uint32_t this_obj) {
35388 LDKInvoiceSignature this_obj_conv;
35389 this_obj_conv.inner = (void*)(this_obj & (~1));
35390 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35391 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35392 InvoiceSignature_free(this_obj_conv);
35395 static inline uint64_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
35396 LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
35397 uint64_t ret_ref = 0;
35398 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35399 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35400 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35401 ret_ref = (uint64_t)ret_var.inner;
35402 if (ret_var.is_owned) {
35407 int64_t __attribute__((visibility("default"))) TS_InvoiceSignature_clone_ptr(uint32_t arg) {
35408 LDKInvoiceSignature arg_conv;
35409 arg_conv.inner = (void*)(arg & (~1));
35410 arg_conv.is_owned = false;
35411 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35412 int64_t ret_val = InvoiceSignature_clone_ptr(&arg_conv);
35416 uint32_t __attribute__((visibility("default"))) TS_InvoiceSignature_clone(uint32_t orig) {
35417 LDKInvoiceSignature orig_conv;
35418 orig_conv.inner = (void*)(orig & (~1));
35419 orig_conv.is_owned = false;
35420 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35421 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
35422 uint64_t ret_ref = 0;
35423 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35424 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35425 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35426 ret_ref = (uint64_t)ret_var.inner;
35427 if (ret_var.is_owned) {
35433 jboolean __attribute__((visibility("default"))) TS_InvoiceSignature_eq(uint32_t a, uint32_t b) {
35434 LDKInvoiceSignature a_conv;
35435 a_conv.inner = (void*)(a & (~1));
35436 a_conv.is_owned = false;
35437 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35438 LDKInvoiceSignature b_conv;
35439 b_conv.inner = (void*)(b & (~1));
35440 b_conv.is_owned = false;
35441 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35442 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
35446 void __attribute__((visibility("default"))) TS_PrivateRoute_free(uint32_t this_obj) {
35447 LDKPrivateRoute this_obj_conv;
35448 this_obj_conv.inner = (void*)(this_obj & (~1));
35449 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35450 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35451 PrivateRoute_free(this_obj_conv);
35454 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
35455 LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
35456 uint64_t ret_ref = 0;
35457 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35458 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35459 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35460 ret_ref = (uint64_t)ret_var.inner;
35461 if (ret_var.is_owned) {
35466 int64_t __attribute__((visibility("default"))) TS_PrivateRoute_clone_ptr(uint32_t arg) {
35467 LDKPrivateRoute arg_conv;
35468 arg_conv.inner = (void*)(arg & (~1));
35469 arg_conv.is_owned = false;
35470 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35471 int64_t ret_val = PrivateRoute_clone_ptr(&arg_conv);
35475 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_clone(uint32_t orig) {
35476 LDKPrivateRoute orig_conv;
35477 orig_conv.inner = (void*)(orig & (~1));
35478 orig_conv.is_owned = false;
35479 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35480 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
35481 uint64_t ret_ref = 0;
35482 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35483 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35484 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35485 ret_ref = (uint64_t)ret_var.inner;
35486 if (ret_var.is_owned) {
35492 int64_t __attribute__((visibility("default"))) TS_PrivateRoute_hash(uint32_t o) {
35493 LDKPrivateRoute o_conv;
35494 o_conv.inner = (void*)(o & (~1));
35495 o_conv.is_owned = false;
35496 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35497 int64_t ret_val = PrivateRoute_hash(&o_conv);
35501 jboolean __attribute__((visibility("default"))) TS_PrivateRoute_eq(uint32_t a, uint32_t b) {
35502 LDKPrivateRoute a_conv;
35503 a_conv.inner = (void*)(a & (~1));
35504 a_conv.is_owned = false;
35505 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35506 LDKPrivateRoute b_conv;
35507 b_conv.inner = (void*)(b & (~1));
35508 b_conv.is_owned = false;
35509 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35510 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
35514 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_into_parts(uint32_t this_arg) {
35515 LDKSignedRawInvoice this_arg_conv;
35516 this_arg_conv.inner = (void*)(this_arg & (~1));
35517 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
35518 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35519 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
35520 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
35521 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
35522 return ((uint64_t)ret_conv);
35525 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_raw_invoice(uint32_t this_arg) {
35526 LDKSignedRawInvoice this_arg_conv;
35527 this_arg_conv.inner = (void*)(this_arg & (~1));
35528 this_arg_conv.is_owned = false;
35529 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35530 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
35531 uint64_t ret_ref = 0;
35532 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35533 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35534 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35535 ret_ref = (uint64_t)ret_var.inner;
35536 if (ret_var.is_owned) {
35542 int8_tArray __attribute__((visibility("default"))) TS_SignedRawInvoice_hash(uint32_t this_arg) {
35543 LDKSignedRawInvoice this_arg_conv;
35544 this_arg_conv.inner = (void*)(this_arg & (~1));
35545 this_arg_conv.is_owned = false;
35546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35547 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
35548 memcpy((uint8_t*)(ret_arr + 4), *SignedRawInvoice_hash(&this_arg_conv), 32);
35552 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_signature(uint32_t this_arg) {
35553 LDKSignedRawInvoice this_arg_conv;
35554 this_arg_conv.inner = (void*)(this_arg & (~1));
35555 this_arg_conv.is_owned = false;
35556 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35557 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
35558 uint64_t ret_ref = 0;
35559 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35560 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35561 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35562 ret_ref = (uint64_t)ret_var.inner;
35563 if (ret_var.is_owned) {
35569 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_recover_payee_pub_key(uint32_t this_arg) {
35570 LDKSignedRawInvoice this_arg_conv;
35571 this_arg_conv.inner = (void*)(this_arg & (~1));
35572 this_arg_conv.is_owned = false;
35573 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35574 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
35575 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
35576 return (uint64_t)ret_conv;
35579 jboolean __attribute__((visibility("default"))) TS_SignedRawInvoice_check_signature(uint32_t this_arg) {
35580 LDKSignedRawInvoice this_arg_conv;
35581 this_arg_conv.inner = (void*)(this_arg & (~1));
35582 this_arg_conv.is_owned = false;
35583 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35584 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
35588 int8_tArray __attribute__((visibility("default"))) TS_RawInvoice_hash(uint32_t this_arg) {
35589 LDKRawInvoice this_arg_conv;
35590 this_arg_conv.inner = (void*)(this_arg & (~1));
35591 this_arg_conv.is_owned = false;
35592 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35593 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
35594 memcpy((uint8_t*)(ret_arr + 4), RawInvoice_hash(&this_arg_conv).data, 32);
35598 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_payment_hash(uint32_t this_arg) {
35599 LDKRawInvoice this_arg_conv;
35600 this_arg_conv.inner = (void*)(this_arg & (~1));
35601 this_arg_conv.is_owned = false;
35602 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35603 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
35604 uint64_t ret_ref = 0;
35605 if ((uint64_t)ret_var.inner > 4096) {
35606 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35607 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35608 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35609 ret_ref = (uint64_t)ret_var.inner;
35610 if (ret_var.is_owned) {
35617 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_description(uint32_t this_arg) {
35618 LDKRawInvoice this_arg_conv;
35619 this_arg_conv.inner = (void*)(this_arg & (~1));
35620 this_arg_conv.is_owned = false;
35621 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35622 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
35623 uint64_t ret_ref = 0;
35624 if ((uint64_t)ret_var.inner > 4096) {
35625 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35626 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35627 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35628 ret_ref = (uint64_t)ret_var.inner;
35629 if (ret_var.is_owned) {
35636 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_payee_pub_key(uint32_t this_arg) {
35637 LDKRawInvoice this_arg_conv;
35638 this_arg_conv.inner = (void*)(this_arg & (~1));
35639 this_arg_conv.is_owned = false;
35640 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35641 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
35642 uint64_t ret_ref = 0;
35643 if ((uint64_t)ret_var.inner > 4096) {
35644 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35645 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35646 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35647 ret_ref = (uint64_t)ret_var.inner;
35648 if (ret_var.is_owned) {
35655 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_description_hash(uint32_t this_arg) {
35656 LDKRawInvoice this_arg_conv;
35657 this_arg_conv.inner = (void*)(this_arg & (~1));
35658 this_arg_conv.is_owned = false;
35659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35660 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
35661 uint64_t ret_ref = 0;
35662 if ((uint64_t)ret_var.inner > 4096) {
35663 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35664 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35665 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35666 ret_ref = (uint64_t)ret_var.inner;
35667 if (ret_var.is_owned) {
35674 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_expiry_time(uint32_t this_arg) {
35675 LDKRawInvoice this_arg_conv;
35676 this_arg_conv.inner = (void*)(this_arg & (~1));
35677 this_arg_conv.is_owned = false;
35678 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35679 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
35680 uint64_t ret_ref = 0;
35681 if ((uint64_t)ret_var.inner > 4096) {
35682 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35683 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35684 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35685 ret_ref = (uint64_t)ret_var.inner;
35686 if (ret_var.is_owned) {
35693 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_min_final_cltv_expiry(uint32_t this_arg) {
35694 LDKRawInvoice this_arg_conv;
35695 this_arg_conv.inner = (void*)(this_arg & (~1));
35696 this_arg_conv.is_owned = false;
35697 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35698 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
35699 uint64_t ret_ref = 0;
35700 if ((uint64_t)ret_var.inner > 4096) {
35701 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35702 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35703 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35704 ret_ref = (uint64_t)ret_var.inner;
35705 if (ret_var.is_owned) {
35712 int8_tArray __attribute__((visibility("default"))) TS_RawInvoice_payment_secret(uint32_t this_arg) {
35713 LDKRawInvoice this_arg_conv;
35714 this_arg_conv.inner = (void*)(this_arg & (~1));
35715 this_arg_conv.is_owned = false;
35716 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35717 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
35718 memcpy((uint8_t*)(ret_arr + 4), RawInvoice_payment_secret(&this_arg_conv).data, 32);
35722 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_features(uint32_t this_arg) {
35723 LDKRawInvoice this_arg_conv;
35724 this_arg_conv.inner = (void*)(this_arg & (~1));
35725 this_arg_conv.is_owned = false;
35726 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35727 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
35728 uint64_t ret_ref = 0;
35729 if ((uint64_t)ret_var.inner > 4096) {
35730 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35731 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35732 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35733 ret_ref = (uint64_t)ret_var.inner;
35734 if (ret_var.is_owned) {
35741 uint32_tArray __attribute__((visibility("default"))) TS_RawInvoice_private_routes(uint32_t this_arg) {
35742 LDKRawInvoice this_arg_conv;
35743 this_arg_conv.inner = (void*)(this_arg & (~1));
35744 this_arg_conv.is_owned = false;
35745 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35746 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
35747 uint32_tArray ret_arr = NULL;
35748 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
35749 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
35750 for (size_t o = 0; o < ret_var.datalen; o++) {
35751 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
35752 uint64_t ret_conv_14_ref = 0;
35753 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35754 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35755 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
35756 ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
35757 if (ret_conv_14_var.is_owned) {
35758 ret_conv_14_ref |= 1;
35760 ret_arr_ptr[o] = ret_conv_14_ref;
35763 FREE(ret_var.data);
35767 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_amount_pico_btc(uint32_t this_arg) {
35768 LDKRawInvoice this_arg_conv;
35769 this_arg_conv.inner = (void*)(this_arg & (~1));
35770 this_arg_conv.is_owned = false;
35771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35772 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
35773 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
35774 uint64_t ret_ref = (uint64_t)ret_copy;
35778 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_currency(uint32_t this_arg) {
35779 LDKRawInvoice this_arg_conv;
35780 this_arg_conv.inner = (void*)(this_arg & (~1));
35781 this_arg_conv.is_owned = false;
35782 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35783 uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
35787 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
35788 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
35789 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
35790 return (uint64_t)ret_conv;
35793 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_from_system_time(int64_t time) {
35794 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
35795 *ret_conv = PositiveTimestamp_from_system_time(time);
35796 return (uint64_t)ret_conv;
35799 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_as_unix_timestamp(uint32_t this_arg) {
35800 LDKPositiveTimestamp this_arg_conv;
35801 this_arg_conv.inner = (void*)(this_arg & (~1));
35802 this_arg_conv.is_owned = false;
35803 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35804 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
35808 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_as_time(uint32_t this_arg) {
35809 LDKPositiveTimestamp this_arg_conv;
35810 this_arg_conv.inner = (void*)(this_arg & (~1));
35811 this_arg_conv.is_owned = false;
35812 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35813 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
35817 uint32_t __attribute__((visibility("default"))) TS_Invoice_into_signed_raw(uint32_t this_arg) {
35818 LDKInvoice this_arg_conv;
35819 this_arg_conv.inner = (void*)(this_arg & (~1));
35820 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
35821 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35822 this_arg_conv = Invoice_clone(&this_arg_conv);
35823 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
35824 uint64_t ret_ref = 0;
35825 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35826 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35827 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35828 ret_ref = (uint64_t)ret_var.inner;
35829 if (ret_var.is_owned) {
35835 uint32_t __attribute__((visibility("default"))) TS_Invoice_check_signature(uint32_t this_arg) {
35836 LDKInvoice this_arg_conv;
35837 this_arg_conv.inner = (void*)(this_arg & (~1));
35838 this_arg_conv.is_owned = false;
35839 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35840 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
35841 *ret_conv = Invoice_check_signature(&this_arg_conv);
35842 return (uint64_t)ret_conv;
35845 uint32_t __attribute__((visibility("default"))) TS_Invoice_from_signed(uint32_t signed_invoice) {
35846 LDKSignedRawInvoice signed_invoice_conv;
35847 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
35848 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
35849 CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
35850 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
35851 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
35852 *ret_conv = Invoice_from_signed(signed_invoice_conv);
35853 return (uint64_t)ret_conv;
35856 int64_t __attribute__((visibility("default"))) TS_Invoice_timestamp(uint32_t this_arg) {
35857 LDKInvoice this_arg_conv;
35858 this_arg_conv.inner = (void*)(this_arg & (~1));
35859 this_arg_conv.is_owned = false;
35860 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35861 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
35865 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payment_hash(uint32_t this_arg) {
35866 LDKInvoice this_arg_conv;
35867 this_arg_conv.inner = (void*)(this_arg & (~1));
35868 this_arg_conv.is_owned = false;
35869 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35870 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
35871 memcpy((uint8_t*)(ret_arr + 4), *Invoice_payment_hash(&this_arg_conv), 32);
35875 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payee_pub_key(uint32_t this_arg) {
35876 LDKInvoice this_arg_conv;
35877 this_arg_conv.inner = (void*)(this_arg & (~1));
35878 this_arg_conv.is_owned = false;
35879 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35880 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
35881 memcpy((uint8_t*)(ret_arr + 4), Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
35885 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payment_secret(uint32_t this_arg) {
35886 LDKInvoice this_arg_conv;
35887 this_arg_conv.inner = (void*)(this_arg & (~1));
35888 this_arg_conv.is_owned = false;
35889 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35890 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
35891 memcpy((uint8_t*)(ret_arr + 4), *Invoice_payment_secret(&this_arg_conv), 32);
35895 uint32_t __attribute__((visibility("default"))) TS_Invoice_features(uint32_t this_arg) {
35896 LDKInvoice this_arg_conv;
35897 this_arg_conv.inner = (void*)(this_arg & (~1));
35898 this_arg_conv.is_owned = false;
35899 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35900 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
35901 uint64_t ret_ref = 0;
35902 if ((uint64_t)ret_var.inner > 4096) {
35903 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35904 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35905 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35906 ret_ref = (uint64_t)ret_var.inner;
35907 if (ret_var.is_owned) {
35914 int8_tArray __attribute__((visibility("default"))) TS_Invoice_recover_payee_pub_key(uint32_t this_arg) {
35915 LDKInvoice this_arg_conv;
35916 this_arg_conv.inner = (void*)(this_arg & (~1));
35917 this_arg_conv.is_owned = false;
35918 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35919 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
35920 memcpy((uint8_t*)(ret_arr + 4), Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
35924 int64_t __attribute__((visibility("default"))) TS_Invoice_expiry_time(uint32_t this_arg) {
35925 LDKInvoice this_arg_conv;
35926 this_arg_conv.inner = (void*)(this_arg & (~1));
35927 this_arg_conv.is_owned = false;
35928 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35929 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
35933 jboolean __attribute__((visibility("default"))) TS_Invoice_is_expired(uint32_t this_arg) {
35934 LDKInvoice this_arg_conv;
35935 this_arg_conv.inner = (void*)(this_arg & (~1));
35936 this_arg_conv.is_owned = false;
35937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35938 jboolean ret_val = Invoice_is_expired(&this_arg_conv);
35942 int64_t __attribute__((visibility("default"))) TS_Invoice_min_final_cltv_expiry(uint32_t this_arg) {
35943 LDKInvoice this_arg_conv;
35944 this_arg_conv.inner = (void*)(this_arg & (~1));
35945 this_arg_conv.is_owned = false;
35946 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35947 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
35951 uint32_tArray __attribute__((visibility("default"))) TS_Invoice_private_routes(uint32_t this_arg) {
35952 LDKInvoice this_arg_conv;
35953 this_arg_conv.inner = (void*)(this_arg & (~1));
35954 this_arg_conv.is_owned = false;
35955 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35956 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
35957 uint32_tArray ret_arr = NULL;
35958 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
35959 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
35960 for (size_t o = 0; o < ret_var.datalen; o++) {
35961 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
35962 uint64_t ret_conv_14_ref = 0;
35963 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35964 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35965 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
35966 ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
35967 if (ret_conv_14_var.is_owned) {
35968 ret_conv_14_ref |= 1;
35970 ret_arr_ptr[o] = ret_conv_14_ref;
35973 FREE(ret_var.data);
35977 uint32_tArray __attribute__((visibility("default"))) TS_Invoice_route_hints(uint32_t this_arg) {
35978 LDKInvoice this_arg_conv;
35979 this_arg_conv.inner = (void*)(this_arg & (~1));
35980 this_arg_conv.is_owned = false;
35981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35982 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
35983 uint32_tArray ret_arr = NULL;
35984 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
35985 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
35986 for (size_t l = 0; l < ret_var.datalen; l++) {
35987 LDKRouteHint ret_conv_11_var = ret_var.data[l];
35988 uint64_t ret_conv_11_ref = 0;
35989 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35990 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35991 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
35992 ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
35993 if (ret_conv_11_var.is_owned) {
35994 ret_conv_11_ref |= 1;
35996 ret_arr_ptr[l] = ret_conv_11_ref;
35999 FREE(ret_var.data);
36003 uint32_t __attribute__((visibility("default"))) TS_Invoice_currency(uint32_t this_arg) {
36004 LDKInvoice this_arg_conv;
36005 this_arg_conv.inner = (void*)(this_arg & (~1));
36006 this_arg_conv.is_owned = false;
36007 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36008 uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
36012 uint32_t __attribute__((visibility("default"))) TS_Invoice_amount_milli_satoshis(uint32_t this_arg) {
36013 LDKInvoice this_arg_conv;
36014 this_arg_conv.inner = (void*)(this_arg & (~1));
36015 this_arg_conv.is_owned = false;
36016 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36017 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
36018 *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
36019 uint64_t ret_ref = (uint64_t)ret_copy;
36023 uint32_t __attribute__((visibility("default"))) TS_Description_new(jstring description) {
36024 LDKStr description_conv = str_ref_to_owned_c(description);
36025 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
36026 *ret_conv = Description_new(description_conv);
36027 return (uint64_t)ret_conv;
36030 jstring __attribute__((visibility("default"))) TS_Description_into_inner(uint32_t this_arg) {
36031 LDKDescription this_arg_conv;
36032 this_arg_conv.inner = (void*)(this_arg & (~1));
36033 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
36034 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36035 this_arg_conv = Description_clone(&this_arg_conv);
36036 LDKStr ret_str = Description_into_inner(this_arg_conv);
36037 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36042 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
36043 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
36044 *ret_conv = ExpiryTime_from_seconds(seconds);
36045 return (uint64_t)ret_conv;
36048 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_from_duration(int64_t duration) {
36049 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
36050 *ret_conv = ExpiryTime_from_duration(duration);
36051 return (uint64_t)ret_conv;
36054 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_as_seconds(uint32_t this_arg) {
36055 LDKExpiryTime this_arg_conv;
36056 this_arg_conv.inner = (void*)(this_arg & (~1));
36057 this_arg_conv.is_owned = false;
36058 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36059 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
36063 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_as_duration(uint32_t this_arg) {
36064 LDKExpiryTime this_arg_conv;
36065 this_arg_conv.inner = (void*)(this_arg & (~1));
36066 this_arg_conv.is_owned = false;
36067 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36068 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
36072 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_new(uint32_t hops) {
36073 LDKRouteHint hops_conv;
36074 hops_conv.inner = (void*)(hops & (~1));
36075 hops_conv.is_owned = (hops & 1) || (hops == 0);
36076 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
36077 hops_conv = RouteHint_clone(&hops_conv);
36078 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
36079 *ret_conv = PrivateRoute_new(hops_conv);
36080 return (uint64_t)ret_conv;
36083 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_into_inner(uint32_t this_arg) {
36084 LDKPrivateRoute this_arg_conv;
36085 this_arg_conv.inner = (void*)(this_arg & (~1));
36086 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
36087 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36088 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
36089 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
36090 uint64_t ret_ref = 0;
36091 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36092 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36093 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36094 ret_ref = (uint64_t)ret_var.inner;
36095 if (ret_var.is_owned) {
36101 uint32_t __attribute__((visibility("default"))) TS_CreationError_clone(uint32_t orig) {
36102 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
36103 uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
36107 uint32_t __attribute__((visibility("default"))) TS_CreationError_description_too_long() {
36108 uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
36112 uint32_t __attribute__((visibility("default"))) TS_CreationError_route_too_long() {
36113 uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
36117 uint32_t __attribute__((visibility("default"))) TS_CreationError_timestamp_out_of_bounds() {
36118 uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
36122 uint32_t __attribute__((visibility("default"))) TS_CreationError_expiry_time_out_of_bounds() {
36123 uint32_t ret_conv = LDKCreationError_to_js(CreationError_expiry_time_out_of_bounds());
36127 jboolean __attribute__((visibility("default"))) TS_CreationError_eq(uint32_t a, uint32_t b) {
36128 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
36129 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
36130 jboolean ret_val = CreationError_eq(a_conv, b_conv);
36134 jstring __attribute__((visibility("default"))) TS_CreationError_to_str(uint32_t o) {
36135 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
36136 LDKStr ret_str = CreationError_to_str(o_conv);
36137 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36142 uint32_t __attribute__((visibility("default"))) TS_SemanticError_clone(uint32_t orig) {
36143 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
36144 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
36148 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_payment_hash() {
36149 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
36153 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_hashes() {
36154 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
36158 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_description() {
36159 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
36163 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_descriptions() {
36164 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
36168 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_payment_secret() {
36169 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
36173 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_secrets() {
36174 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
36178 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_features() {
36179 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
36183 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_recovery_id() {
36184 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
36188 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_signature() {
36189 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
36193 uint32_t __attribute__((visibility("default"))) TS_SemanticError_imprecise_amount() {
36194 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
36198 jboolean __attribute__((visibility("default"))) TS_SemanticError_eq(uint32_t a, uint32_t b) {
36199 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
36200 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
36201 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
36205 jstring __attribute__((visibility("default"))) TS_SemanticError_to_str(uint32_t o) {
36206 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
36207 LDKStr ret_str = SemanticError_to_str(o_conv);
36208 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36213 void __attribute__((visibility("default"))) TS_SignOrCreationError_free(uint32_t this_ptr) {
36214 if ((this_ptr & 1) != 0) return;
36215 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
36216 CHECK_ACCESS(this_ptr_ptr);
36217 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
36218 FREE((void*)this_ptr);
36219 SignOrCreationError_free(this_ptr_conv);
36222 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
36223 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
36224 *ret_copy = SignOrCreationError_clone(arg);
36225 uint64_t ret_ref = (uint64_t)ret_copy;
36228 int64_t __attribute__((visibility("default"))) TS_SignOrCreationError_clone_ptr(uint32_t arg) {
36229 LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)arg;
36230 int64_t ret_val = SignOrCreationError_clone_ptr(arg_conv);
36234 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_clone(uint32_t orig) {
36235 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
36236 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
36237 *ret_copy = SignOrCreationError_clone(orig_conv);
36238 uint64_t ret_ref = (uint64_t)ret_copy;
36242 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_sign_error() {
36243 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
36244 *ret_copy = SignOrCreationError_sign_error();
36245 uint64_t ret_ref = (uint64_t)ret_copy;
36249 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_creation_error(uint32_t a) {
36250 LDKCreationError a_conv = LDKCreationError_from_js(a);
36251 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
36252 *ret_copy = SignOrCreationError_creation_error(a_conv);
36253 uint64_t ret_ref = (uint64_t)ret_copy;
36257 jboolean __attribute__((visibility("default"))) TS_SignOrCreationError_eq(uint32_t a, uint32_t b) {
36258 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
36259 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
36260 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
36264 jstring __attribute__((visibility("default"))) TS_SignOrCreationError_to_str(uint32_t o) {
36265 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
36266 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
36267 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36272 void __attribute__((visibility("default"))) TS_InvoicePayer_free(uint32_t this_obj) {
36273 LDKInvoicePayer this_obj_conv;
36274 this_obj_conv.inner = (void*)(this_obj & (~1));
36275 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36276 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36277 InvoicePayer_free(this_obj_conv);
36280 void __attribute__((visibility("default"))) TS_Payer_free(uint32_t this_ptr) {
36281 if ((this_ptr & 1) != 0) return;
36282 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
36283 CHECK_ACCESS(this_ptr_ptr);
36284 LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
36285 FREE((void*)this_ptr);
36286 Payer_free(this_ptr_conv);
36289 void __attribute__((visibility("default"))) TS_Router_free(uint32_t this_ptr) {
36290 if ((this_ptr & 1) != 0) return;
36291 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
36292 CHECK_ACCESS(this_ptr_ptr);
36293 LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
36294 FREE((void*)this_ptr);
36295 Router_free(this_ptr_conv);
36298 void __attribute__((visibility("default"))) TS_RetryAttempts_free(uint32_t this_obj) {
36299 LDKRetryAttempts this_obj_conv;
36300 this_obj_conv.inner = (void*)(this_obj & (~1));
36301 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36303 RetryAttempts_free(this_obj_conv);
36306 int64_t __attribute__((visibility("default"))) TS_RetryAttempts_get_a(uint32_t this_ptr) {
36307 LDKRetryAttempts this_ptr_conv;
36308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36309 this_ptr_conv.is_owned = false;
36310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36311 int64_t ret_val = RetryAttempts_get_a(&this_ptr_conv);
36315 void __attribute__((visibility("default"))) TS_RetryAttempts_set_a(uint32_t this_ptr, int64_t val) {
36316 LDKRetryAttempts this_ptr_conv;
36317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36318 this_ptr_conv.is_owned = false;
36319 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36320 RetryAttempts_set_a(&this_ptr_conv, val);
36323 uint32_t __attribute__((visibility("default"))) TS_RetryAttempts_new(int64_t a_arg) {
36324 LDKRetryAttempts ret_var = RetryAttempts_new(a_arg);
36325 uint64_t ret_ref = 0;
36326 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36327 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36328 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36329 ret_ref = (uint64_t)ret_var.inner;
36330 if (ret_var.is_owned) {
36336 static inline uint64_t RetryAttempts_clone_ptr(LDKRetryAttempts *NONNULL_PTR arg) {
36337 LDKRetryAttempts ret_var = RetryAttempts_clone(arg);
36338 uint64_t ret_ref = 0;
36339 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36340 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36341 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36342 ret_ref = (uint64_t)ret_var.inner;
36343 if (ret_var.is_owned) {
36348 int64_t __attribute__((visibility("default"))) TS_RetryAttempts_clone_ptr(uint32_t arg) {
36349 LDKRetryAttempts arg_conv;
36350 arg_conv.inner = (void*)(arg & (~1));
36351 arg_conv.is_owned = false;
36352 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36353 int64_t ret_val = RetryAttempts_clone_ptr(&arg_conv);
36357 uint32_t __attribute__((visibility("default"))) TS_RetryAttempts_clone(uint32_t orig) {
36358 LDKRetryAttempts orig_conv;
36359 orig_conv.inner = (void*)(orig & (~1));
36360 orig_conv.is_owned = false;
36361 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36362 LDKRetryAttempts ret_var = RetryAttempts_clone(&orig_conv);
36363 uint64_t ret_ref = 0;
36364 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36365 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36366 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36367 ret_ref = (uint64_t)ret_var.inner;
36368 if (ret_var.is_owned) {
36374 jboolean __attribute__((visibility("default"))) TS_RetryAttempts_eq(uint32_t a, uint32_t b) {
36375 LDKRetryAttempts a_conv;
36376 a_conv.inner = (void*)(a & (~1));
36377 a_conv.is_owned = false;
36378 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36379 LDKRetryAttempts b_conv;
36380 b_conv.inner = (void*)(b & (~1));
36381 b_conv.is_owned = false;
36382 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36383 jboolean ret_val = RetryAttempts_eq(&a_conv, &b_conv);
36387 int64_t __attribute__((visibility("default"))) TS_RetryAttempts_hash(uint32_t o) {
36388 LDKRetryAttempts o_conv;
36389 o_conv.inner = (void*)(o & (~1));
36390 o_conv.is_owned = false;
36391 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36392 int64_t ret_val = RetryAttempts_hash(&o_conv);
36396 void __attribute__((visibility("default"))) TS_PaymentError_free(uint32_t this_ptr) {
36397 if ((this_ptr & 1) != 0) return;
36398 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
36399 CHECK_ACCESS(this_ptr_ptr);
36400 LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
36401 FREE((void*)this_ptr);
36402 PaymentError_free(this_ptr_conv);
36405 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
36406 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
36407 *ret_copy = PaymentError_clone(arg);
36408 uint64_t ret_ref = (uint64_t)ret_copy;
36411 int64_t __attribute__((visibility("default"))) TS_PaymentError_clone_ptr(uint32_t arg) {
36412 LDKPaymentError* arg_conv = (LDKPaymentError*)arg;
36413 int64_t ret_val = PaymentError_clone_ptr(arg_conv);
36417 uint32_t __attribute__((visibility("default"))) TS_PaymentError_clone(uint32_t orig) {
36418 LDKPaymentError* orig_conv = (LDKPaymentError*)orig;
36419 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
36420 *ret_copy = PaymentError_clone(orig_conv);
36421 uint64_t ret_ref = (uint64_t)ret_copy;
36425 uint32_t __attribute__((visibility("default"))) TS_PaymentError_invoice(jstring a) {
36426 LDKStr a_conv = str_ref_to_owned_c(a);
36427 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
36428 *ret_copy = PaymentError_invoice(a_conv);
36429 uint64_t ret_ref = (uint64_t)ret_copy;
36433 uint32_t __attribute__((visibility("default"))) TS_PaymentError_routing(uint32_t a) {
36434 LDKLightningError a_conv;
36435 a_conv.inner = (void*)(a & (~1));
36436 a_conv.is_owned = (a & 1) || (a == 0);
36437 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36438 a_conv = LightningError_clone(&a_conv);
36439 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
36440 *ret_copy = PaymentError_routing(a_conv);
36441 uint64_t ret_ref = (uint64_t)ret_copy;
36445 uint32_t __attribute__((visibility("default"))) TS_PaymentError_sending(uint32_t a) {
36446 void* a_ptr = (void*)(((uint64_t)a) & ~1);
36447 CHECK_ACCESS(a_ptr);
36448 LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
36449 a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)a) & ~1));
36450 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
36451 *ret_copy = PaymentError_sending(a_conv);
36452 uint64_t ret_ref = (uint64_t)ret_copy;
36456 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) {
36457 void* payer_ptr = (void*)(((uint64_t)payer) & ~1);
36458 CHECK_ACCESS(payer_ptr);
36459 LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
36460 void* router_ptr = (void*)(((uint64_t)router) & ~1);
36461 CHECK_ACCESS(router_ptr);
36462 LDKRouter router_conv = *(LDKRouter*)(router_ptr);
36463 LDKLockableScore scorer_conv;
36464 scorer_conv.inner = (void*)(scorer & (~1));
36465 scorer_conv.is_owned = false;
36466 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
36467 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
36468 CHECK_ACCESS(logger_ptr);
36469 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36470 void* event_handler_ptr = (void*)(((uint64_t)event_handler) & ~1);
36471 CHECK_ACCESS(event_handler_ptr);
36472 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
36473 LDKRetryAttempts retry_attempts_conv;
36474 retry_attempts_conv.inner = (void*)(retry_attempts & (~1));
36475 retry_attempts_conv.is_owned = (retry_attempts & 1) || (retry_attempts == 0);
36476 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_attempts_conv);
36477 retry_attempts_conv = RetryAttempts_clone(&retry_attempts_conv);
36478 LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, &scorer_conv, logger_conv, event_handler_conv, retry_attempts_conv);
36479 uint64_t ret_ref = 0;
36480 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36481 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36482 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36483 ret_ref = (uint64_t)ret_var.inner;
36484 if (ret_var.is_owned) {
36490 uint32_t __attribute__((visibility("default"))) TS_InvoicePayer_pay_invoice(uint32_t this_arg, uint32_t invoice) {
36491 LDKInvoicePayer this_arg_conv;
36492 this_arg_conv.inner = (void*)(this_arg & (~1));
36493 this_arg_conv.is_owned = false;
36494 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36495 LDKInvoice invoice_conv;
36496 invoice_conv.inner = (void*)(invoice & (~1));
36497 invoice_conv.is_owned = false;
36498 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
36499 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
36500 *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
36501 return (uint64_t)ret_conv;
36504 uint32_t __attribute__((visibility("default"))) TS_InvoicePayer_pay_zero_value_invoice(uint32_t this_arg, uint32_t invoice, int64_t amount_msats) {
36505 LDKInvoicePayer this_arg_conv;
36506 this_arg_conv.inner = (void*)(this_arg & (~1));
36507 this_arg_conv.is_owned = false;
36508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36509 LDKInvoice invoice_conv;
36510 invoice_conv.inner = (void*)(invoice & (~1));
36511 invoice_conv.is_owned = false;
36512 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
36513 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
36514 *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
36515 return (uint64_t)ret_conv;
36518 void __attribute__((visibility("default"))) TS_InvoicePayer_remove_cached_payment(uint32_t this_arg, int8_tArray payment_hash) {
36519 LDKInvoicePayer this_arg_conv;
36520 this_arg_conv.inner = (void*)(this_arg & (~1));
36521 this_arg_conv.is_owned = false;
36522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36523 unsigned char payment_hash_arr[32];
36524 CHECK(*((uint32_t*)payment_hash) == 32);
36525 memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32);
36526 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
36527 InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
36530 uint32_t __attribute__((visibility("default"))) TS_InvoicePayer_as_EventHandler(uint32_t this_arg) {
36531 LDKInvoicePayer this_arg_conv;
36532 this_arg_conv.inner = (void*)(this_arg & (~1));
36533 this_arg_conv.is_owned = false;
36534 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36535 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
36536 *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
36537 return (uint64_t)ret_ret;
36540 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) {
36541 LDKChannelManager channelmanager_conv;
36542 channelmanager_conv.inner = (void*)(channelmanager & (~1));
36543 channelmanager_conv.is_owned = false;
36544 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
36545 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
36546 CHECK_ACCESS(keys_manager_ptr);
36547 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
36548 LDKCurrency network_conv = LDKCurrency_from_js(network);
36549 void* amt_msat_ptr = (void*)(((uint64_t)amt_msat) & ~1);
36550 CHECK_ACCESS(amt_msat_ptr);
36551 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
36552 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1));
36553 LDKStr description_conv = str_ref_to_owned_c(description);
36554 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
36555 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
36556 return (uint64_t)ret_conv;
36559 void __attribute__((visibility("default"))) TS_DefaultRouter_free(uint32_t this_obj) {
36560 LDKDefaultRouter this_obj_conv;
36561 this_obj_conv.inner = (void*)(this_obj & (~1));
36562 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36563 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36564 DefaultRouter_free(this_obj_conv);
36567 uint32_t __attribute__((visibility("default"))) TS_DefaultRouter_new(uint32_t network_graph, uint32_t logger) {
36568 LDKNetworkGraph network_graph_conv;
36569 network_graph_conv.inner = (void*)(network_graph & (~1));
36570 network_graph_conv.is_owned = false;
36571 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
36572 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
36573 CHECK_ACCESS(logger_ptr);
36574 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36575 LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv);
36576 uint64_t ret_ref = 0;
36577 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36578 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36579 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36580 ret_ref = (uint64_t)ret_var.inner;
36581 if (ret_var.is_owned) {
36587 uint32_t __attribute__((visibility("default"))) TS_DefaultRouter_as_Router(uint32_t this_arg) {
36588 LDKDefaultRouter this_arg_conv;
36589 this_arg_conv.inner = (void*)(this_arg & (~1));
36590 this_arg_conv.is_owned = false;
36591 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36592 LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
36593 *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
36594 return (uint64_t)ret_ret;
36597 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Payer(uint32_t this_arg) {
36598 LDKChannelManager this_arg_conv;
36599 this_arg_conv.inner = (void*)(this_arg & (~1));
36600 this_arg_conv.is_owned = false;
36601 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36602 LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
36603 *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
36604 return (uint64_t)ret_ret;
36607 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_from_str(jstring s) {
36608 LDKStr s_conv = str_ref_to_owned_c(s);
36609 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
36610 *ret_conv = SiPrefix_from_str(s_conv);
36611 return (uint64_t)ret_conv;
36614 uint32_t __attribute__((visibility("default"))) TS_Invoice_from_str(jstring s) {
36615 LDKStr s_conv = str_ref_to_owned_c(s);
36616 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
36617 *ret_conv = Invoice_from_str(s_conv);
36618 return (uint64_t)ret_conv;
36621 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_from_str(jstring s) {
36622 LDKStr s_conv = str_ref_to_owned_c(s);
36623 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
36624 *ret_conv = SignedRawInvoice_from_str(s_conv);
36625 return (uint64_t)ret_conv;
36628 jstring __attribute__((visibility("default"))) TS_Invoice_to_str(uint32_t o) {
36630 o_conv.inner = (void*)(o & (~1));
36631 o_conv.is_owned = false;
36632 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36633 LDKStr ret_str = Invoice_to_str(&o_conv);
36634 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36639 jstring __attribute__((visibility("default"))) TS_SignedRawInvoice_to_str(uint32_t o) {
36640 LDKSignedRawInvoice o_conv;
36641 o_conv.inner = (void*)(o & (~1));
36642 o_conv.is_owned = false;
36643 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36644 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
36645 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36650 jstring __attribute__((visibility("default"))) TS_Currency_to_str(uint32_t o) {
36651 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
36652 LDKStr ret_str = Currency_to_str(o_conv);
36653 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36658 jstring __attribute__((visibility("default"))) TS_SiPrefix_to_str(uint32_t o) {
36659 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
36660 LDKStr ret_str = SiPrefix_to_str(o_conv);
36661 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);